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 missing parentheses to let
#14000
Merged
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8255f75
Add test
fisker 93cc3b3
Fix
fisker 2eeacba
More test
fisker aa4f3ac
More test
fisker 7e053d4
Fix comment
fisker 0b14faa
Rename file
fisker df3d0fe
Add changelog
fisker dff50c4
More tests
fisker 374746b
Update changelog
fisker 51a5308
Mark unstable
fisker 6e7ba19
more tests
fisker 1fb2914
More test
fisker e2d377a
Update acorn & espree
fisker 74d873c
Fix lock
fisker b5bba84
Tweak startsWithNoLookaheadToken
thorn0 b5475e7
Fix for loops
thorn0 a875550
Fix for loops 2
thorn0 3e80b1a
Improve comment
thorn0 ef08c06
More test
fisker File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#### Fix missing parentheses when assigning to property of variable named `let` (#14000 by @fisker) | ||
|
||
<!-- prettier-ignore --> | ||
```jsx | ||
// Input | ||
(let[0] = 2); | ||
|
||
// Prettier stable | ||
let[0] = 2; | ||
|
||
// Prettier stable (second format) | ||
SyntaxError: Unexpected token (1:5) | ||
> 1 | let[0] = 2; | ||
| ^ | ||
2 | | ||
|
||
// Prettier main | ||
(let)[0] = 2; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should detect assignment expressions. The syntax is
So you should be looking at any expression statement that starts with
let [
, which I hope theif
condition above sufficiently covers. Some more test cases:playground
IMO, both should have no change, but at least the first one needs fix.