FoushWare / React_typescript_coding_blocks

My workflow for JavaScript (React, NodeJS)…consists of Jest, ESLint, typescript, husky, webpack, Babel
1 stars 0 forks source link

unexpected = in class component react #16

Open FoushWare opened 3 years ago

FoushWare commented 3 years ago

update the eslintrc and add parser/eslint

{
  "settings": {
    "react":{
      "version":"detect"
    }
  },
  "parser": "@babel/eslint-parser",
  "parserOptions": {
    "ecmaVersion": 2019,
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true

    }
  },
  "extends": ["eslint:recommended", "eslint-config-prettier","plugin:react/recommended"],
  "rules": {
    "strict": ["error", "never"],
    "no-debugger":"off"
  },
  "env": {
    "browser": true,
    "jest":true,
    "node": true,
    "es6": true
  },
  "globals": {
    "React":true,
    "ReactDOM":true
  },
  // overrides eslint to work with typescript
  "overrides": [
    {
      "files": "**/*.+(ts|tsx)",
      "parser": "@typescript-eslint/parser",
      "parserOptions": {
        "project": "./tsconfig.json"
      },
      "plugins": ["@typescript-eslint/eslint-plugin"],
      "extends": [
        "plugin:@typescript-eslint/eslint-recommended", // removes redundant warnings between TS & ESLint
        "plugin:@typescript-eslint/recommended", // rules specific to typescript, e.g., writing interfaces
        "prettier"
        // "eslint-config-prettier/@typescript-eslint" // ensure rule set doesn't conflict with prettier for TS files too
      ]
    }
  ]
}