-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add TSLint rewire #14
Conversation
Fantastic! Thanks for the pull request. What do you think about removing eslint-loader if we're adding tslint? I'll look at this in more detail on Sunday. |
Good question. I haven't dug too deep into the existing logic in this package, but at a high level it seems like it would be awesome if we could just be a "layer" on top of CRA. i.e. we just add TS support (babel preset, tslint, ...?), but don't remove support for existing stuff such as This would also allow existing projects to slowly migrate their codebase to TS as they see fit. What do you think? |
I just tested this on a client's project I'm working on. This particular project has about 95 components. I didn't notice any slow down and the feedback is nice. I agree that we should proceed with not removing ESLint. I did get quite a bit of warnings for the following: Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information.
Warning: The 'no-boolean-literal-compare' rule requires type information. Do you know if there's a way to disable warning for rules needing type information on the loader's side? For reference, my {
"extends": [
"tslint:latest",
"tslint-eslint-rules",
"tslint-config-airbnb",
"tslint-config-prettier"
],
...
} |
I added an optional For example: I'd be curious to see if you notice a significant difference in performance when enabled. Ultimately i think it makes sense to allow the developer to opt-in understanding the potential performance issues that still exist. We could link documentation back to wbuchwalter/tslint-loader#76. Regarding your question about disabling warning, i think the only way is to disable the rules requiring type info, if you decide not to enable |
Thanks for the change, it seems to work. With type checking enabled, the startup time of the project is around 3-4 minutes but with no errors from tslint. With type checking disabled, startup time is about 15-20 seconds. Those few errors are scrolled up automatically so I don't think it's a big deal. |
I'm currently undecided on these two points:
I think including For the second point, if we can create a rule list that mimics what react-scripts does without pulling in any dependencies for rule sets I think this would be great. What are your thoughts on this? |
Both sound good to me. The only potential issue with us depending on It's a little tough to compare this to CRA, as they don't offer a way to customize the rules out of the box. |
For the
|
Hello, I went ahead and merged in the changes as they seem fine to me. I’ll be publishing a release as soon as I track down the issue with the latest release of react-scripts. The documentation will still need updating. I think we can leave it to the user to supply a tslint.json. We’ll explain the process in the documentation. |
@strothj @ianschmitz this is great. i've been using react-scripts-ts so far, but i will try this out and then add feedback on terms of sensible linting defaults. it would be great if we could simply have sane defaults the same way cra does. |
Closes #13.
This adds support for rewiring TSLint into CRA v2.
To do:
tslint-loader
, and the user is responsible for maintainingtslint
plus any other config packages they may want to bring in such astslint-react
tslint.json
if present. For example we could detect the presence of atslint.json
, and if not present provide some default rules that align with what CRA ships with for ESLinttslint-loader
in this configurationTSLint in action: