-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
5.0.0 - Crash with prefer-const rule where code contains array destructuring assignment with 'ignored values' #10520
Comments
👍 BTW changing eslint/lib/rules/prefer-const.js Line 173 in 196c102
.map(element => element ? element.name : null) fixes the crash but I'm not sure if there are any wider implications... |
Thanks @mjmasn, that makes sense. Would you like to create a PR (maybe with a new test that would trigger the crash)? |
Just out of curiosity, anyone know if this can be recreated in the 4.x release line? |
…10520) The crash is triggered by using array destructuring assignment with an array containing empty (ignored) elements due to attempting to read the name property of null.
…10520) The crash is triggered by using array destructuring assignment with an array containing empty (ignored) elements due to attempting to read the name property of null.
@platinumazure I don't think so, the code was introduced in 240c1a4 (first released in 5.0.0-alpha.4) |
should we release a patch |
Summary: This fixes an issue with the null-coalescing operator (??). Unfortunately there's an issue with the array destructure syntax when you omit variables: e.g. `[,a,b] = [1,2,3]`. But we've only used that once so far so it's not a big deal (and it should be merged soon.) eslint/eslint#10520 Reviewed By: aaronabramov Differential Revision: D8673675 fbshipit-source-id: ce3954c24568d398b421db446fda77145c8adfcb
Summary: Upgrades eslint to v5.0.1 Updated `eslint-plugin-eslint-comments`, which was necessary for eslint 5 Disabled the `prefer-const` rule while we wait for eslint/eslint#10520 to be fixed/published. Reviewed By: zertosh Differential Revision: D8692838 fbshipit-source-id: fa0cae3e299af2350c8c30ceb94d70740ee84eab
Summary: @public Upgrades eslint to v5.0.1 Updated `eslint-plugin-eslint-comments`, which was necessary for eslint 5 Disabled the `prefer-const` rule while we wait for eslint/eslint#10520 to be fixed/published. Reviewed By: zertosh Differential Revision: D8692838 fbshipit-source-id: fa0cae3e299af2350c8c30ceb94d70740ee84eab
Summary: Upgrades eslint to v5.0.1 Updated `eslint-plugin-eslint-comments`, which was necessary for eslint 5 Disabled the `prefer-const` rule while we wait for eslint/eslint#10520 to be fixed/published. Reviewed By: zertosh Differential Revision: D8692838 fbshipit-source-id: fa0cae3e299af2350c8c30ceb94d70740ee84eab
…#10527) * Chore: Add more tests for prefer-const rule Adds coverage for the case where the code contains array-destructuring assignment with 'ignored values'. * Fix: prefer-const rule crashing on array destructuring (fixes #10520) The crash is triggered by using array destructuring assignment with an array containing empty (ignored) elements due to attempting to read the name property of null. * Chore: Add more invalid test cases for prefer-const
Summary: This fixes an issue with the null-coalescing operator (??). Unfortunately there's an issue with the array destructure syntax when you omit variables: e.g. `[,a,b] = [1,2,3]`. But we've only used that once so far so it's not a big deal (and it should be merged soon.) eslint/eslint#10520 Reviewed By: aaronabramov Differential Revision: D8673675 fbshipit-source-id: ce3954c24568d398b421db446fda77145c8adfcb
This is a minimal reproduction for a bug I've found in
eslint@5.0.0
. As far as I can tell the example code below is valid JavaScript (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#Ignoring_some_returned_values).Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
What did you expect to happen?
eslint would lint my project
What actually happened? Please include the actual, raw output from ESLint.
eslint did not lint my project and threw a TypeError from one of its built-in rules (
prefer-const
)The text was updated successfully, but these errors were encountered: