chore: add eslint-plugin-regexp internally (mostly)#109209
Draft
JoshuaKGoldberg wants to merge 2 commits intomasterfrom
Draft
chore: add eslint-plugin-regexp internally (mostly)#109209JoshuaKGoldberg wants to merge 2 commits intomasterfrom
JoshuaKGoldberg wants to merge 2 commits intomasterfrom
Conversation
db9129a to
f97ee6a
Compare
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.
Note
I'm still onboarding to Sentry (it's my first week!) and testing out developer setup. This PR is part of that testing. It might go nowhere. I haven't discussed this change with anyone. Don't take this as a statement of strong intent! 🙂
Enables most of
eslint-plugin-regexp's recommended rules internally, fixing most of the new reports. To avoid stepping into any implicitly held strong opinions, this disables any plugin rule that doesn't seem to result in immediately objectively "better" code.ota-meshi.github.io/eslint-plugin-regexp/rules has all the rules in the plugin: search for 🟢 to narrow down to just those in the recommended ruleset. Out of those, these rules produced reports:
regexp/negation/[^\d]/->/\D/regexp/no-dupe-characters-character-class/[a-z\\s]/'ssduplicated bya-zregexp/no-dupe-disjunctions/[ab]|[ba]/'s[ba]duplicating[ab]regexp/no-trivially-nested-quantifier/(?:a{1,2})+/->/a+/regexp/no-useless-character-class/a[b]c/->/abc/regexp/no-useless-escape\escacpes that are unnecessary and don't do anything, such as/\a/->/a/regexp/no-useless-flag/\w+/i->/\w+/regexp/no-useless-lazy/a{1}?/->/a{1}/regexp/no-useless-non-capturing-group/(?:a)/.test(str)->/a/.test(str)regexp/no-useless-quantifier/a{1}/->/a/regexp/prefer-character-class/[a|b|c]/->/[abc]/regexp/prefer-d/[0-9]/->/\d/regexp/prefer-plus-quantifier{1,}ranges to an equivalent succinct+quantifier, such as/a{1,}/->/a+/regexp/prefer-question-quantifier{0,1}ranges to an equivalent succinct?quantifier, such as/a{0,}/->/a?/regexp/prefer-w/[0-9a-zA-Z_]/->/\w/Fun fact: although this diff is +154 / -72, 75 of those added lines are from config/lock-files and 10 are comments. The actual impact to the codebase is +69 / -72. According to my rough character counting of files the actual number of removed characters is approximately 231.