Skip to content
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 TypeScript linting support #6513

Merged
merged 4 commits into from Mar 15, 2019

Conversation

@ianschmitz
Copy link
Collaborator

commented Feb 24, 2019

Closes #5641.

This adds linting support for TypeScript via typescript-eslint. With this setup we are able to reuse the vast majority of our current ESLint rules.

TODO:

  • Finalize rules
  • Thoroughly test both js/ts scenarios as some ESLint rules don't play nice with typescript-eslint (eg. indent)
  • Test with VSCode ESLint plugin

image

@ianschmitz ianschmitz added this to the 3.0 milestone Feb 24, 2019

This was referenced Feb 25, 2019

@ianschmitz ianschmitz added this to In progress in v3 via automation Feb 25, 2019

@iansu iansu referenced this pull request Feb 25, 2019
@mrmckeb

This comment has been minimized.

Copy link
Collaborator

commented Feb 25, 2019

This looks great, @ianschmitz.

Do you think we should consider adding plugin:@typescript-eslint/recommended?, or do you think that'll be too opinionated? I know we generally stay away from enforcing too much.

I can see that you already took a little from that plugin. I've been playing with it and it does force you to define return types for every function, but otherwise seems fairly light.

@ianschmitz

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 25, 2019

I looked through the rules there and quite a few were stylistic which I know we've avoided in our ESLint config.

There's a few missing rules from TSLint like some of their promise rules that were really nice that I wish typescript-eslint had.

@iansu

This comment has been minimized.

Copy link
Collaborator

commented Feb 25, 2019

Now that TSLint is going to be deprecated it sounds like they will be bringing missing rules over to typescript-eslint.

@Ritzing

Ritzing approved these changes Mar 7, 2019

@ianschmitz ianschmitz marked this pull request as ready for review Mar 15, 2019

@iansu iansu merged commit eee8491 into facebook:master Mar 15, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
netlify/create-react-app/deploy-preview Docs deploy preview succeeded
Details

v3 automation moved this from In progress to Done Mar 15, 2019

@ianschmitz ianschmitz deleted the ianschmitz:eslint-typescript branch Mar 15, 2019

JoviDeCroock added a commit to JoviDeCroock/create-react-app that referenced this pull request Mar 15, 2019

Merge branch 'masterd' into feat/modern-build
* masterd: (24 commits)
  Add TypeScript linting support (facebook#6513)
  Support React Hooks (facebook#5602) (facebook#5997)
  Support browserslist in @babel/preset-env (facebook#6608)
  Add empty mock for http2 (facebook#5686)
  Add note about npx caching (facebook#6374)
  change named import into default import (facebook#6625)
  Stage files for commit after ejecting (facebook#5960)
  Upgrade dependencies (facebook#6614)
  Make compiler variable const instead of let (facebook#6621)
  Type check JSON files (facebook#6615)
  Change class components to functional components in templates (facebook#6451)
  Convert JSON.stringify \n to os.EOL when writing tsconfig.json (facebook#6610)
  Update html-webpack-plugin (facebook#6361)
  Enable click to go to error in console for TypeScript (facebook#6502)
  Update webpack-dev-server to 3.2.1 (facebook#6483)
  [docs] revert removal of newlines from html (facebook#6386)
  Publish
  Prepare 2.1.8 release
  Reapply "Speed up TypeScript v2 (facebook#6406)" (facebook#6586)
  Publish
  ...

# Conflicts:
#	packages/babel-preset-react-app/create.js
#	packages/react-scripts/scripts/build.js

@lock lock bot locked and limited conversation to collaborators Mar 20, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.