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

Skip to content

Allow all 12.x and 14.x Node.js versions to be usedΒ #4465

Closed
@lirantal

Description

@lirantal

Since this commit b63013a and specifically the major version 5.x of the plugin, this package is requiring specifically the v14.17 version of Node.js as part of the engines rule, such as:

  "engines": {
    "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
  },

Is there a reason for specifically setting a lower cap on v12.22 and v14.17 minor versions? Because if this is about being LTS compliant than the rule should really be:

  "engines": {
    "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
  },

To allow all supported (v12 and v14) Node.js versions to be used.

Why didn't we hear about this before?

This might not seem as an issue for npm users, because the default engines configuration is to shoot out a WARNING issue, rather than failing it, but some versions of yarn, such as 1.22.10 explicitly fails any npm install of such projects. See here:

$ yarn
yarn install v1.22.10
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
[2/4] 🚚  Fetching packages...
error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "14.15.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

If you confirm this issue and would be open to receiving a fix to relax the Node.js engines config on package.json then I'm happy to push forward a quick PR to suggest the fix/

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have read the FAQ and my problem is not listed.

Repro

  1. Run npm init -y

  2. Use Node.js version v16 (any patch and any minor)

  3. Run npm install

  4. All work fine

  5. Run npm init -y

  6. Use Node.js version v14.15.1

  7. Update the package.json to include:

  "engines": {
    "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
  },
  1. Run npm install
  2. Notice the installation fails due to incompatible Node.js engines version required.

Expected Result

Expect for all Node.js v14 and v12 to be supported, as is indeed the case (you can confirm here https://github.com/nodejs/Release#release-schedule)

Actual Result

Getting an error about incomplete Node.js version when trying to install this package

Versions

package version
@typescript-eslint/eslint-plugin 5.10.0
@typescript-eslint/parser X.Y.Z
node 14.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions