wikimedia / eslint-plugin-no-jquery

Control allowance of certain jQuery functions, and suggest or autofix alternatives.
MIT License
31 stars 8 forks source link

Allow global selector by ID #119

Closed adamwight closed 4 years ago

adamwight commented 5 years ago

Selection by ID is safe, we should allow it. ~~I believe that's what was originally intended in this rule?~~

Should the same fix be applied to the context selector below?

adamwight commented 5 years ago

I believe that's what was originally intended in this rule?

This was wrong, I see from the test that "#" was intentional, it's a jQuery < 3.3 thing.

Nevertheless, I'd like to get feedback on allowing "#id" selectors.

jdforrester commented 5 years ago

Wikimedia's coding standards have for ages strongly discouraged use of IDs. I don't think putting in effort to make it easier to use them is a good idea.

edg2s commented 5 years ago

Per James, I wouldn't want to turn this on in eslint-config-wikimedia, but one could make a case for adding an option to allow ID selectors for other users of this plugin.

edg2s commented 5 years ago

One could also enable it on a per-project basis. While we should continue to discourage IDs, giving people an option that is less drastic than turning the rule off completely might be beneficial.

jdforrester commented 5 years ago

Fine by me, just don't want to get Adam's hopes up.