-
Notifications
You must be signed in to change notification settings - Fork 775
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
Additional lint rules to consider #1935
Comments
Cool, thanks for the submission! Just to clarify: is there anything here which would have (in whatever twists) some "breaking" implications? (otherwise we could take this rather a bit slower in doubt, lot's of other stuff to do/finish) |
nothing breaking, also nothing super urgent, just some suggestions to improve code quality/style, can be done over time 👍 |
+1 for strict-boolean-expressions, would have caught an issue that I just spent quite a bit of time troubleshooting :) |
Here's some of my preferred config, hardhat's eslintrc rules are a great resource. "@typescript-eslint/consistent-type-imports": "error",
"import/order": [
"error",
{
alphabetize: {
order: "asc",
},
groups: [
"object",
["builtin", "external"],
"parent",
"sibling",
"index",
"type",
],
"newlines-between": "always",
},
],
"sort-imports": ["error", { ignoreDeclarationSort: true }],
'@typescript-eslint/strict-boolean-expressions': [
'error',
{
allowString: false,
allowNumber: false,
allowNullableObject: false,
allowAny: false,
},
], |
another good one: |
@ryanio updated your post with links to PRs that enable some of the rules |
Enabling the |
So guess then we would want to get rid again of the For |
What I mean by mistake is that generally This sindresorhus/meta#7 is a good read and lists quite a few reasons why you should ditch ❯ node
Welcome to Node.js v16.16.0.
Type ".help" for more information.
> typeof null
'object'
> typeof undefined
'undefined' |
@ryanio I tried to enable require-await but it has tons of false positives like the below code where async numberToHash(blockNumber: bigint): Promise<Buffer> {
if (blockNumber < BigInt(0)) {
throw new NotFoundError(blockNumber)
}
return this.get(DBTarget.NumberToHash, { blockNumber })
} What do you want to do with that rule? Leave it for now or enable it and disable the false-positives with |
@holgerd77 no-sparse-arrays doesn't result in any changes yet and I remember you said we should only add rules that result in an actual change. Does that still stand? |
|
If we don't inflate I guess there is nothing to be said to add selected and reasoned additional ones, so I would be ok with that. |
|
@holgerd77 I think we can close this. I enabled all requested rules and extracted the bigger ones into separate issues I'll tackle. |
Is there any value to keep this open at this point? We've addressed basically all of the open rules. |
I think we should close this one, but nevertheless review (new) ESLint rules anyways. (We can discuss on the call) |
Ok, would agree to both of you, will close. |
After working in the monorepo extensively, I compiled some ESLint rules that should help improve dev ex, code quality and style.
These are nothing urgent or breaking and can be picked up over time. (These rules should be added to the top-level
config/eslint.js
to automatically be included in all packages.)require-await
rule foreslint
#2156 due to its sizeeslint-plugin-simple-import-sort
andeslint-plugin-import
#2086object-shorthand
rule foreslint
#2131github/array-foreach
rule foreslint
#2130eslint:recommended
The text was updated successfully, but these errors were encountered: