Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Doesn't work with eslint v8 #3735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
coderaiser opened this issue Aug 15, 2021 · 1 comment
Closed

Doesn't work with eslint v8 #3735

coderaiser opened this issue Aug 15, 2021 · 1 comment
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin working as intended Issues that are closed as they are working as intended

Comments

@coderaiser
Copy link
Contributor

coderaiser commented Aug 15, 2021

Installing latest versions of typescript, @typescript-eslint/plugin, @typescript-eslint/parser and eslint v8 with node v16, got a problem:

Welcome to Node.js v16.6.0.
Type ".help" for more information.
> require('@typescript-eslint/eslint-plugin')
Uncaught TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/Users/coderaiser/putout/node_modules/@typescript-eslint/experimental-utils/dist/ts-eslint/CLIEngine.js:12:34)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)

The thing is CLIEngine was deprecated in ESLint v7 and removed in v8 (which is right now in beta).

Also rules from ESLint cannot be required:

> require('@typescript-eslint/eslint-plugin')
Uncaught:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/rules/brace-style' is not defined by "exports" in /Users/coderaiser/putout/node_modules/eslint/package.json
    at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:335:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:560:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/Users/coderaiser/putout/node_modules/@typescript-eslint/eslint-plugin/dist/rules/brace-style.js:6:39)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/Users/coderaiser/putout/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js:12:39)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (/Users/coderaiser/putout/node_modules/@typescript-eslint/eslint-plugin/dist/index.js:5:33)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Because they are not exported anymore. According to migration guide, rules should be used this way:

-import baseRule from 'eslint/lib/rules/brace-style';
+import {builtinRules} from 'eslint/use-at-your-own-risk';
+const baseRule = builtinRules['brace-style'];
@coderaiser coderaiser added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for team members to take a look labels Aug 15, 2021
@bradzacher
Copy link
Member

Thanks for the issue - this is entirely expected. ESLint v8 contains a number of breakiing changes which we will need to make changes to support. We had discussions with the ESLint team about this, and are aware of the changes.

The supported ranges are communicated via our peer dependency ranges, which do not include ESLint v8.

@bradzacher bradzacher added working as intended Issues that are closed as they are working as intended and removed triage Waiting for team members to take a look labels Aug 16, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin working as intended Issues that are closed as they are working as intended
Projects
None yet
Development

No branches or pull requests

2 participants