-
Notifications
You must be signed in to change notification settings - Fork 87
Prettier #10
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
Conversation
mattgrill
commented
Mar 8, 2018
- prettier
- run prettier
"printWidth": 80, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "all" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love trailing comma all!
.eslintrc.json
Outdated
{ | ||
"extends": [ | ||
"eslint-config-airbnb", | ||
"plugin:prettier/recommended" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to compare what eslint-plugin-prettier does: https://github.com/prettier/eslint-plugin-prettier#recommended-configuration vs. what https://github.com/facebook/create-react-app/blob/next/packages/eslint-config-react-app/index.js does. Given we already try to go down the airbnb ruleset in core, I think using the same here makes sense.
package.json
Outdated
"react-scripts": "1.1.1" | ||
}, | ||
"scripts": { | ||
"prettier": "./node_modules/.bin/prettier --write 'src/**/*.jsx' 'src/**/*.js'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just use "prettier"? It'll pick up things in node_modules/.bin/prettier automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you can. I just always try and be specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from me. Following airbnb instead of the custom ruleset of CRA seems sensible (it'll also avoid conversations when we merge it into core)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When CRA is running the dev server it's running eslint automatically on re-compile - is it running this new configuration instead of default?
.eslintrc.json
Outdated
"rules": { | ||
"no-param-reassign": [0], | ||
"no-underscore-dangle": [0], | ||
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's ditch jsx completely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can, however there are some tests that are .js
but they contain JSX. I don't care either way which is why I added this.
@justafish I just looked into this, if you add an |
.eslintrc.json
Outdated
"root": true, | ||
"env": { | ||
"browser": true, | ||
"es6": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- jest, and serviceworker
Just the linting errors themselves that need fixing now 👍 |
So one thing I don't understand about adding |
Ok I read https://prettier.io/docs/en/eslint.html and I get it now 👍 |
Add helper scripts