Fix TS package not to override base no-restricted-syntax selectors#436
Open
Fix TS package not to override base no-restricted-syntax selectors#436
Conversation
Both the `eslint-config` and `eslint-config-typescript` packages list the `no-restricted-syntax` rule. But `eslint-config-typescript` overwrites the selectors that `eslint-config` specifies, meaning that some invalid syntax is not detected in TypeScript files that would ordinarily be detected in JavaScript files. This commit ensures that the two are always kept in sync.
83d4872 to
395add2
Compare
mcmire
commented
Apr 1, 2026
|
|
||
| ### Fixed | ||
|
|
||
| - **BREAKING:** Restrict usage of `with`, `in`, and sequence expressions, which should have been inherited from the base config but were mistakenly overridden ([#436](https://github.com/MetaMask/eslint-config/pull/436)) |
Contributor
Author
There was a problem hiding this comment.
We shouldn't have been overriding these rules, but it's been a while since we made a new eslint-config release, so even though I don't like that we have to mark this change as breaking, I figure it's probably better to do so than not.
Contributor
Author
There was a problem hiding this comment.
I could also wait to merge this if there are any non-breaking changes we'd like to release first.
cryptodev-2s
approved these changes
Apr 1, 2026
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.
Both the
eslint-configandeslint-config-typescriptpackages list theno-restricted-syntaxrule. Buteslint-config-typescriptoverwrites the selectors thateslint-configspecifies, meaning that some invalid syntax is not detected in TypeScript files that would ordinarily be detected in JavaScript files. This commit ensures that the two are always kept in sync.Fixes #434.
Note
Medium Risk
Changes TypeScript linting behavior by re-enabling base
no-restricted-syntaxselectors (with,in, sequence expressions), which can introduce new lint failures across TS codebases. The merge logic is small but relies on correctly collecting/ordering rule options from the base flat config.Overview
Fixes
@metamask/eslint-config-typescriptso it no longer silently overwrites the baseno-restricted-syntaxconfiguration in flat config mode.The TypeScript config now imports the base config and programmatically collects/extends its array-valued rule options, ensuring TS files also forbid
withstatements, theinoperator, and sequence expressions while still adding the TypeScript-specific restriction against TSprivatemodifiers.Updates the TypeScript package
rules-snapshot.jsonand documents the (breaking) linting fix in the TypeScript changelog.Written by Cursor Bugbot for commit 107bcfe. This will update automatically on new commits. Configure here.