loading...

re: How To Set Up ESLint, TypeScript, Prettier with Create React App VIEW POST

FULL DISCUSSION
 

Thanks to your guide I was able to fix the CRA's own eslint that was failing on as with Parsing error: Unexpected token, expected "," by adding theses lines to package.json.

{
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^1.6.0",
    "@typescript-eslint/parser": "^1.6.0",
    "eslint-config-react": "^1.1.7"
  },
  "eslintConfig": {
    "parser": "@typescript-eslint/parser",
    "plugins": ["react", "@typescript-eslint"],
    "extends": ["react-app"],
    "rules": {
      // custom rules here
    }
  }
}
 

Why are you using your own eslint related files instead of the eslintConfig that is already present in package.json? Did you remove the config from package.json or do you keep it there, having two eslint configurations? Is your solution still using CRA's internal mechanisms or is it something completely custom?

 

I'm not using an eslintConfig in my package.json. Using the .eslintrc.json is the only place I have added any configurations. This is just my preference, eslintConfig in package.json is also a valid approach. It just depends on how you like to structure your project

Code of Conduct Report abuse