(for transparency, the following was AI-generated, then reviewed by me)
Summary
Allow disabling the auto-fix behavior of the no-console rule on a per-rule basis, while keeping the rule itself enabled.
Motivation
The no-console rule is auto-fixable in oxlint. When lint:fix runs on save (or via a pre-commit hook, editor integration, etc.), any console.log I add for debugging is silently removed before I get a chance to use it.
This makes the typical debugging loop painful:
- Add
console.log(...) to inspect a value.
- Save the file.
- The line is gone.
- Re-add it, remember to add the disable comment, run the code, then clean up manually.
I still want the rule enabled — console.log shouldn't ship to production. I just don't want it auto-removed while I'm actively working on the file.
Proposed solution
Add a way to opt out of auto-fix for a specific rule, without disabling the rule itself. The rule would still report violations (so CI / the editor would flag them), but --fix would leave them alone.
A couple of possible shapes:
Option A — per-rule config object
Option B — global noFix list
Option A feels most consistent with how rule configuration usually works. Either way, it needs to live in the config file so it applies to editor/IDE integrations on save — a CLI flag wouldn't help, since the annoying auto-fix happens through the editor's lint-on-save, not from running oxlint --fix manually.
Workarounds considered
- Disabling the rule entirely — no, I want the safety net for committed code.
// oxlint-disable-next-line no-console — works, but I have to remember to add it every time, and the comment also gets in the way.
- Using
console.warn / console.error — only helps if those variants are allowed, and it's not really what I want to log.
- Turning off format-on-save / fix-on-save — too broad; I lose auto-fix for every other rule too.
Prior art
ESLint has discussed similar requests (e.g. per-rule fixable: false overrides). Some projects work around it by wrapping rules, but a first-class option in oxlint would be cleaner.
Additional context
This is a debugging-ergonomics issue rather than a correctness one — no-console is doing exactly what it's documented to do. The request is to make the auto-fix opt-out-able so the rule stays useful in CI without fighting the developer mid-edit.
(for transparency, the following was AI-generated, then reviewed by me)
Summary
Allow disabling the auto-fix behavior of the
no-consolerule on a per-rule basis, while keeping the rule itself enabled.Motivation
The
no-consolerule is auto-fixable in oxlint. Whenlint:fixruns on save (or via a pre-commit hook, editor integration, etc.), anyconsole.logI add for debugging is silently removed before I get a chance to use it.This makes the typical debugging loop painful:
console.log(...)to inspect a value.I still want the rule enabled —
console.logshouldn't ship to production. I just don't want it auto-removed while I'm actively working on the file.Proposed solution
Add a way to opt out of auto-fix for a specific rule, without disabling the rule itself. The rule would still report violations (so CI / the editor would flag them), but
--fixwould leave them alone.A couple of possible shapes:
Option A — per-rule config object
{ "rules": { "no-console": ["error", { "fix": false }] } }Option B — global
noFixlist{ "noFix": ["no-console"], "rules": { "no-console": "error" } }Option A feels most consistent with how rule configuration usually works. Either way, it needs to live in the config file so it applies to editor/IDE integrations on save — a CLI flag wouldn't help, since the annoying auto-fix happens through the editor's lint-on-save, not from running
oxlint --fixmanually.Workarounds considered
// oxlint-disable-next-line no-console— works, but I have to remember to add it every time, and the comment also gets in the way.console.warn/console.error— only helps if those variants are allowed, and it's not really what I want to log.Prior art
ESLint has discussed similar requests (e.g. per-rule
fixable: falseoverrides). Some projects work around it by wrapping rules, but a first-class option in oxlint would be cleaner.Additional context
This is a debugging-ergonomics issue rather than a correctness one —
no-consoleis doing exactly what it's documented to do. The request is to make the auto-fix opt-out-able so the rule stays useful in CI without fighting the developer mid-edit.