Skip to content

Fix TS package not to override base no-restricted-syntax selectors#436

Open
mcmire wants to merge 3 commits intomainfrom
dont-override-no-restricted-syntax
Open

Fix TS package not to override base no-restricted-syntax selectors#436
mcmire wants to merge 3 commits intomainfrom
dont-override-no-restricted-syntax

Conversation

@mcmire
Copy link
Copy Markdown
Contributor

@mcmire mcmire commented Apr 1, 2026

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.

Fixes #434.


Note

Medium Risk
Changes TypeScript linting behavior by re-enabling base no-restricted-syntax selectors (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-typescript so it no longer silently overwrites the base no-restricted-syntax configuration 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 with statements, the in operator, and sequence expressions while still adding the TypeScript-specific restriction against TS private modifiers.

Updates the TypeScript package rules-snapshot.json and 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.

@mcmire mcmire requested a review from a team as a code owner April 1, 2026 17:48
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.
@mcmire mcmire force-pushed the dont-override-no-restricted-syntax branch from 83d4872 to 395add2 Compare April 1, 2026 17:58

### 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))
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I could also wait to merge this if there are any non-breaking changes we'd like to release first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eslint-config-typescript: no-restricted-syntax rule replaces configuration in eslint-config

2 participants