question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Environment

Node version: v14.18.0 npm version: 6.14.15 yarn version: 1.22.10 Local ESLint version: 8.0.0 Global ESLint version: - Operating System: Windows 11

What parser are you using?

@typescript-eslint/parser

What did you do?

Configuration

.eslintrc.json

{
    "root": true,
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "ecmaVersion": 6,
        "sourceType": "module"
    },
    "plugins": ["@typescript-eslint"],
    "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
    "rules": {
        "@typescript-eslint/naming-convention": "warn",
        "@typescript-eslint/semi": "warn",
        "curly": "warn",
        "eqeqeq": "warn",
        "no-throw-literal": "warn",
        "semi": "off"
    }
}

.eslintignore

dist
node_modules

package.json

...
"scripts": {
        "lint": "eslint ./src/** --ext .ts",
        "prettier": "prettier --write ./",
    },
"devDependencies": {
        "@types/glob": "^7.1.3",
        "@types/mocha": "^8.0.4",
        "@types/node": "^12.11.7",
        "@types/vscode": "^1.54.0",
        "@typescript-eslint/eslint-plugin": "^4.33.0",
        "@typescript-eslint/parser": "^4.33.0",
        "eslint": "^8.0.0",
        "glob": "^7.1.6",
        "husky": "^7.0.2",
        "mocha": "^8.2.1",
        "prettier": "^2.4.1",
        "ts-loader": "^8.0.14",
        "typescript": "^4.4.3",
        "webpack": "^5.19.0",
        "webpack-cli": "^4.4.0"
    },

command launched

yarn
yarn lint

What did you expect to happen?

I expect eslint to lint my files.

What actually happened?

yarn
yarn install v1.22.10
[1/5] Validating package.json...
warning snippets-viewer@1.10.0: The engine "vscode" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > @typescript-eslint/eslint-plugin@4.33.0" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0 || ^7.0.0".
warning " > @typescript-eslint/parser@4.33.0" has incorrect peer dependency "eslint@^5.0.0 || ^6.0.0 || ^7.0.0".
[5/5] Building fresh packages...
$ husky install
husky - Git hooks installed
Done in 2.33s.

yarn run v1.22.10
warning snippets-viewer@1.10.0: The engine "vscode" appears to be invalid.
$ eslint ./src/** --ext .ts

Oops! Something went wrong! :(

ESLint: 8.0.0

TypeError: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.json': Class extends value undefined is not a constructor or null
Referenced from: E:\dev\vscode-snippets-editor\.eslintrc.json
    at Object.<anonymous> (E:\dev\vscode-snippets-editor\node_modules\@typescript-eslint\experimental-utils\dist\ts-eslint\CLIEngine.js:12:34)
    at Module._compile (E:\dev\vscode-snippets-editor\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (E:\dev\vscode-snippets-editor\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at Object.<anonymous> (E:\dev\vscode-snippets-editor\node_modules\@typescript-eslint\experimental-utils\dist\ts-eslint\index.js:14:14)
    at Module._compile (E:\dev\vscode-snippets-editor\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:32
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

26reactions
aladdin-addcommented, Oct 11, 2021

eslint v8 will be supported in ts-eslint v5. please follow the issue: https://github.com/typescript-eslint/typescript-eslint/issues/3738

14reactions
lucasriondelcommented, Oct 10, 2021

It seems to be working with eslint 7.32.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

8.0.0 Failed to load plugin '@typescript-eslint' - Stack Overflow
I saw this error trying to use version 4.x.x of the @typescript-eslint packages:
Read more >
WEB-53184 - YouTrack
Error : Failed to load plugin '@typescript-eslint' declared in '../../../.eslintrc.json': Cannot find module '@typescript-eslint/eslint-plugin'.
Read more >
test suite failed to run typeerror: class extends value undefined ...
I am using ts-jest to write tests for my ts-node project. The application runs fine and there are no TypeScript errors in the...
Read more >
@typescript-eslint/eslint-plugin - npm
TypeScript plugin for ESLint. Latest version: 5.47.1, last published: 2 days ago. Start using @typescript-eslint/eslint-plugin in your ...
Read more >
Migrate from TSLint to ESLint - Visual Studio Code
A guide to migrating extension projects from the TSLint linter to ESLint. ... npm install --save-dev eslint @typescript-eslint/parser ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found