Skip to content

feat(linter): add ignoreEslintDirectives config option#20447

Closed
osdiab wants to merge 2 commits intooxc-project:mainfrom
osdiab:osdiab/disable-eslint-directives-setting
Closed

feat(linter): add ignoreEslintDirectives config option#20447
osdiab wants to merge 2 commits intooxc-project:mainfrom
osdiab:osdiab/disable-eslint-directives-setting

Conversation

@osdiab
Copy link
Copy Markdown

@osdiab osdiab commented Mar 17, 2026

Made with AI, I am not familiar with this codebase, but visual inspection looks pretty reasonable to me.

Closes #20375

Summary

Adds a new ignoreEslintDirectives option to OxlintOptions that causes the linter to skip
eslint-disable, eslint-disable-next-line, eslint-disable-line, and eslint-enable directive comments, while continuing to honor oxlint-* equivalents. This is useful for projects migrating from ESLint where legacy eslint-* comments should no longer suppress diagnostics. Only supported for root config, similar to the reportUnusedDisableDirectives config.

Usage

{
  "options": {
    "ignoreEslintDirectives": true
  }
}

Changes

  • oxlintrc.rs — Add ignore_eslint_directives: Option to OxlintOptions with serde, is_empty, and merge support
  • config_store.rs — Expose ignore_eslint_directives() on ConfigStore, defaulting to false
  • lib.rs — Add pub(crate) config() accessor on Linter so runtime can read the resolved config
  • disable_directives.rs — DisableDirectivesBuilder::build / build_impl accept ignore_eslint_directives: bool; when true, eslint-disable and eslint-enable prefixes are skipped
  • host.rs — Thread the flag through ContextSubHost::new_with_framework_options
  • runtime.rs — Resolve the option from ConfigStore and pass it at all three ContextSubHost creation sites
  • Schema / generated types — Regenerated configuration_schema.json, schema snapshots, and config.generated.ts

Tests

  • oxlintrc.rs — Deserialization (true/false/absent) and merge (root wins, base propagates)
  • config_store.rs — ignore_eslint_directives from config and default-false behavior
  • disable_directives.rs — Three unit tests covering: eslint directives skipped while oxlint honored, eslint-enable ignored while oxlint-enable works, and default false preserves existing behavior
  • CLI snapshot test with fixture (fixtures/cli/ignore_eslint_directives/)

@github-actions github-actions Bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request labels Mar 17, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oxlint and eslint in parallel with reportUnusedDisableDirectives setting causes eslint disables to be flagged as unused

1 participant