-
Notifications
You must be signed in to change notification settings - Fork 638
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
Switch from JSHint to ESLint #1360
Conversation
When I run
You can also see it in the CI builds. This is because we use Lines 154 to 163 in 2a09c95
Before we did run
Also we now have two options to fix formatting errors:
Do we need both? This will be the output when there are linting errors:
|
@campersau thanks for the detailed review.
I had removed the linting from the build step to speed up build time and to not stop the build when there are formatting issues. We could consider adding the linting as pre-commit hook or adding it to the build in a non-blocking way (i.e. only issue warnings). |
"puppeteer": "~3.0.4", | ||
"superagent": "~5.2.2", | ||
"supertest": "~4.0.2" | ||
}, | ||
"engines": { | ||
"node": ">=10.18" | ||
"node": "^10.18.0 || >=11.14.0" |
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.
Something I forgot to ask: why is this needed?
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.
fs.promises
was first added in 11.14.0
and later backported to 10.17.0
.
We are fine to use it if we support latest Node 10 and latest Node 11.
>= 10.18
would technically include 11.0.0
which does not support fs.promises
yet.
^10.18.0 || >=11.14.0
means any version of node 10 starting with 10.8.0
or any version after 11.14.0
.
Remove JSHint
Add ESLint
Configure linting rules specific to folder using
.eslintrc.json
filesclicktest
: mochacomponents
: browserpublic/source
: browsersource
: nodetest
: mochaUsing files in the folders allows editor plugins to get the correct config when a file is opened
Use ESLint to also check formatting
With the prettier plugin, we can check for linting issues and formatting with one command
npm run lint
scriptFix reported errors
Use recommended configuration (of ESLint and the plugins) with the following exceptions
no-unused-vars
: Allow unused parameter as that seems to be current code styleno-process-exit
: Currently used intentionallyno-control-regex
: We have to use control characters as they appear in messages from gitno-prototype-builtins
: Only one occurrence that we can refactor latermocha/no-mocha-arrows
: Mocha discourages the use of arrow functions, which are used in the code basemocha/no-setup-in-describe
: Can be moved tobeforeAll
blocks latermocha/no-identical-title
: Consider whether current naming is optimalThe current configuration is aimed at providing the most value without requiring big refactorings for now. Future rules to consider might be:
no-var
: Requireconst
orlet