Typescript issue after updating to create-react-app 4.0.0

Viewed 788

I have just updated create-react-app to 4.0.0 and I have encountered many issues. The first one was

TypeError: Cannot add property noFallthroughCasesInSwitch, object is not extensible

I solved it by adding "noFallthroughCasesInSwitch": true, to my tsconfig.json

Now I'm able to start the app, but everything went just wrong. I have millions of apparently unsued variables, even though they are not.

enter image description here

I have updated typescript to 4.0.5 but the problem remains.

Also, my machine becomes very loud when I hit yarn start

1 Answers

you can temporarily turn off eslint error no-unused-vars and @typescript-eslint/no-unused-vars in file .eslintrc. For example

{
  "extends": [
    "react-app",
    "./node_modules/react-redux-typescript-scripts/eslint.js"
  ],
  "rules": {
    "camelcase": "off",
    "import/no-anonymous-default-export": "off",
    "@typescript-eslint/camelcase": "off",
    "no-unused-vars": "warn",
    "@typescript-eslint/no-unused-vars": "off",
    "@typescript-eslint/ban-ts-ignore": "off",
    "@typescript-eslint/ban-ts-comment": "off",
    "@typescript-eslint/no-empty-function": "off",
    "@typescript-eslint/explicit-module-boundary-types": "off",
    "@typescript-eslint/no-empty-interface": "off",
    "@typescript-eslint/ban-types": "off"
  }
}

Related