feat(linter): add options.reportUnusedDisableDirectives to config file#19799
feat(linter): add options.reportUnusedDisableDirectives to config file#19799camc314 merged 8 commits intooxc-project:mainfrom
options.reportUnusedDisableDirectives to config file#19799Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new root-only .oxlintrc.json option to configure reporting of unused disable directives, aligning CLI flags with config-file driven behavior and regenerating the public schema/type artifacts.
Changes:
- Introduces
options.reportUnusedDisableDirectives(Allow/Warn/Deny) in Rust config types, schema, and generated TS types/docs. - Enforces “root-config-only” by rejecting nested configs that set the option with a dedicated diagnostic.
- Wires config into the CLI runner so CLI flags take precedence over config values.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tasks/website_linter/src/snapshots/schema_markdown.snap | Updates rendered schema docs snapshot to include the new option. |
| tasks/website_linter/src/snapshots/schema_json.snap | Updates rendered schema JSON snapshot to include the new option. |
| npm/oxlint/configuration_schema.json | Adds schema property for options.reportUnusedDisableDirectives. |
| crates/oxc_linter/src/config/oxlintrc.rs | Adds the option to OxlintOptions, supports merge/is_empty, and adds unit tests for deserialization/merge. |
| crates/oxc_linter/src/config/config_store.rs | Adds a ConfigStore accessor for the new option plus unit tests. |
| crates/oxc_linter/src/config/config_builder.rs | Adds a ConfigStoreBuilder accessor and tests for extends/override behavior. |
| crates/oxc_linter/fixtures/extends_config/options/report_unused_disable_directives_warn.json | New fixture for extends testing (warn). |
| crates/oxc_linter/fixtures/extends_config/options/report_unused_disable_directives_error.json | New fixture for extends testing (error). |
| crates/oxc_linter/fixtures/extends_config/options/report_unused_disable_directives_allow.json | New fixture for extends testing (allow/off). |
| apps/oxlint/src/lint.rs | Uses config value as fallback when CLI flags aren’t set (CLI takes precedence). |
| apps/oxlint/src/config_loader.rs | Rejects nested configs that set options.reportUnusedDisableDirectives, with tests + diagnostic helper. |
| apps/oxlint/src-js/package/config.generated.ts | Regenerates TS config types to include reportUnusedDisableDirectives. |
Merging this PR will not alter performance
Comparing Footnotes
|
…egration tests Co-authored-by: wagenet <9835+wagenet@users.noreply.github.com>
|
I see the typecheck option was added in the latest version, which was released minutes ago. When can this option be supported? |
|
@Mister-Hope please bear with me - this was only opened on Friday. |
6c810fb to
01cb9d7
Compare
…egration tests Co-authored-by: wagenet <9835+wagenet@users.noreply.github.com>
Closes oxc-project#15972. Adds `options.reportUnusedDisableDirectives` to `.oxlintrc.json`, following the same pattern as `typeAware` (oxc-project#19614) and `typeCheck` (oxc-project#19764). - Root-config-only (nested configs are rejected with a clear error) - CLI `--report-unused-disable-directives[-severity]` takes precedence over the config file value - Schema, TypeScript types, and website snapshots regenerated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…egration tests Co-authored-by: wagenet <9835+wagenet@users.noreply.github.com>
c066c16 to
b896bcf
Compare
See #15972.
Summary
options.reportUnusedDisableDirectivesto.oxlintrc.json, following the same pattern astypeAware(feat(linter): introduce typeAware as config options #19614) andtypeCheck(feat(linter): introduce typeCheck config option #19764)--report-unused-disable-directives/--report-unused-disable-directives-severitytake precedence over the config file value when both are setnpm/oxlint/configuration_schema.json), TypeScript types (config.generated.ts), and website snapshots regeneratedTest plan
oxlintrc.rs: deserialization,is_empty,mergeconfig_store.rs: accessor returns value /Noneby defaultconfig_loader.rs: nested config rejectionconfig_builder.rs:extendsinheritance and override precedencecargo test -p oxc_linter && cargo test -p oxlintNote on AI usage
This PR was implemented with Claude Code assistance and has been reviewed and tested by the contributor.
🤖 Generated with Claude Code