bun/consistent-directive-prefix
Require comments that turn rules off to start with the same word, eslint or oxlint
fixable
eslint-disable and oxlint-disable comments both turn a rule off. If a project mixes them, a search for one spelling misses the other, and ESLint ignores the oxlint ones.
The default is eslint, which ESLint, oxlint, and bun lint all read. The rule checks -disable, -disable-line, -disable-next-line, and -enable comments.
--fix rewrites the prefix.
Configure#
Off by default. To turn it on:
bunfig.toml
[lint.rules]
"bun/consistent-directive-prefix" = "error" # or "warn"Every option, set to its default:
bunfig.toml
[lint.rules]
"bun/consistent-directive-prefix" = ["error", {
prefix = "eslint", # "eslint" or "oxlint"
}]Examples#
example.js1 problem
// oxlintUse eslint instead of oxlint.-disable-next-line no-console
console.log(version);example.jsNo problems
// eslint-disable-next-line no-console
console.log(version);Options#
| Option | Default | What it does |
|---|---|---|
prefix | "eslint" | The word to start with: "eslint" or "oxlint". |
bunfig.toml
[lint.rules]
"bun/consistent-directive-prefix" = ["error", { prefix = "oxlint" }]example.jswith
{ "prefix": "oxlint" }2 problems/* eslintUse oxlint instead of eslint.-disable no-console */
console.log(version);
/* eslintUse oxlint instead of eslint.-enable no-console */example.jswith
{ "prefix": "oxlint" }No problems/* oxlint-disable no-console */
console.log(version);
/* oxlint-enable no-console */