How to run eslint in create react app

Viewed 14985

Help to run eslint in create react app.

I created react app with tutorial

Then I installed

babel-eslint

standard

snazzy

and then I added to script in package.json next line

"lint": "standart --verbose | snazzy"

and now I tried to run eslint with command: npm run lint

but I have an error Parsing error: Unexpected token = null

My full package.json is below

{
  "name": "square_app_react",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^15.6.1",
    "react-dom": "^15.6.1",
    "react-scripts": "1.0.10"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "lint": "standart --verbose | snazzy"
  },
  "devDependencies": {
    "babel-eslint": "^7.2.3",
    "standard": "^10.0.2"
  }
}

Please help to understand how to fix it or how to correct run eslint in my situation.

Thank you in advance.

2 Answers

To run EsLint inside src folder:

./node_modules/react-scripts/node_modules/.bin/eslint src
Related