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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build(deps): Bump @typescript-eslint/typescript-estree from 3.10.1 to 4.0.1 #9119
Build(deps): Bump @typescript-eslint/typescript-estree from 3.10.1 to 4.0.1 #9119
Conversation
Bumps [@typescript-eslint/typescript-estree](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-estree) from 3.10.1 to 4.0.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/typescript-estree/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.0.1/packages/typescript-estree) Signed-off-by: dependabot[bot] <support@github.com>
Size Change: +48 kB (0%) Total Size: 9.13 MB
鈩癸笍 View Unchanged
|
@sosukesuzuki You want work on this? You may want use this logic https://github.com/prettier/prettier/pull/9000/files#diff-2adb5e4d6193c992403ff12002873a90R141 |
transformation of ChainExpression seems to work fine. However, our tests fail because typescript-eslint 4.0 removes decorators from the node that TS doesn't support decorators. https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0
|
If we merge this as is, #4552 will reoccur. |
} else if (node.type === "TSNonNullExpression") { | ||
node.expression = transformChainExpression(node.expression); | ||
} |
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'm not familiar with typescript, but is it possible to have other types inside ChainExpression
?
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'm wondering is this a mistake in parser? ChainExpression
should be the root of optional chaining
.
Shouldn't it be TSNonNullExpression > ChainExpression
?
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.
What should this c?.d!
be? The estree says
The
ChainExpression
node contains one or moreChainElement
nodes that areoptional:true
.
https://github.com/estree/estree/blob/master/es2020.md#chainexpression
But in this case TSNonNullExpression
is not ChainElement
.
I'm not familiar with typescript, is this c?.d!
mean d
is non-null, and (c?.d)!
mean c.d
is non-null?
If it's correct, shouldn't TSNonNullExpression
be the MemberExpression.property
?
Update: as I see on prettier playground, (a?.b!).c
(a?.b)!.c
are the same, so I think the AST should be TSNonNullExpression > ChainExpression
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 mirrored babel's (v7.11.3) implementation here.
This is the same AST they produce. typescript-eslint/typescript-eslint#2380
input code:
(a?.b!).c;
(a?.b)!.c;
`@babel/parser` @ `7.11.3`
{
"type": "Program",
"start": 0,
"end": 21,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 10
}
},
"expression": {
"type": "MemberExpression",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"object": {
"type": "ChainExpression",
"start": 1,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 6
}
},
"expression": {
"type": "TSNonNullExpression",
"start": 1,
"end": 6,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 6
}
},
"expression": {
"type": "MemberExpression",
"start": 1,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 5
}
},
"object": {
"type": "Identifier",
"start": 1,
"end": 2,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 2
},
"identifierName": "a"
},
"name": "a"
},
"computed": false,
"property": {
"type": "Identifier",
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
},
"identifierName": "b"
},
"name": "b"
},
"optional": true
}
},
"extra": {
"parenthesized": true,
"parenStart": 0
}
},
"computed": false,
"property": {
"type": "Identifier",
"start": 8,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 9
},
"identifierName": "c"
},
"name": "c"
},
"optional": false
}
},
{
"type": "ExpressionStatement",
"start": 11,
"end": 21,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 10
}
},
"expression": {
"type": "MemberExpression",
"start": 11,
"end": 20,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 9
}
},
"object": {
"type": "TSNonNullExpression",
"start": 11,
"end": 18,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 7
}
},
"expression": {
"type": "ChainExpression",
"start": 12,
"end": 16,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 5
}
},
"expression": {
"type": "MemberExpression",
"start": 12,
"end": 16,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 5
}
},
"object": {
"type": "Identifier",
"start": 12,
"end": 13,
"loc": {
"start": {
"line": 2,
"column": 1
},
"end": {
"line": 2,
"column": 2
},
"identifierName": "a"
},
"name": "a"
},
"computed": false,
"property": {
"type": "Identifier",
"start": 15,
"end": 16,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 5
},
"identifierName": "b"
},
"name": "b"
},
"optional": true
},
"extra": {
"parenthesized": true,
"parenStart": 11
}
}
},
"computed": false,
"property": {
"type": "Identifier",
"start": 19,
"end": 20,
"loc": {
"start": {
"line": 2,
"column": 8
},
"end": {
"line": 2,
"column": 9
},
"identifierName": "c"
},
"name": "c"
},
"optional": false
}
}
]
}
`@typescript-eslint/typescript-estree` @ `4.0.1`
{
"type": "Program",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "MemberExpression",
"object": {
"type": "ChainExpression",
"expression": {
"type": "TSNonNullExpression",
"expression": {
"type": "MemberExpression",
"object": {
"type": "Identifier",
"name": "a",
"range": [
1,
2
]
},
"property": {
"type": "Identifier",
"name": "b",
"range": [
4,
5
]
},
"computed": false,
"optional": true,
"range": [
1,
5
]
},
"range": [
1,
6
]
},
"range": [
1,
6
]
},
"property": {
"type": "Identifier",
"name": "c",
"range": [
8,
9
]
},
"computed": false,
"optional": false,
"range": [
0,
9
]
},
"range": [
0,
10
]
},
{
"type": "ExpressionStatement",
"expression": {
"type": "MemberExpression",
"object": {
"type": "TSNonNullExpression",
"expression": {
"type": "ChainExpression",
"expression": {
"type": "MemberExpression",
"object": {
"type": "Identifier",
"name": "a",
"range": [
12,
13
]
},
"property": {
"type": "Identifier",
"name": "b",
"range": [
15,
16
]
},
"computed": false,
"optional": true,
"range": [
12,
16
]
},
"range": [
12,
16
]
},
"range": [
11,
18
]
},
"property": {
"type": "Identifier",
"name": "c",
"range": [
19,
20
]
},
"computed": false,
"optional": false,
"range": [
11,
20
]
},
"range": [
11,
21
]
}
],
"sourceType": "script",
"range": [
0,
21
]
}
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.
Thank you for the information, I'll take a deep look
Hmm, when I wrote typescript-eslint/typescript-eslint#2375 I didn't know that this would cause problems for you guys. I'm not sure what the best solution is here for this. Babel parser hard errors for this, but we don't - we don't error for any invalid code right now. I definitely want to, maybe in the next major? typescript-eslint/typescript-eslint#1852 |
A newer version of @typescript-eslint/typescript-estree exists, but since this PR has been edited by someone other than Dependabot I haven't updated it. You'll get a PR for the updated version as normal once this PR is merged. |
What do we do about this? |
The parser services is an option if you want to do it properly and support it / error on it. I wonder if it's okay just ignoring this case? It seems weird to have handling for a completely invalid state? |
This PR is old so close for now. I'll reopen as an other PR. |
OK, I won't notify you again about this release, but will get in touch when a new version is available. If you change your mind, just re-open this PR and I'll resolve any conflicts on it. |
Bumps @typescript-eslint/typescript-estree from 3.10.1 to 4.0.1.
Release notes
Sourced from @typescript-eslint/typescript-estree's releases.
Changelog
Sourced from @typescript-eslint/typescript-estree's changelog.
Commits
46ad4d0
chore: publish v4.0.1c51e3f0
chore: publish v4.0.0c3a6c2a
chore: add downlevel-dts to all packages with type declarationsac0defc
chore: update dependencies3a7ec9b
feat(typescript-estree): switch to globby (#2418)762bc99
fix(typescript-estree): correct ChainExpression interaction with parentheses ...d738fa4
fix: correct decorator traversal for AssignmentPattern (#2375)e9d2ab6
feat: support ESTree optional chaining representation (#2308)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)