fix(linter): Fix JSON schema to deny additional properties for categories enum.#15257
fix(linter): Fix JSON schema to deny additional properties for categories enum.#15257
Conversation
…ries enum. This ensures that VS Code and other editors will not accept unknown values for the categories field.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds strict property validation to the OxlintCategories JSON schema by setting additionalProperties to false, ensuring only the predefined rule categories are allowed in the configuration.
- Modified the Rust schema generation to explicitly disallow additional properties
- Updated both the npm package schema and test snapshot to reflect this change
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_linter/src/config/categories.rs | Changed additional_properties from None to Some(Box::new(false.into())) to disallow extra properties |
| npm/oxlint/configuration_schema.json | Added "additionalProperties": false to the OxlintCategories schema definition |
| crates/oxc_linter/src/snapshots/schema_json.snap | Updated snapshot to include "additionalProperties": false in the OxlintCategories schema |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #15257 will not alter performanceComparing Summary
Footnotes
|
This ensures that VS Code and other editors will not accept unknown values for the categories field. Apparently,
Nonedoesn't work as expected here 🤷And now I correctly get a warning in the editor, to match the one I get when running oxlint with a config like this:
Part of #15247.