Fix unintended overwrite of eslint no-restricted-syntax#62301
Conversation
| }, | ||
| ]; | ||
|
|
||
| const restrictedSyntax = [ |
There was a problem hiding this comment.
This chunk of code was just extracted. No changes.
| rules: { | ||
| 'no-restricted-syntax': [ | ||
| 'error', | ||
| ...restrictedSyntax, |
There was a problem hiding this comment.
We also need to add ...restrictedSyntaxComponents here, but since it will catch a bunch of previously uncaught violations, I'll address this in a separate PR.
There was a problem hiding this comment.
Previously uncaught violation due to the configuration error.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 1.74 MB ℹ️ View Unchanged
|
…62301) * Fix unintended overwrite of eslint `no-restricted-syntax` * Fix errors in components Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org> Co-authored-by: fullofcaffeine <fullofcaffeine@git.wordpress.org>
What?
Fixes the
eslintrcfile so that theno-restricted-syntaxrules are applied as intended.Why?
Any settings for the same rule (
no-restricted-syntaxin this case) will be completely overwritten by subsequentoverridessettings, not merged. I had unconsciously been treating it like they would be merged 🙈How?
Extracted out the restricted syntax rules to be more composable. (This is similar to what had already been done with
restrictedImports.)Testing Instructions
✅ The "global" restricted syntax rules at the root level should also trigger on the following files, as originally intended: