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
Add prefer-optional-catch-binding
rule
#671
Add prefer-optional-catch-binding
rule
#671
Conversation
@sindresorhus This is ready, have to land in v20 now :( |
Sorry, I misunderstood. I thought you intended to fix https://github.com/sindresorhus/eslint-plugin-unicorn/pull/671/files#diff-52502d7490c2a15f41e0def7598c29a4R109 in this PR and I was waiting for that. |
Right. I forgot that, now we have time, I'll try to fix it. |
try {
} catch(error) {
var error = 1;
} This one seems hard to fix, the core rule try {
} catch(error) {
const error = 1;
}
// VM170:3 Uncaught SyntaxError: Identifier 'error' has already been declared OR try {
} catch(error) {
function error(){}
}
// VM191:3 Uncaught SyntaxError: Identifier 'error' has already been declared I'm going to give up. If people really want that, we can improve later. |
Just leave it. I really don't care about In general, just ignore any legacy syntax. We should not waste time on that. |
I alway try to to better, if it's not hard . :) |
Integration test failure due to https://github.com/then/is-promise/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc , they publish a |
Are we good to merge? |
Fixes #670
Note: I'm not check destructuring, so the following code will pass
This can get really complicated,
Case 1:
In this case
nonExistsProperty
is not used, removingthisWillExecute()
is not safe.Case 2:
I'm not sure we can track both
a
andb
.Note2: white spaces not removed.