ESLint Plugin: Update rules for improved Prettier / TypeScript compatibility#6123
Merged
ESLint Plugin: Update rules for improved Prettier / TypeScript compatibility#6123
Conversation
**Why**: So that TypeScript syntax specifics don't cause conflicts with the base rules that assume JavaScript.
**Why**: Because stylistic enforcement should come through Prettier
Left-over from trying to configure TypeScript "project" parser option
changelog: Internal, Linting, Improve compatibility of ESLint configuration with Prettier and TypeScript
zachmargolis
approved these changes
Mar 30, 2022
Contributor
zachmargolis
left a comment
There was a problem hiding this comment.
LGTM! would it be worth committing scripts those JS blurbs as scripts so we could simplify running them for a future round of these changes?
Contributor
Author
Listing them the way I did might give a false impression that it's more automatable than it actually is, since it did still require a fair bit of manual review, particularly in determining which are "stylistic" rules and which TypeScript plugin rules extend a base rule. Not to say it couldn't be done, but it's probably more effort and less reliable than the value it might provide. |
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.
In order to avoid conflicts and redundancy, this pull request updates a number of rules to either (a) disable a stylistic rule which would be redundant with Prettier formatting, and (b) reduce conflicts with TypeScript syntax specifics, where the TypeScript ESLint plugin offers enhancements to the base rule.
In theory, this could also help speed up linting, since it's running fewer rule checks.
Method:
yarn eslint --print-config .eslintrcconsole.log(JSON.stringify(Object.entries(c.rules).filter(([k,v]) => v === 'error' || v[0] === 'error').filter(([k])=> !k.includes('/')).map(([k])=>k).sort(),null,2))