-
Notifications
You must be signed in to change notification settings - Fork 301
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, apply lint fixes, add lint github action #2667
Conversation
Running the lint script with $ npm run lint
> opendota-core@21.0.2 lint
> eslint . --ext .js,.jsx --ignore-path .gitignore
/root/dev/ff137/core/dev/cassandraRandom.js
13:74 error Parsing error: Unexpected token .
/root/dev/ff137/core/dev/cassandraTest.js
11:58 error Unary operator '++' used no-plusplus
13:22 error Unexpected `await` inside a loop no-await-in-loop
/root/dev/ff137/core/index.js
15:5 error Strings must use doublequote quotes
...
✖ 45 problems (45 errors, 0 warnings)
9 errors and 0 warnings potentially fixable with the `--fix` option. |
Quite a few of those errors (such as "parserOptions": {
"ecmaVersion": 2023
}, Now there are 181 problems ... 104 of which are automatically fixable. Edit: 2021 seems to be version that supports node16 fully - later version only somewhat. But 2021 reports same number of errors |
According to node.green, ES2021 has 100% support for node16, but ES2022 doesn't
…rrently with `Promise.all()`
…rrently with `Promise.all()`
…rrently with `Promise.all()`
Ok, with the help of Cursor (VS Code with ChatGPT), I was able to fix most of the linting errors that remained. Some nice improvements include replacing await in a loop with executing all promises concurrently. The other changes are fairly trivial. There's a few cases where I couldn't figure out how to replace the await in a loop. |
So, my renaming of variables (from snake_case to camelCase) broke something in keyManagement/tests, so rolling back those changes I notice that test are actually quite sparse in this repo (no tests for routes), so with this refactoring it may be worthwhile if I include some more tests to make sure I didn't break anything else with the linting changes. I guess I can only get around to that soonTM, so I'll leave PR as draft for time being |
I'm going to revisit eslint later--I think typescript helps us catch most of the important kinds of errors |
Upgraded eslint + config + prettier dependencies with the following:
Fixed linting errors where possible and added ignores otherwise
Added lint job to github actions