Skip to content
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): correct issues in AST definition #3083

Merged
merged 6 commits into from Feb 22, 2021

Conversation

armano2
Copy link
Member

@armano2 armano2 commented Feb 21, 2021

Those changes has been extracted from #3078

fixes #2912

ProgramStatement and Statement nodes can contain same set of nodes

if (x) export {x}
if (x) import test from 'x'
// -----
for (x in foo) {
  export {x}
}
// -----
function test (x: string) {
  export {x}
}

LeftHandSideExpression can be a AwaitExpression

const a = ++(await x)

TryStatement finalizer can be null

try {} catch {}

RegExpLiteral value can be null if regexp is invalid or unsupported by env

good example in this case can be any proposal that has not been accepted yet
eg. https://github.com/tc39/proposal-regexp-match-indices

const x = /a+(?<Z>z)?/d

JSXOpeningElement attributes can be a JSXSpreadAttribute

const foo = <x {...spread}></x>

TSModuleDeclaration body can be TSModuleDeclaration

// TSModuleDeclaration without body
module "x";
// TSModuleDeclaration -> TSModuleBlock
module x {
}
// TSModuleDeclaration -> TSModuleDeclaration **
module x.x {
}

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @armano2!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@armano2 armano2 added AST PRs and Issues about the AST structure bug Something isn't working labels Feb 21, 2021
@codecov
Copy link

codecov bot commented Feb 21, 2021

Codecov Report

Merging #3083 (ac64fe0) into master (409bf0b) will increase coverage by 0.00%.
The diff coverage is 90.90%.

@@           Coverage Diff           @@
##           master    #3083   +/-   ##
=======================================
  Coverage   92.83%   92.83%           
=======================================
  Files         314      314           
  Lines       10671    10672    +1     
  Branches     3027     3027           
=======================================
+ Hits         9906     9907    +1     
  Misses        348      348           
  Partials      417      417           
Flag Coverage Δ
unittest 92.83% <90.90%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/eslint-plugin/src/rules/no-unused-vars.ts 96.68% <80.00%> (+0.02%) ⬆️
packages/typescript-estree/src/convert.ts 98.36% <100.00%> (ø)

}

export interface TSModuleDeclaration extends BaseNode {
type: AST_NODE_TYPES.TSModuleDeclaration;
id: Identifier | Literal;
body?: TSModuleBlock;
body?: TSModuleBlock | TSModuleDeclaration;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we really need to fix this - #2573

@armano2 armano2 changed the title fix: correct issues in AST definition fix(typescript-estree): correct issues in AST definition Feb 21, 2021
This was referenced Mar 15, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AST PRs and Issues about the AST structure bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incorrect type - TryStatement's finalizer property can't be null
2 participants