-
Notifications
You must be signed in to change notification settings - Fork 492
Replace TSLint with eslint-config-react-app-ts #388
Conversation
I would like to carry on the mentality set out by CRA originally. As this package is currently recommended by them for Typescript support within CRA I would like to keep it this way. So easy to get started with, but if you want extra control then you'll have to eject. |
@nickmccurdy regarding the linting rules as a separate package, can we bundle it with |
Unfortunately no, the package name has to start with https://eslint.org/docs/developer-guide/shareable-configs We would need to publish a separate package to share the ESLint config. |
I'm experimenting with extracting the config into a separate package. I'd appreciate some dogfooding on existing projects to determine how well it works outside CRA-TS. |
How can I run this? I checked out the repo and the eslint branch, installed it, |
The app you just created will not use the linked version. If you now run |
I don't get how linking in the tslint app would help me create the eslint version. |
When you run These are the steps: # in checkout out repo
npm link
# in place you want to create new project
npm create react-app test-eslint-ts --scripts-version=react-scripts-ts
cd test-eslint-ts
npm link react-scripts-ts |
I understand the steps, but I don't understand how just linking to the new react-scripts-ts would help me if the app is already created and is the wrong (tslint) one. |
Create react app works by calling commands on a sub package's binaries. Usually |
I get and did all of that, but what is the point? There's still tslint.json and it still uses tslint; I can't even run the project if tslint.json is removed. |
It looks like it's still not using this linked branch. I just tried this:
Can you post your generated app, show your output of
This is not what's supposed to happen and not what happens for me. What is supposed to happen in development is that tslint.json is still generated (because you can't use a linked package when generating with create-react-app, but this wouldn't be an issue for end users) but is ignored, which is why I can delete it and still run scripts normally. |
Sorry, you're right, it works; not sure what the issue previously was. |
I'd really like to get this in - having just done a lot of work on #409 on brand new projects i can only imagine what a pain the current linting setup is for people new to dev/ts/react so would like to alleviate that ASAP. @nickmccurdy do you think we could get this in with #409. Obviously all the upstream changes include the code for eslint, so could get it in there? I am really stumped by the eslint extending naming convention, seems like an oversight for things like this package to export a config instead of publishing a new package. The only way I got it to work was by doing like |
Looks really good but I have concern about it. :\ @nickmccurdy Why we need to install another npm package? You can generate eslint config with your changes and it will work w/o extra dev deps.
|
eslint doesn't seem to be that well supported for TS; it's hard to find other examples of usage, most of them are incomplete, and I've seen no guides for it. The parser doesn't support the latest TS version. Rules like no-undef are broken. I also had to configure vscode-eslint to make this work. |
You can use typescript-eslint-parser, though it has some sharp edges |
typescript-eslint-parser is what I meant by "the parser"; it doesn't support TS 3.1. |
I'm closing this now that facebook/create-react-app#4837 is merged into CRA, which uses eslint-config-react-app instead of TSLint's defaults. I'll still try to support eslint-config-react-app-ts if you want to use it. |
@nickmccurdy just fyi eslint wasn't enabled on ts files on cra, see discussion |
Continuation of #354 with merge conflicts resolved.
Fixes #333.
Depends on eslint-config-react-app-ts.