6

When i try to run the application by npm start

Failed to load plugin '@typescript-eslint' declared in '.eslintrc.json': Class extends value undefined is not a constructor or null

Why does it happen and how can I fix it?

eslintrc.json

{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": ["plugin:react/recommended", "airbnb"],
  "parser": "@typescript-eslint/parser",
  "settings": {
    "import/resolver": {
      "node": {
        "extensions": [".ts", ".tsx"],
        "moduleDirectory": ["src", "node_modules"]
      }
    }
  },
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": "latest",
    "sourceType": "module"
  },
  "plugins": ["react", "@typescript-eslint"],
  "rules": {
    "no-console": "off"
  }
}

package.json

  "devDependencies": {
    "@babel/core": "^7.16.5",
    "@babel/preset-env": "^7.16.5",
    "@types/react-dom": "^17.0.11",
    "@types/react-router-dom": "^5.3.2",
    "@types/react-table": "^7.7.9",
    "@types/scrollmagic": "^2.0.2",
    "@types/styled-components": "^5.1.21",
    "@typescript-eslint/eslint-plugin": "^5.14.0",
    "@typescript-eslint/parser": "^5.14.0",
    "awesome-typescript-loader": "^5.2.1",
    "babel-loader": "^8.2.3",
    "eslint": "^8.10.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-react": "^7.29.3",
    "eslint-plugin-react-hooks": "^4.3.0",
    "react-app-rewired": "^2.2.1"
  },

2 Answers 2

5

This seems to be a known typescript-eslint issue that may appear upon upgrading to eslint version 8.0.0, which has some breaking changes. Some comments on that first link indicate resolution by downgrading to eslint version 7.32.0.

If I understand correctly, typescript-eslint v4 does not support eslint v8, but typescript-eslint v5 does. So you might try either downgrading your eslint to version 7.32.0 or upgrading your typescript-eslint to v5.

Sign up to request clarification or add additional context in comments.

Comments

5

Finally solved it by downgrading eslint.

 "devDependencies": {
    ...
    "eslint": "^7.32.0"
  }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.