Skip to content

chore (ESLint): Add eslint + typescript + prettier support #31

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

Merged
merged 3 commits into from
Mar 12, 2020

Conversation

jamesopti
Copy link
Contributor

@jamesopti jamesopti commented Mar 11, 2020

Summary

Setup ESLint w/Typescript & React support

Autolint 2 files just to make sure it works.

Once the core code is approved, I'll autolint the entire repo in another PR.

Approach

I used the Prettier.io recommended setup with ESLint as well as this guide to help integrate Typescript.

The .prettierrc file was copied directly over from the javascript-sdk.

A few rules (3) were turned off so that after this PR, eslint --fix leaves us with no errors.

We can discuss after that if we want to turn those rules back on.

.eslintrc.js Outdated
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2017,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so from the TypeScript side, the syntax we are allowed to use is a function of both the TypeScript version we use, and the compiler options (like lib, which is currently set at es2015). How do these play together? Are we forced to specify ecmaVersion here?

I am wondering if we would be better off just introducing Prettier for formatting, and leaving static checks to TypeScript for the time being. I wonder how much overlap there is between correctness checks in ESLint and the TS compiler's responsibility.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, there shouldn't be any interference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im going to set the ecmaVersion here to 2015 to match the current tsconfig lib, as you noted here!

@jamesopti jamesopti merged commit b60b015 into master Mar 12, 2020
@jamesopti jamesopti deleted the james/prettier branch March 12, 2020 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants