I need to compare how eslint configuration in create-react-app is different with airbnb one.
To play with airbnb's eslint, I combine this great tutorial from @rwieruch and his minimum react setup repo.
With create-react-app's eslint, it's straightfoward, just create app with that tool then your app has eslint preconfig.
- airbnb's eslint is more opinionated than creat-react-app's one.
- Airbnb's will be good for team which need enforce code style and code conventions and find out that it closes to what they need.
- Creat-react-app is less opinionated so it's easier for new developer.
I have some custom rules on top of airbnb one:
- Enable jsx in js file.
- No comma at the end of file. I used to add
;
until I dicover the code style without it from http://redux.js.org/ . My personal opinion is;
make code looks more busy without adding value.
{
"extends": "airbnb",
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"semi": [2, "never"],
}
}
git clone git@github.com:rwieruch/minimal-react-webpack-babel-setup.git
- cd minimal-react-webpack-babel-setup
- npm install
- npm start
Read more: Minimal Setup Tutorial