Skip to content
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

[parser] Error with ESLint 6.0.0 pre-releases #563

Closed
teppeis opened this issue May 27, 2019 · 6 comments · Fixed by #628
Closed

[parser] Error with ESLint 6.0.0 pre-releases #563

teppeis opened this issue May 27, 2019 · 6 comments · Fixed by #628
Labels
bug Something isn't working has pr there is a PR raised to close this package: parser Issues related to @typescript-eslint/parser

Comments

@teppeis
Copy link
Contributor

teppeis commented May 27, 2019

What code were you trying to parse?

module.exports = {
  overrides: [
    {
      files: ["*.ts", "*.tsx"],
      parser: require.resolve("@typescript-eslint/parser")
}

What did you expect to happen?

Able to parse TypeScript files.

What actually happened?

Error: Failed to load parser '@typescript-eslint/parser/dist/parser.js': Cannot find module 'eslint/lib/util/traverser'
Error: Failed to load parser '/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/@typescript-eslint/parser/dist/parser.js' declared in '--config » ../../+typescript.js#overrides[0]': Cannot find module 'eslint/lib/util/traverser'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/@typescript-eslint/parser/dist/parser.js:7:37)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at ConfigArrayFactory._loadParser (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:756:29)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:549:32)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:490:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:580:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:490:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigDataBody (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:544:25)
    at _normalizeObjectConfigDataBody.next (<anonymous>)
    at ConfigArrayFactory._normalizeObjectConfigData (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:490:20)
    at _normalizeObjectConfigData.next (<anonymous>)
    at createConfigArray (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:306:25)
    at ConfigArrayFactory.loadFile (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/config-array-factory.js:381:16)
    at createCLIConfigArray (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:140:35)
    at new CascadingConfigArrayFactory (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:199:29)
    at new CLIEngine (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/node_modules/eslint/lib/cli-engine/cli-engine.js:552:36)
    at verify (/Users/teppei/src/github.com/teppeis/eslint-config-teppeis/test/index.js:23:18)

import traverser from 'eslint/lib/util/traverser';

Versions

package version
@typescript-eslint/parser 1.9.0
TypeScript 3.4.5
ESLint 6.0.0-alpha.2
node 10.15.3
npm 6.9.0
@teppeis teppeis added package: parser Issues related to @typescript-eslint/parser triage Waiting for maintainers to take a look labels May 27, 2019
@teppeis teppeis changed the title Error with ESLint 6.0.0-alpha.2 [parser] Error with ESLint 6.0.0-alpha.2 May 27, 2019
@teppeis
Copy link
Contributor Author

teppeis commented May 27, 2019

Related: [indent-new-do-not-use] Error with ESLint 6.0.0-alpha.2 #564

@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels May 28, 2019
@JamesHenry JamesHenry changed the title [parser] Error with ESLint 6.0.0-alpha.2 [parser] Error with ESLint 6.0.0 pre-releases Jun 10, 2019
@JamesHenry
Copy link
Member

ESLint 6 has moved into the RC phase with rc.0

@JamesHenry
Copy link
Member

We could probably temporarily support both ESLint 5 and 6 by converting these imports to requires and wrapping them in a try catch, what do you think @mysticatea? Are there any other changes to watch out for?

@mysticatea
Copy link
Member

mysticatea commented Jun 10, 2019

In ideal, we should not import any private files of ESLint. It's not a part of the public API, so those files can be changed anytime (even if as a patch release).

@ivan-aksamentov
Copy link

traverser.js has been moved from lib/util/traverser.js to lib/shared/traverser.js
in commit eslint#219aecb PR eslint#11555

As a quick fix, #614 attempts to monkey-patch this.

@JamesHenry
Copy link
Member

FYI this should be fixed by #628

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working has pr there is a PR raised to close this package: parser Issues related to @typescript-eslint/parser
Projects
None yet
5 participants