fix(no-large-snapshots): actually compare allowed name strings to name #625
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.
Turns out when I converted this rule to TypeScript, I dropped the actual comparator, which apparently no ones noticed 😅
Came across this while doing #624, as I realised we're accepting RegExp instances from
.eslintrc.js
which isn't strictly wrong, but I think it might be worth deprecating in favor of just always taking RegExp strings as that's easy and reduces the chance of being broken by a minor version of ESLint.The migration would be that people just add^
&$
to the start and end of their strings respectively, and then add.source
to their RegExps.Edit: actually because we're accepting RegExp instances, we're getting both the source and flags, so we could do this change without it being breaking as we'd just wrap the strings in${name}$ `).
new RegExp(^
That means the breaking change would be no longer allowing devs to set RegExp flags used in matching, which shouldn't cause too much trouble as
i
would be the main useful flag, which you can implement long hand 🤔I mention this here as technically the behaviour is broken already, so it could be argued to be a breaking bugfix?