Skip to content
← Back to rules

eslint/no-warning-comments Pedantic

What it does

Disallows warning comments such as TODO, FIXME, XXX in code.

Why is this bad?

Developers often add comments like TODO or FIXME to mark incomplete work or areas that need attention. While useful during development, these comments can indicate unfinished code that shouldn't be shipped to production. This rule helps catch such comments before they make it into production code.

Examples

Examples of incorrect code for this rule:

javascript
// TODO: implement this feature
function doSomething() {}

// FIXME: this is broken
const x = 1;

/* XXX: hack */
let y = 2;

Examples of correct code for this rule:

javascript
// This is a regular comment
function doSomething() {}

// Note: This explains something
const x = 1;

Configuration

This rule accepts a configuration object with the following properties:

decoration

type: string[]

default: []

An array of characters to ignore at the start of comments when location is "start".

Useful for ignoring common comment decorations like * in JSDoc-style comments.

location

type: "start" | "anywhere"

default: "start"

Where to check for the terms.

"start"

Terms must appear at the start of the comment, after any decoration.

"anywhere"

Terms can appear anywhere in the comment.

terms

type: string[]

default: ["todo", "fixme", "xxx"]

An array of terms to match. The matching is case-insensitive.

How to use

To enable this rule using the config file or in the CLI, you can use:

json
{
  "rules": {
    "no-warning-comments": "error"
  }
}
ts
import { defineConfig } from "oxlint";

export default defineConfig({
  rules: {
    "no-warning-comments": "error",
  },
});
bash
oxlint --deny no-warning-comments

Version

This rule was added in v1.24.0.

References