-
Notifications
You must be signed in to change notification settings - Fork 21
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
Upgrade to ESLint 9 #24
base: main
Are you sure you want to change the base?
Conversation
commit d06d40a Merge: a462335 ebced6b Author: Devin McIntyre <k.devin.mcintyre@gmail.com> Date: Fri Oct 18 14:09:03 2024 -0600 Merge branch 'update-to-eslint-9' of https://github.com/miyasudokoro/eslint-config-jquery into update-to-eslint-9 commit a462335 Author: Devin McIntyre <devin.mcintyre@ricoh-usa.com> Date: Fri Oct 18 13:51:44 2024 -0600 update to ESLint 9 commit ebced6b Author: Devin McIntyre <devin.mcintyre@ricoh-usa.com> Date: Fri Oct 18 13:51:44 2024 -0600 update to ESLint 9
Migrated to ESLint 9 configurations Updated all deprecated rules, including those that moved to @stylistic/js Implemented TODO: do not use the built version to check the code from test/fixtures/.eslintrc.js (deleted) Fixed the .gitattributes to actually enforce LF
Note: JQuery 3.7.1 has an invalid eslint ignore statement that makes the tests fail for this project in ESLint 9, but that must be ...\src\attributes\prop.js ...\src\selector.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, this sounds useful! I added a few remarks.
export default [ | ||
// ... any other configurations, | ||
jquery, | ||
// ... any other configurations | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timmywil that's probably a good idea; the way we use the config is too "picky"; we should perhaps just apply it on a global level and then provide overrides in separate blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At my workplace, we use eslint-config-jquery as one of the base sets of rules, then override a handful of them that we disagree with. It looks like this:
const base = {
plugins: {
'@stylistic/js': stylistic,
jsdoc
},
rules: {
'no-unused-expressions': [
'error',
{
'allowShortCircuit': true
}
],
'@stylistic/js/quotes': [
'error',
'single',
{
'avoidEscape': true,
'allowTemplateLiterals': true
}
],
'@stylistic/js/linebreak-style': 'off',
'jsdoc/tag-lines': 0,
'jsdoc/no-defaults': 0
..... more stuff here .....
};
..... more stuff here ....
export default [
ignores, // note: this must go first for it to be applied globally
js.configs.recommended,
jquery,
jsdoc.configs[ 'flat/recommended-typescript-flavor' ],
base,
overrideForUnitTests // this has a "files" selector for unit tests and exempts them from jsdoc and max-len
];
Don't worry about jQuery 3.7.1, we didn't have ESLint 9 or the flat config in the repo back then. The latest state of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments; thanks for the changes so far!
Please re-request review once every comment is addressed; I'll do a final review pass then, including me trying it locally (I don't have enough time at the moment).
@miyasudokoro Sorry for the delay, I just wanted to give you a status update. We are focused on releasing jQuery 4.0.0 now, I'm not sure if I'll be able to look at this PR finally before we do at least the RC release - and I want to test this on a few jQuery repositories. Also, while in jQuery on the |
BTW, the build is failing. Please update the Node.js version used in CI to 22, that should help. |
@mgol Thank you for the status updates. I am not very familiar with Github workflows, but I attempted to upgrade the Node.js version. |
Thanks for the Node update. The CI now fails on a different thing, can you have a look? You don't have to wait for me approving the run, BTW - CI is mostly just doing |
@mgol Those CI errors are the two things I noted in my Oct 18 comment. The tests won't pass until we're testing a jquery version that has removed those two invalid lines. I vaguely remember going to make a branch of jquery to fix them but seeing that they were already fixed by somebody else's branch, so I think this will resolve itself via the jquery 4.0.0 release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those CI errors are the two things I noted in my Oct 18 comment. The tests won't pass until we're testing a jquery version that has removed those two invalid lines.
Maybe it'd be better to change the approach here. Special handling of this PR is fine since it changes so much but what if we want to introduce changes to the rules later? We would have to first fix them in jQuery source without relying on this plugin to provide them, then wait for the release and only then update them here. jQuery sometimes has long breaks between releases, this seems like too much of a churn.
I'd propose the following:
- Keep
test/fixtures/jquery.js
in the repo. - Add an npm script that copies jQuery from
devDependencies
totest/fixtures/jquery.js
. This task should require being invoked manually, it should not be run in CI.
Then, if we want to introduce changes to some rules, we can patch the fixture in place and release the update without waiting for the next jQuery release.
Thoughts?
"devDependencies": { | ||
"eslint": "^8.5.0" | ||
"eslint": "^9.12.0", | ||
"jquery": "latest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to provide a concrete version here, even without the ^
range. This is because code style changes are not breaking and may happen even in patch releases, breaking the build.
@miyasudokoro Hey, are you interested in finishing this PR? |
TODO: do not use the built version to check the code
from test/fixtures/.eslintrc.js (deleted)