muenzpraeger / eslint-plugin-inclusive-language

An ESLint plugin to raise awareness for using inclusive language not only in your codebase, but in life.
MIT License
56 stars 10 forks source link

Suggestion: Option to not check inside of strings #19

Closed nzakas closed 3 years ago

nzakas commented 3 years ago

First, thanks for creating this plugin. I think it will be quite helpful to the JavaScript community.

I'd like to suggest adding an option to not search inside of strings. Frequently, the content of strings cannot be changed without changing the meaning of the text inside the strings. For example, if I'm running execSync("git fetch origin/master"), I can't actually change the use of "master" until the Git repository is updated.

I'd suggest that the rule not search inside of strings by default and then allow people to turn this ability on with an option.

Thanks again.

github-actions[bot] commented 3 years ago

Welcome! 👋

Thank you for posting this issue. 🙇🏼‍♂️ As I am currently on vacation I will come back to you begin of August. Stay safe!

muenzpraeger commented 3 years ago

Sorry, just seeing this. Busy times.

I am torn on this one. I'd say it's in general rare that these kinds of strings exist (just in comparison to what's else in a code base). And for those cases it could be simply disabled for the line - on purpose by the developer.

nzakas commented 3 years ago

Yes, one-off disabling was created for such instances. In my case, though, this wasn’t just a one-off occurrence, and because I don’t want to litter my code with disable comments my only choice is to disable the entire rule. Rules get used more when there are some basic options that let people opt-out of some cases.

Up to you, of course, just speaking from experience.

muenzpraeger commented 3 years ago

Point well made. Thanks for raising it.

I'd put it down as an enhancement in the next iteration to allow disabling text occurrences, but would leave the default on "on".

muenzpraeger commented 3 years ago

Just released v2.1.0 that switched string value linting to opt-in.