Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upUnexpected newline between object and [ of property access #1135
Comments
feross
added
the
question
label
May 16, 2018
This comment has been minimized.
This comment has been minimized.
|
You need to use a leading semicolon before the array destructuring: export class c {
f (a) {
let [b, c] = a
;[this.d, this.e] = b
return [c]
}
}We should show a warning about this case. This looks like an ESLint bug to me. (Leaving this issue open as a reminder to report this to the ESLint team.) |
feross
added
the
accepted
label
May 16, 2018
This comment has been minimized.
This comment has been minimized.
TheRauven
commented
Nov 18, 2018
|
It's been 6 months, and still nothing has been done to improve the error readability of Destructuring Assignments. I was confused by ESLint not recognizing it, until I finally found this thread |
feross
changed the title
Destructuring assignment to class members
Unexpected newline between object and [ of property access
Aug 13, 2019
This comment has been minimized.
This comment has been minimized.
|
@TheRauven Glad you figured out your issue. |
This comment has been minimized.
This comment has been minimized.
|
Upon reconsideration, I actually think this error message is actually fine. ESLint sees the code as a property access and since we're omitting semis we know we need to add a leading semi. If anyone disagrees, feel free to file an upstream ESLint issue to attempt to make this clearer. |
HoffmannP commentedMay 16, 2018
What version of standard?
8.6.0
What operating system, Node.js, and npm version?
What did you do?
lint the following code
What did you expect to happen?
No error
What actually happened?