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

ESLint Initialization Results in "TypeError: Invalid Version: undefined" #13978

Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly cli Relates to ESLint's command-line interface

Comments

@jasel-lewis
Copy link

When initializing ESLint, receiving a TypeError in relation to sermver.

Environment:
Node v14.15.3
npm v6.14.9

Repro:

  1. npx create-electron-app my-app
  2. npm install eslint --save-dev
  3. ./node_modules/.bin/eslint --init

Config selections:

  • To check syntax, find problems, and enforce code style
  • JavaScript modules (import/export)
  • React
  • Does your project use TypeScript: No
  • Where does your code run? Browser
  • Use a popular style guide
  • Standard: https://github.com/standard/standard
  • What format do you want your config file to be in? JavaScript

Results:

Checking peerDependencies of eslint-config-standard@latest

Oops! Something went wrong! :(

ESLint: 7.10.0

TypeError: Invalid Version: undefined
    at new SemVer (D:\Repos.Private\my-app\node_modules\semver\classes\semver.js:19:13)
    at outside (D:\Repos.Private\my-app\node_modules\semver\ranges\outside.js:12:13)
    at Object.ltr (D:\Repos.Private\my-app\node_modules\semver\ranges\ltr.js:3:42)
    at TogglePrompt.message (D:\Repos.Private\my-app\node_modules\eslint\lib\init\config-initializer.js:569:37)
    at Object.exports.resolve (D:\Repos.Private\my-app\node_modules\enquirer\lib\utils.js:43:18)
    at TogglePrompt.resolve (D:\Repos.Private\my-app\node_modules\enquirer\lib\prompt.js:373:18)
    at TogglePrompt.element (D:\Repos.Private\my-app\node_modules\enquirer\lib\prompt.js:249:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async TogglePrompt.message (D:\Repos.Private\my-app\node_modules\enquirer\lib\prompt.js:270:19)
    at async TogglePrompt.render (D:\Repos.Private\my-app\node_modules\enquirer\lib\prompts\toggle.js:91:19)

Possibly similar in relation to "Invalid Version: undefined" semver on version 3.x flow-typed.

@jasel-lewis jasel-lewis added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jan 3, 2021
@armordog
Copy link

armordog commented Jan 7, 2021

For what it's worth, I'm having this same issue.
I've bisected it to between v7.2.0 and v7.3.0

@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion cli Relates to ESLint's command-line interface and removed triage An ESLint team member will look at this issue soon labels Jan 8, 2021
@mdjermanovic
Copy link
Member

Thanks for the bug report!

Oops! Something went wrong! :(

ESLint: 7.10.0

I can reproduce this with ESLint v7.10.0, there's a bug with the question to upgrade/downgrade ESLint.

Can you try with the latest ESLint v7.17.0? The same problem in the code exists in v7.17.0, but it shouldn't be observable just because this version satisfies the actual eslint-config-standard's peer dependency requirements ("eslint": "^7.12.1").

I'm working on the fix.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.