New Typescript linting overriding user config and causing build failure
See original GitHub issueThe introduction of #6513 stops my application from compiling as it uses it’s own Typescript linting rules instead of the rules I have in .eslintrc.js
Previous to CRA adding Typescript linting I created my own typescript lint config for eslint using @typescript-eslint/eslint-plugin
and @typescript-eslint/parser
along with airbnb and prettier rules.
Within the project there is typescript file generated by graphql-code-generator
that breaks various linting rules, so has been added to a .eslintignore
file. When I run eslint the project passes with no errors.
However, when I build the project or run it in dev mode 2 lint errors are raised, relating to the fact that import statements appear half way through the file. Using the .eslintignore file doesn’t fix this problem, nor does updating my .eslintrc.js file to exclude the rule.
As a result I cannot build my project with CRA 3 and have had to revert to 2.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:49
- Comments:63 (11 by maintainers)
Top GitHub Comments
Our ESLint configuration is not currently configurable (as has always been the case) and is documented here: https://facebook.github.io/create-react-app/docs/setting-up-your-editor#displaying-lint-output-in-the-editor. Any changes you make to your configuration file will only affect your editor integration but not the Dev server or prod builds.
We haven’t ever supported TSLint so I’m not sure how the other comments are related.
@ianschmitz I think the confusion was that Typescript folks where using TSLint since the react-scripts had no TS linting support. We have entire projects built using custom rules, but now since TS linting is supported in v3, we are all stuck with pages of warnings and/or broken builds. While the JS community had somewhat the ease of greenfield development using react-scripts’ blessed linting rules, the TS community is now coming onboard with custom opinionated rulesets for large existing projects.
Proposals:
On a community aside, I didn’t realize the react-scripts didn’t allow JS projects to customize the linting rules. As someone that disagrees with the defaults of most linters (as well as my team), it feels very heavy-handed to including linting by-default without a way to customize. (obviously there’s ejection, but it’s far from an easy path to own)