Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent-abbreviations: Add ignore option #891

Merged

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Oct 21, 2020

Fixes #567
Fixes #752

Maybe we can remove whitelist option later.

@fisker fisker force-pushed the prevent-abbreviations-ignore-3 branch 2 times, most recently from 59c66e9 to 1c7a46d Compare October 21, 2020 16:39
@fisker fisker force-pushed the prevent-abbreviations-ignore-3 branch from 1c7a46d to d73b664 Compare October 21, 2020 16:41
@futpib
Copy link
Collaborator

futpib commented Oct 21, 2020

I think we could solve those issues by fixing whitelist and without introducing regexps or a second ignore option.

We could make whitelist match any subsequence of the split identifier. For example (following up this #567 (comment)):
For fooE2eBar all of these would be checked against whitelist:

  • foo
  • e
  • 2
  • bar
  • barE
  • e2
  • 2e
  • eBar
  • fooE2
  • e2e
  • 2eBar
  • fooE2e
  • e2eBar
  • fooE2eBar

And if any of them is in the whitelist that subsequence is ignored.

But in my opinion it should not ignore the whole identifier if only subsequence matches whitelist.

For example, if the user had e2e in their whitelist, e2eErr should still be fixed to e2eError.

@fisker
Copy link
Collaborator Author

fisker commented Oct 21, 2020

I don't think there is a good solution for these cases, #567 has been there for a long time.

Instead of blocking people use this rule, I believe give an option to let them use on there own risk is the right thing to do.

@sindresorhus
Copy link
Owner

sindresorhus commented Dec 9, 2020

@futpib Can you open a new issue for your above comment? I think we should improve this rule, but I also think it's valuable to let users easily ignore things like this. There might be other cases we just cannot fix and this option lets user ignore instead of having to disable the whole rule.

@sindresorhus sindresorhus merged commit 898fcb4 into sindresorhus:master Dec 9, 2020
@fisker fisker deleted the prevent-abbreviations-ignore-3 branch December 9, 2020 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants