create-react-app doesn't work with eslint-config-airbnb after eject
See original GitHub issueI’m using CRA v1.4.1.
- create-react-app testapp
- npm eject
- install https://www.npmjs.com/package/eslint-config-airbnb
- add eslint with the following config:
{
"root": true,
"extends": "airbnb",
"plugins": ["react"],
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"es6": true,
"browser": true
},
"parser": "babel-eslint",
"rules": {
"strict": 0
}
}
The build fails with several errors (JSX not allowed in files with extension ‘.js’, and many in registerServiceWorker.js).
The default react-app
config is very limited (eg. it doesn’t enforce semicolons) and airbnb is the de facto standard so would be cool if CRA can be fixed to comply to it by default.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Extend “Create React App” with AirBnB's ESLint config ...
Create React App already comes with ESLint, so we need only to extend its configuration. In your project, run the following:
Read more >My create-react-app is failing to compile due to ESLint error
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder. 2. Delete node_modules in your project folder. 3.
Read more >How To Customize ESLint Rules with an Ejected Create React ...
Projects created using Create React App have linting with ESLint already working and configured out of the box with sensible defaults.
Read more >How to add a custom ESLint configuration to a Create React ...
Go to package.json at the root of the project, and remove the eslintConfig object. Add ESLint configuration.
Read more >eslint-config-react-app - npm
ESLint configuration used by Create React App. Latest version: 7.0.1, last published: 9 months ago. Start using eslint-config-react-app in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is still an issue without ejecting, so I think it is an issue with CRA.
This isn’t a concern of CRA; if you’ve ejected it’s up to you to fix your ESLint configuration or errors.
Sorry!
Also, react-app config is strictly for finding errors – we do not enforce style. You should not use eslint to enforce style. Use a tool like Prettier to enforce style.