question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

create-react-app doesn't work with eslint-config-airbnb after eject

See original GitHub issue

I’m using CRA v1.4.1.

  1. create-react-app testapp
  2. npm eject
  3. install https://www.npmjs.com/package/eslint-config-airbnb
  4. 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

17reactions
nickmccurdycommented, Dec 2, 2017

This is still an issue without ejecting, so I think it is an issue with CRA.

14reactions
Timercommented, Oct 13, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found