-
-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Default linter and/or linting configuration cannot parse various TypeScript features (e.g. modifiers like readonly) #6420
Comments
I just stumbled over another similar problem. The following valid TypeScript also causes the linter's parsing to fail:
Although this works fine:
|
eslint also trips over this: type Id<T> = {
[Prop in keyof T]: T[Prop];
}
It seems like the babel-eslint parser configured in the config doesn't handle TypeScript. Here's the config from the eslint-config-react-app package:
create-react-app/packages/eslint-config-react-app/index.js Lines 41 to 47 in 319cf9b
|
I have a similar (the same?) problem, see #6360. Tested with CRA 2.1.5 and current HEAD. |
ESLint is not currently running on |
Interesting! Here's our ESLint setup in webpack as of 2.1.8:
Not sure how it would be running on typescript files. May be worth trying our 3.0 alpha to see if it resolves your issue as it includes typescript ESLint support. |
Wow. That is weird. I was able to resolve the issues by defining my own eslint config with typescript parser and plugin. |
Is this a bug report?
Yes
Did you try recovering your dependencies?
The issue occurs on a freshly created application.
Which terms did you search for in User Guide?
Linting, Readonly, TypeScript
Environment
Steps to Reproduce
Generate an app with the typescript option:
Add TypeScript code with the
readonly
modifier, for example insrc/App.tsx
:Observe that eslint cannot parse the code, as indicated by the editor if integrated with eslint, or by running the following command:
Expected Behavior
The linter with its default configuration should be able to parse this interface.
Actual Behavior
The linter fails to parse the interface with the error:
Removing the readonly modified removes the parsing error.
Reproducible Demo
This repository demonstrates the issue with a simple commit.
Run the following command to reproduce:
The text was updated successfully, but these errors were encountered: