feat(linter): verify eslint/no-restricted-globals config schema#24598
Merged
Sysix merged 3 commits intoJul 26, 2026
Conversation
The blocker issue oxc-project#23617 (missing checkGlobalObject/globalObjects options) was resolved, but the rule remained in NO_VERIFIED_VALID_SCHEMA because the derived schema described the internal config struct rather than the user-facing positional-array format. Adds a hand-written JsonSchema (following the no-restricted-imports pattern) describing the three accepted item forms: a global name string, a { name, message } object, and the object form with globals / checkGlobalObject / globalObjects. Removes the rule from NO_VERIFIED_VALID_SCHEMA and regenerates the configuration schema and TS types. Part of oxc-project#22955
Signed-off-by: Alexander S. <[email protected]>
Merging this PR will not alter performance
Comparing Footnotes
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #22955. Follow-up to the resolved #23617.
What
eslint/no-restricted-globalsstayed inNO_VERIFIED_VALID_SCHEMAafter #23617 was resolved, because the derived schema described the internalNoRestrictedGlobalsConfigstruct (aglobalshash map) rather than the user-facing positional-array format the rule actually parses.This PR adds a hand-written
JsonSchemafollowing the existingno-restricted-importspattern, describing the three accepted positional item forms:"event"— a global name string{ "name": "event", "message": "…" }— a name/message object{ "globals": [ … ], "checkGlobalObject": true, "globalObjects": [ … ] }— the object form added in linter: supporteslint/no-restricted-globalsnew option enum #23617Generated TS declaration:
Verified against the #22955 checklist: reflects all accepted user configuration forms, denies unknown fields on object forms, and produces no
[k: string]: unknownin the TS declaration.from_configurationand rule behavior are unchanged; rule tests pass.Note: this branch removes only the
no-restricted-globalsentry fromNO_VERIFIED_VALID_SCHEMA; #24586 (separate PR) removes thefilename-caseentry, so whichever merges second will have a trivial conflict in that array.Disclosure
This contribution was developed with assistance from Claude Code (Anthropic); I have reviewed and tested all changes.