feat(linter/eslint): implement no-restricted-properties rule#21980
feat(linter/eslint): implement no-restricted-properties rule#21980bienzaaron wants to merge 7 commits into
Conversation
no-restricted-propertiesno-restricted-properties
no-restricted-properties|
@bienzaaron can you close this one and make a new PR from a branch? I don't have permission to push fixes to Thanks! |
There was a problem hiding this comment.
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-propertiesrule 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 |
| ( | ||
| "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" }]))), |
There was a problem hiding this comment.
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.
|
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 |
|
Thanks! I think it's something strange because of the use of the |
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.