-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: switch to our fork acorn typescript plugin #15393
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c1204dc
fix: switch to our fork acorn typescript plugin
dummdidumm 7b06375
changeset
dummdidumm eeb3c32
bump
dummdidumm 2c62472
bump
dummdidumm 934d1a6
bump
dummdidumm 07e421a
adjust snapshots
dummdidumm 636b9cc
this should be obsolete now
dummdidumm 16431b7
bump
dummdidumm b1877db
bump
dummdidumm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| 'svelte': patch | ||
| --- | ||
|
|
||
| chore: switch acorn-typescript plugin |
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -75,7 +75,7 @@ | |
| "id": { | ||
| "type": "Identifier", | ||
| "start": 52, | ||
| "end": 57, | ||
| "end": 65, | ||
| "loc": { | ||
| "start": { | ||
| "line": 3, | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
| { | ||
| "type": "Identifier", | ||
| "start": 43, | ||
| "end": 46, | ||
| "end": 54, | ||
| "loc": { | ||
| "start": { | ||
| "line": 3, | ||
|
|
||
This file contains hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
notably, the identifier
endposition is now including the type annotation, not just the name itself.Judging from the tests that's not a problem but I wanted to make sure to point this out in case someone thinks this could have bad consequences
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.
It's not just identifiers, it's any
Patternnode. Turns out@typescript-eslint/parserdoes the same thing, though TypeScript keeps the node and the annotation separateSo it looks like there's no universally agreed-upon convention here. I don't see any real downside to doing it this way, so if it's hard to keep things as they were for whatever reason then I think this change is probably fine
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.
You're right, any
Pattern, and yes@typescript-eslint/parseralso does it that way (and in fact that one specced the TSEStree which the acorn plugin follows).The only downside could be someone relying on this somewhere else, but since they switch the library, and since it was broken in many places before, too (which is why we needed that fix-walk) so it should be fine in practise.
I also checked language-tools, and turns out we already had to do "use type annotation start instead of node end because we only want the JS part" in a couple of places already, so no breakage there, either.
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 tend to keep it like it's now to adhere to the inofficial estree spec - this is good to merge if you agree