8000 Parser does not support @babel/plugin-proposal-optional-chaining · Issue #136 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content

Parser does not support @babel/plugin-proposal-optional-chaining #136

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

Closed
krousseau-cs opened this issue Jan 24, 2019 · 4 comments
Closed
Labels
locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look

Comments

@krousseau-cs
Copy link

When using proposal-optional-chaining with babel, the typescript-eslint parser can not resolve the code. It throws the following error: "Parsing error: Expression expected"

err?.errors?.length

This parses correctly with babel-eslint parser.

More generally, is the plan to support all of the babel proposal plugins within typescript-eslint? Now that babel has first class support for typescript, using the 2 in conjunction will be a very common use case.

package version
@typescript-eslint/parser 1.1.0
TypeScript 3.2.4
ESLint 5.12.1
node 10.13.0
npm 6.5.0
@krousseau-cs krousseau-cs added package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look labels Jan 24, 2019
@armano2
Copy link
Collaborator
armano2 commented Jan 24, 2019

This is experimental feature, and its not supported by TypeScript. We are not extending capabilities of tsc.

@krousseau-cs
Copy link
Author

So basically there's still no way to use babel and typescript together and have it lint correctly? I can't use babel-eslint for a parser with typescript and typescript's parser is just not going to support proposals...

@JamesHenry
Copy link
Member

Until last year, the TypeScript compiler was the way that TypeScript source code was parsed.

Now there are two ways:

  • The TypeScript compiler
  • @babel/parser

This is a fork in the road when it comes to parsing.

  • typescript-eslint is a solution built on top of the TypeScript compiler "path"
  • babel-eslint is a solution built on top of the babel "path"

It is great that we have more than one solution - but it is not possible to mix and match the parsing option from one and linting option from another right now (nor is there anything planned).

Please note, the TypeScript compiler is still the only way to type check your code. Babel parses and strips the type information, you still need the TypeScript compiler running if you want type checking.

@fatfatson
Copy link

I like this feature too.
actually the code could be compiled ok( by adding babel plugin to webpack),
just couldn't pass lint,
what a pity.

@typescript-eslint typescript-eslint locked as resolved and limited conversation to collaborators Jun 26, 2019
@bradzacher bradzacher added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Apr 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: parser Issues related to @typescript-eslint/parser triage Waiting for team members to take a look
Projects
None yet
Development

No branches or pull requests

5 participants
0