-
Notifications
You must be signed in to change notification settings - Fork 898
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 eslint to 9 #21918
Upgrade eslint to 9 #21918
Conversation
All that are removed are already part of the eslint/js/recommended shared configuration. There is one exception: no-native-reassign. It is deprecated and has been replaced with no-global-assign, which is part of the recommened config.
The Yoast configuration isn't responsible for rules other configs migh have enabled. This also cleans up our config a bit, keeping the focus on things we want to enforece. Some of these rules are interesting to us to enforce in the future. I'll create a new issue to track that.
no-shadow is its official replacement and caches the same problems
This doesn't change any of the rules, only the order in which they are in the config. This makes it easier to find details about a certain rule and understand its origin and purpose.
This is more clear than the integer values, but changes nothing else
Now it's a JS file, we can and should adhere to our own standards
wp i18n, which we use for our translations, doesn't handle strings that span multiple lines. That's why we often add eslint ignore comments to those. By ignoring strings, we make a tradeoff: we no longer have to eslint-disable those translations, but we won't get feedback on long non-translation strings that might have been better readable on separate lines.
This could be relevant when doing something like this: expect( new MyValueObject( null ) ).toThrow(...);
We have serveral cases where complexity is too high. To prevent us from adding eslint-ignore lines, we make this a warning, so we can set the max-warning threshlold. This will allow us to fix these cases gradually, while not losing track of them because they are ignored.
We disable this rule in a lot of projects already. Most of the time these expressions can do without a bulky jsdoc block. Let's leave it up to the reviewer to identify the exceptions where more context is needed.
Also lint all js, instead of just src. This requires some very minor fixes.
@diedexx Please be aware that following packages have been abandoned and are not actively maintained anymore:
Please consider using the other packages instead. |
A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch. |
@diedexx really impressed work to upgrade all rules and packages. When I run locally I get the following error with the current branch: Also I have checked premium - we use eslint-config-yoast there: So I guess when we merge current PR we'll have eslint issues there so I guess it's better to upgrader premium in scope of this ticket as well. |
Thanks @mykola! Oh good shouts!
|
A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch. |
@diedexx Please be aware that following packages have been abandoned and are not actively maintained anymore:
Please consider using the other packages instead. |
@mhkuu Please be aware that following packages have been abandoned and are not actively maintained anymore:
Please consider using the other packages instead. |
Context
Summary
This PR can be summarized in the following changelog entry:
eslint-disable max-len
for translation strings.Relevant technical choices:
Tip
Reviewer note
This PR is best reviewed commit-by-commit.
Please read trough the commit messages.
The branch starts with cleaning up the old config, to help make sense of it all.
After that focus shifts to moving everything in this repo over to a flat config.
yarn lint
script alone, with the exception of the eslint package, where I added thelint
script.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
yarn lint
in the project root. This should succeed. (albeit with a couple of warnings within the max-warning threshold for some packages)Relevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.Documentation
Quality assurance
Innovation
innovation
label.Fixes the "Deprecated rules" part of https://github.com/Yoast/lingo-other-tasks/issues/455