feat(linter): add ignoreEslintDirectives config option#20447
Closed
osdiab wants to merge 2 commits intooxc-project:mainfrom
Closed
feat(linter): add ignoreEslintDirectives config option#20447osdiab wants to merge 2 commits intooxc-project:mainfrom
osdiab wants to merge 2 commits intooxc-project:mainfrom
Conversation
pull Bot
pushed a commit
to BasixKOR/oxc
that referenced
this pull request
Apr 23, 2026
…t#21384) ## Summary - add a root-only `options.respectEslintDisableDirectives` config option - make directive parsing and `reportUnusedDisableDirectives` honor that switch - preserve current behavior by default with `true` - regenerate the schema / generated TS config types and add CLI + unit coverage ## Proposal Use a boolean option to control whether oxlint recognizes ESLint-style disable directives: ```json { "options": { "respectEslintDisableDirectives": false } } ``` Behavior: - unset or `true`: oxlint recognizes both `oxlint-*` and `eslint-*` - `false`: oxlint only recognizes `oxlint-*` This also applies to `reportUnusedDisableDirectives`. ## Notes - unused-directive diagnostics now report the actual matched prefix (`oxlint-disable` vs `eslint-disable`) instead of always saying `eslint-disable` - the option is root-only, consistent with the other global `options.*` switches in the config loader closes oxc-project#20447 fixes oxc-project#20375 --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Made with AI, I am not familiar with this codebase, but visual inspection looks pretty reasonable to me.
Closes #20375
Summary
Adds a new
ignoreEslintDirectivesoption toOxlintOptionsthat causes the linter to skipeslint-disable,eslint-disable-next-line,eslint-disable-line, andeslint-enabledirective comments, while continuing to honoroxlint-*equivalents. This is useful for projects migrating from ESLint where legacyeslint-*comments should no longer suppress diagnostics. Only supported for root config, similar to thereportUnusedDisableDirectivesconfig.Usage
{ "options": { "ignoreEslintDirectives": true } }Changes
oxlintrc.rs— Add ignore_eslint_directives: Option to OxlintOptions with serde, is_empty, and merge supportconfig_store.rs— Expose ignore_eslint_directives() on ConfigStore, defaulting to falselib.rs— Add pub(crate) config() accessor on Linter so runtime can read the resolved configdisable_directives.rs— DisableDirectivesBuilder::build / build_impl accept ignore_eslint_directives: bool; when true, eslint-disable and eslint-enable prefixes are skippedhost.rs— Thread the flag through ContextSubHost::new_with_framework_optionsruntime.rs— Resolve the option from ConfigStore and pass it at all three ContextSubHost creation sitesTests
oxlintrc.rs— Deserialization (true/false/absent) and merge (root wins, base propagates)config_store.rs— ignore_eslint_directives from config and default-false behaviordisable_directives.rs— Three unit tests covering: eslint directives skipped while oxlint honored, eslint-enable ignored while oxlint-enable works, and default false preserves existing behaviorfixtures/cli/ignore_eslint_directives/)