chore: migrate codebase ESLint config#385
Conversation
|
I'm getting a new error without updating any dependency now 🤔
And we are getting this error now too on CI. I don't know what's causing that, the CI was passing yesterday (I've checked the lint command locally without changing anything from yesterday and it fails too). @MichaelDeBoey any idea? Edit: I've just disabled |
This rule is causing an ESLint error which prevents the rest of the project to be linted.
| if (ASTUtils.isVariableDeclarator(node)) { | ||
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
| return context.getDeclaredVariables(node)[0]?.references?.slice(1) ?? []; | ||
| } | ||
|
|
||
| return []; |
There was a problem hiding this comment.
Maybe do an early return instead?
| if (ASTUtils.isVariableDeclarator(node)) { | |
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | |
| return context.getDeclaredVariables(node)[0]?.references?.slice(1) ?? []; | |
| } | |
| return []; | |
| if (!ASTUtils.isVariableDeclarator(node)) { | |
| return []; | |
| } | |
| // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | |
| return context.getDeclaredVariables(node)[0]?.references?.slice(1) ?? []; |
I normally don't like negative conditions, but I'm more in favor of having the "main" thing at the end
There was a problem hiding this comment.
That would fix it here but could potentially introduce errors in new code, so I've just switched off this rule until there is an option to ignore arrays within conditions.
There was a problem hiding this comment.
I didn't suggest it because of the disabling of ESLint, but because
I'm more in favor of having the "main" thing at the end
There was a problem hiding this comment.
Ah sorry, didn't realize that. I don't see any benefit in this case, I guess it's a matter of taste.
|
🎉 This PR is included in version 4.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #384
This PR: