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.
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 */``````jsconsole.log("Hello, world!"); // oxlint-disable-line no-consoleconsole.log(x++); // oxlint-disable-line no-console, no-plusplus``````js// oxlint-disable-next-line no-consoleconsole.log("Hello, world!"); // allowed because of the previous commentconsole.log(x++); // not allowed because the previous comment only applied to the previous line// oxlint-disable-next-line no-console, no-plusplusconsole.log("Hello, world!"); // allowed``````bashoxlint --report-unused-disable-directives``````bashoxlint --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" },});
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.