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

feat: TypeScript 4.2 syntax support #3112

Merged
merged 10 commits into from Mar 1, 2021
Merged

feat: TypeScript 4.2 syntax support #3112

merged 10 commits into from Mar 1, 2021

Conversation

armano2
Copy link
Member

@armano2 armano2 commented Feb 25, 2021

Ast structure addition:

  • JSXNamespacedName will now be generated when jsx namespace is used in jsx attribute or tag name
    <foo:bar />;
    <div foo:bar="1" />;
    JSXNamespacedName <: Node {
      type: "JSXNamespacedName"
      namespace: JSXIdentifier
      name: JSXIdentifier
    }
  • TSConstructorType will now support abstract construct signatures
    TSConstructorType <: Node {
      abstract: boolean
    }
    let Ctor: abstract new () => HasArea = Shape;

TODO:

fixes #2935

@armano2 armano2 added dependencies Issue about dependencies of the package AST PRs and Issues about the AST structure labels Feb 25, 2021
@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.

@@ -374,6 +374,7 @@ export type Expression =
| SequenceExpression
| SpreadElement
| TSAsExpression
| TSTypeAssertion
Copy link
Member Author

Choose a reason for hiding this comment

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

this change is unrelated to upgrade of typescript

@alitaheri
Copy link

alitaheri commented Feb 25, 2021

Will this change also support this syntax?

export type Type<T extends number> = `my-id-${T}`;
// Getting error:                    ^ Parsing error: Type expected.

@bradzacher
Copy link
Member

Template string types are already supported as part of our TS 4.1 support.

If you're having issues, ensure you update your versions.

@codecov
Copy link

codecov bot commented Feb 25, 2021

Codecov Report

Merging #3112 (c843ee3) into master (cf86f42) will increase coverage by 0.00%.
The diff coverage is 95.45%.

@@           Coverage Diff           @@
##           master    #3112   +/-   ##
=======================================
  Coverage   92.90%   92.90%           
=======================================
  Files         315      315           
  Lines       10709    10699   -10     
  Branches     3039     3022   -17     
=======================================
- Hits         9949     9940    -9     
+ Misses        344      342    -2     
- Partials      416      417    +1     
Flag Coverage Δ
unittest 92.90% <95.45%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...pt-estree/src/ts-estree/estree-to-ts-node-types.ts 100.00% <ø> (ø)
packages/typescript-estree/src/convert.ts 98.24% <95.45%> (-0.13%) ⬇️
packages/scope-manager/src/analyze.ts 65.38% <0.00%> (-5.59%) ⬇️
...ges/scope-manager/src/referencer/PatternVisitor.ts 68.29% <0.00%> (-0.76%) ⬇️
...es/eslint-plugin/src/rules/no-invalid-void-type.ts 95.23% <0.00%> (-0.12%) ⬇️
...nt-plugin/src/rules/no-unused-vars-experimental.ts 91.39% <0.00%> (-0.10%) ⬇️
...eslint-plugin/src/rules/consistent-type-imports.ts 93.58% <0.00%> (-0.06%) ⬇️
...ackages/eslint-plugin/src/rules/member-ordering.ts 98.41% <0.00%> (-0.05%) ⬇️
...kages/scope-manager/src/referencer/ClassVisitor.ts 91.96% <0.00%> (+0.07%) ⬆️
.../experimental-utils/src/eslint-utils/RuleTester.ts 9.30% <0.00%> (+0.21%) ⬆️
... and 1 more

@armano2
Copy link
Member Author

armano2 commented Feb 25, 2021

update: JSXNamespacedName is now supported

@armano2 armano2 marked this pull request as ready for review February 25, 2021 18:47
@bradzacher bradzacher changed the title TypeScript 4.2 Syntax Support feat: TypeScript 4.2 syntax support Feb 28, 2021
bradzacher
bradzacher previously approved these changes Feb 28, 2021
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

thanks!

Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

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

needs to be updated with master

@bradzacher bradzacher added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Feb 28, 2021
Conflicts:
	packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap
	packages/typescript-estree/tests/snapshots/jsx/invalid-mismatched-namespace-tag.src.js.shot
	packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot
	packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot
	packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot
This was referenced Mar 16, 2021
@DerZyklop
Copy link

@alitaheri is your issue solved?

@armano2
Copy link
Member Author

armano2 commented Mar 17, 2021

@DerZyklop yes version has been updated in patch release 4.16.1

@alitaheri
Copy link

@DerZyklop yes, tested it just now. no more errors 👍🏼

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready AST PRs and Issues about the AST structure dependencies Issue about dependencies of the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript 4.2 Syntax Support
5 participants