wikimedia / eslint-plugin-no-jquery

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

Create a recommended config #249

Open edg2s opened 4 years ago

edg2s commented 4 years ago

Currently this would probably only contain variable-name as half the rules depend on that being enforced.

It would be nice to enforce a deprecated config automatically but we can't tell which version of jQuery they are using.

We could put deprecated-2.latest in there as 1.x and 2x are EOL (https://github.com/jquery/jquery.com/issues/162).

It may also be possible read the jQuery version from package.json.

jdforrester commented 4 years ago

Currently this would probably only contain variable-name as half the rules depend on that being enforced.

Given this is recommended rather than automatically enforced, a more opinionated one isn't out of the question, if there are others.

It would be nice to enforce a deprecated config automatically but we can't tell which version of jQuery they are using.

We could put deprecated-2.latest in there as 1.x and 2x are EOL (jquery/jquery.com#162).

That could work as a starting point.

It may also be possible read the jQuery version from package.json.

That seems possibly a bit too magical? And breaks for yarn users etc. Eh. I'd be interested to hear from potential users outside the Wikimediverse.

edg2s commented 4 years ago

I was thinking more if there were an "engine" setting in package.json for jQuery, rather than inspecting the dependencies list (although the magical behaviour could be a fallback as along as there's a way to correct it).

Or we could introduce a setting that defaults to latest stable?