Skip to content

feat(linter/eslint): implement no-restricted-properties rule#21980

Closed
bienzaaron wants to merge 7 commits into
oxc-project:mainfrom
bienzaaron:main
Closed

feat(linter/eslint): implement no-restricted-properties rule#21980
bienzaaron wants to merge 7 commits into
oxc-project:mainfrom
bienzaaron:main

Conversation

@bienzaaron

Copy link
Copy Markdown
Contributor

implements https://eslint.org/docs/latest/rules/no-restricted-properties

AI Disclosure: I am new to rust as well as this repo, and I have used AI to help me understand rust/oxc concepts.

@bienzaaron
bienzaaron requested a review from camc314 as a code owner April 30, 2026 05:00
@bienzaaron bienzaaron changed the title feat: implement no-restricted-properties feat(linter): implement no-restricted-properties Apr 30, 2026
@camc314 camc314 added the A-linter Area - Linter label May 1, 2026
@camc314 camc314 changed the title feat(linter): implement no-restricted-properties feat(linter/eslint): implement no-restricted-properties rule May 1, 2026
@camc314
camc314 requested a review from Copilot May 1, 2026 12:40
@camc314

camc314 commented May 1, 2026

Copy link
Copy Markdown
Contributor

@bienzaaron can you close this one and make a new PR from a branch? I don't have permission to push fixes to main on your fork.

Thanks!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds the ESLint-compatible no-restricted-properties rule to oxc_linter, including diagnostics, configuration parsing, rule registration, and snapshot-based tests.

Changes:

  • Implement eslint/no-restricted-properties rule logic (member access + destructuring cases) with configurable restriction details.
  • Register the new rule in the eslint module list and generated rule enum/runner plumbing.
  • Add snapshot output for the new rule’s test suite.

Reviewed changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/oxc_linter/src/rules/eslint/no_restricted_properties.rs New rule implementation + tests and config validation
crates/oxc_linter/src/snapshots/eslint_no_restricted_properties.snap Snapshot coverage for diagnostics emitted by the new rule
crates/oxc_linter/src/rules.rs Expose the new eslint rule module
crates/oxc_linter/src/generated/rules_enum.rs Add rule to generated enum/export/id plumbing
crates/oxc_linter/src/generated/rule_runner_impls.rs Register AST node types that should trigger the rule runner

Comment on lines +588 to +592
(
"let {baz: bar} = foo;",
Some(serde_json::json!([ { "object": "foo", "allowProperties": ["baz"], }, ])),
), // { "ecmaVersion": 6 }
("(foo || bar).baz", Some(serde_json::json!([{ "object": "foo", "property": "baz" }]))),

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

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

The last entry in pass is missing a comma after the preceding tuple (after the // { "ecmaVersion": 6 } comment). As written, this will not compile because the next tuple starts immediately after the previous one.

Copilot uses AI. Check for mistakes.
@camc314
camc314 marked this pull request as draft May 1, 2026 14:33
@bienzaaron

Copy link
Copy Markdown
Contributor Author

Hm you should be able to - I made sure to allow edits from maintainers and there's no branch protection on my fork.

gave it a shot at #22080

@camc314

camc314 commented May 2, 2026

Copy link
Copy Markdown
Contributor

Thanks!

I think it's something strange because of the use of the main branch.

@camc314 camc314 self-assigned this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants