-
Notifications
You must be signed in to change notification settings - Fork 295
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
Usage of outdated ESLint configuration #217
Comments
I made a slight modification to be more explicit about what kind of changes need to be done to the ESLint configuration. The last part,
|
Updating the estimate on this one as it appears to require more manual updates than expected. Also, there was a problem while upgrading to the new eslint package which required a bit more time as well. |
Yeah S is more accurate here I think. Regarding eslint, worth noting that there seems to be a bug in 6.2.x in combination with babel-eslint that shows some false positives. |
Thanks for the heads up! Is there an issue you can link me to for more info/context? |
@swissspidy is this something that we should consider is an amendment to the acceptance criteria (i.e. required) or is this more of a nice to have - if it fits in the time of the estimate and if not we add ignores for any remaining and handle those in a subsequent ticket? |
eslint/eslint#12117 Might be possible that this project here is not affected by this though.
It's more of a nice to have if it fits in the time. No ignores should be needed otherwise, as the rule simply would not apply. |
Update:
|
Why not upgrade to 6.2.0 then instead of latest (6.2.1)? I think ESLint 6 is the version the WP ESLint plugin is tested with and works best. |
The issue exists in 6.2.0 as well as reported in eslint/eslint#12117. I'll try 6.1.0 which is said to not exhibit the problem. |
Ah, right, that's what I meant. |
OK 6.1.0 is working just fine. Pushing the update now, can you review as soon as the build finishes @swissspidy? |
Took a little bit longer to work out the kinks as I didn't realize some of the other parts were failing, but it should be all good now! 😄 |
QA pass. All acceptance criteria checks out. Running |
Bug Description
While working on #163, I noticed that ESLint does not use the recommended and most up-to-date
@wordpress/eslint-plugin
to help adhere to WordPress coding standards. Instead, it uses the outdated and deprecatedeslint-config-wordpress
package.I remember flagging this in the past, but it seems this has been forgotten.
Also,
npm run lint:js
does not lint any test files or config files. Personally, I think the code style should be adhered everywhere throughout the project, not just inassets/js
.You can easily see that in some of the configuration files which have inconsistent indentation (example: https://github.com/google/site-kit-wp/pull/163/files#diff-df39304d828831c44a2b9f38cd45289c) and things like that.
To achieve this, an
.eslintignore
file can be added to make sure only relevant project files are run through ESLint, and not things likenode_modules
or thedist
folder.This would be a good opportunity to check some of the rule exceptions in the ESLint configuration as well.
For comparison, the ESLint setup in the AMP plugin uses that ESLint plugin as well and is super simple:
https://github.com/ampproject/amp-wp/blob/fd7a5adf5f7e3b74c3b8c386b220249237cc34c4/.eslintrc
https://github.com/ampproject/amp-wp/blob/fd7a5adf5f7e3b74c3b8c386b220249237cc34c4/.eslintignore
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
@wordpress/eslint-plugin
package for linting JavaScript.eslint-config-wordpress
package should no longer be used..eslintrc
should extend the@wordpress/eslint-plugin
configuration and not contain any custom rule overrides (as it does now)..eslintignore
file should be added to ignore vendor / build directories from linting.npm run lint:js
command should lint all JavaScript files in the project, not only those in theassets
directory. The only exception are the "automatically" ignored ones from.eslintignore
.Implementation Brief
@wordpress/eslint-plugin
to thedevDependencies
inpackage.json
babel-eslint
,eslint-config-standard
,eslint-config-wordpress
,eslint-plugin-node
,eslint-plugin-promise
,eslint-plugin-react
,eslint-plugin-standard
fromdevDependencies
inpackage.json
.These are either covered by
@wordpress/eslint-plugin
or currently not used at all and thus ..eslintrc
toextend
onlyplugin:@wordpress/eslint-plugin/recommended
, andplugin:jest/recommended
..eslintrc
parser
option from.eslintrc
(already covered by@wordpress/eslint-plugin
).eslintignore
file to ignore vendor and build directories from linting and updatenpm run lint:js
to lint all JS files in plugin by only ignoring the ones added to.eslintignore
Changelog entry
The text was updated successfully, but these errors were encountered: