Skip to content

fix(linter): Fix JSON schema to deny additional properties for categories enum.#15257

Merged
camc314 merged 1 commit intomainfrom
disallow-invalid-categories
Nov 4, 2025
Merged

fix(linter): Fix JSON schema to deny additional properties for categories enum.#15257
camc314 merged 1 commit intomainfrom
disallow-invalid-categories

Conversation

@connorshea
Copy link
Member

@connorshea connorshea commented Nov 4, 2025

This ensures that VS Code and other editors will not accept unknown values for the categories field. Apparently, None doesn'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:

Screenshot 2025-11-03 at 10 49 01 PM

Part of #15247.

…ries enum.

This ensures that VS Code and other editors will not accept unknown values for the categories field.
Copilot AI review requested due to automatic review settings November 4, 2025 05:50
@connorshea connorshea requested a review from camc314 as a code owner November 4, 2025 05:50
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 4, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter C-bug Category - Bug labels Nov 4, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-hq
Copy link

codspeed-hq bot commented Nov 4, 2025

CodSpeed Performance Report

Merging #15257 will not alter performance

Comparing disallow-invalid-categories (20c98e7) with main (7a5c011)

Summary

✅ 4 untouched
⏩ 33 skipped1

Footnotes

  1. 33 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@camc314 camc314 merged commit d6996d0 into main Nov 4, 2025
28 checks passed
@camc314 camc314 deleted the disallow-invalid-categories branch November 4, 2025 11:52
@Boshen Boshen mentioned this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants