feat(linter/eslint): implement id-denylist rule#24632
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 783e0006db
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| array: Some(Box::new(ArrayValidation { | ||
| additional_items: Some(Box::new(r#gen.subschema_for::<String>())), | ||
| ..Default::default() |
There was a problem hiding this comment.
Require an array in the rule configuration schema
ArrayValidation alone does not constrain the instance type, so the generated configuration schema accepts non-array values such as "id-denylist": {} (all array keywords are ignored for objects), while TupleRuleConfig rejects them at runtime with “Expected array for rule configuration.” This leaves editor/schema consumers unable to flag invalid configs before Oxlint fails; set the schema object's instance type to Array (and ideally mirror ESLint's uniqueItems constraint).
Useful? React with 👍 / 👎.
Merging this PR will not alter performance
Comparing Footnotes
|
| #[derive(Debug, Default, Clone, Deserialize, Serialize)] | ||
| pub struct IdDenylist(Box<FxHashSet<String>>); | ||
|
|
||
| impl JsonSchema for IdDenylist { |
There was a problem hiding this comment.
this rule uses weird config like this "id-denylist": ["error", "data", "err", "e", "cb", "callback"] without manually implementing JsonSchema it generates incorrect json config, i followed same pattern used by no-restricted-imports and no-restricted-properties
| } | ||
|
|
||
| fn is_known_external_global(ident: &IdentifierReference, ctx: &LintContext) -> bool { | ||
| pub fn is_known_external_global(ident: &IdentifierReference, ctx: &LintContext) -> bool { |
There was a problem hiding this comment.
dont know if its ok to reexport some helpers like this if they’re only used in id-match and id-denylist, or if it’s better to create a helper file?
46a8851 to
0e98b6d
Compare
this PR implements
eslint/id-denylist, issue #479