-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(typescript-estree, eslint-plugin): stop adding ParenthesizedExpressions to node maps #226
fix(typescript-estree, eslint-plugin): stop adding ParenthesizedExpressions to node maps #226
Conversation
Codecov Report
@@ Coverage Diff @@
## master #226 +/- ##
==========================================
+ Coverage 96.78% 96.79% +<.01%
==========================================
Files 56 56
Lines 2522 2524 +2
Branches 372 373 +1
==========================================
+ Hits 2441 2443 +2
Misses 42 42
Partials 39 39
|
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.
this is way better solution than mine, good catch,
besides this small note LGTM
Codecov Report
@@ Coverage Diff @@
## master #226 +/- ##
==========================================
+ Coverage 96.78% 96.79% +<.01%
==========================================
Files 56 56
Lines 2522 2525 +3
Branches 372 374 +2
==========================================
+ Hits 2441 2444 +3
Misses 42 42
Partials 39 39
|
Failing from line ending issues in the fixture |
packages/eslint-plugin/lib/rules/no-unnecessary-type-assertion.js
Outdated
Show resolved
Hide resolved
…int#226) ### Disallow `/// <reference path="" />` comments but it's triggered on: - `/// <reference types="foo" />` - `/// <reference lib="es2017.string" />` - `/// <reference no-default-lib="true"/>` types/lib/no-default-lib can't be replaced by es6 imports
Builds off #212
The core issue for the crashes is that the TS AST has individual nodes for parenthesized expressions, but the ESTree AST does not.
Assuming a tree of the form
(E)
, whereE
is some expression, we would map the TS version ofE
to the ESTree version ofE
, but the ESTree version ofE
would map to the TS version of(E)
, thereby causing the missingtype
property in the repro.This PR makes it so we don't add TS nodes of type
ParenthesizedExpression
to the ES->TS map.I also moved some things around in the particular rule you were investigating; in particular, there's no good reason for us to use the TS node to get the text to check against the provided options, so I switched it to using the ESTree node.
fixes: #187