Skip to content

Inline ignore comments

Ignore comments provide an escape hatch for exceptional cases where a rule is correct in general but needs to be suppressed in a small, well scoped section of code. Inline comments override configuration files.

Oxlint supports line comments (//) and block comments (/* */). Comments must start with one of the keywords below.

oxlint-disable

Disable one or more rules until the end of the file, or until they are re-enabled.

js
// Disable all Oxlint rules for the rest of the file
/* oxlint-disable */

// Disable a single rule in this file
/* oxlint-disable no-console */

// Disable multiple rules in this file
/* oxlint-disable no-console, typescript/no-floating-promises */
``````js
/* oxlint-enable no-console */

/* oxlint-enable no-console, no-alert */
``````js
console.log("Hello, world!"); // oxlint-disable-line no-console

console.log(x++); // oxlint-disable-line no-console, no-plusplus
``````js
// oxlint-disable-next-line no-console
console.log("Hello, world!"); // allowed because of the previous comment
console.log(x++); // not allowed because the previous comment only applied to the previous line

// oxlint-disable-next-line no-console, no-plusplus
console.log("Hello, world!"); // allowed
``````bash
oxlint --report-unused-disable-directives
``````bash
oxlint --report-unused-disable-directives-severity error
``````jsonc [.oxlintrc.json]
{
  "$schema": "./node_modules/oxlint/configuration_schema.json",
  "options": {
    "reportUnusedDisableDirectives": "error", // or "off" or "warn"
  },
}
``````ts [oxlint.config.ts]
import { defineConfig } from "oxlint";

export default defineConfig({
  options: {
    reportUnusedDisableDirectives: "error", // or "off" or "warn"
  },
});