typescript-eslint / typescript-eslint

:sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript
https://typescript-eslint.io
Other
15.22k stars 2.72k forks source link

Repo: latest canary release fails to install #5352

Closed ThisIsMissEm closed 2 years ago

ThisIsMissEm commented 2 years ago

Suggestion

This might be because of my setup, I'm not sure, but when trying to install the canary in our shared linting repo, we receive:

eslint-config-lib $ npm install --save @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: @inrupt/eslint-config-lib@1.1.0
npm ERR! Found: @typescript-eslint/parser@5.30.8-alpha.2
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   @typescript-eslint/parser@"5.30.8-alpha.2" from @inrupt/eslint-config-lib@1.1.0
npm ERR!   eslint-config-lib
npm ERR!     @inrupt/eslint-config-lib@1.1.0
npm ERR!     node_modules/@inrupt/eslint-config-lib
npm ERR!       workspace eslint-config-lib from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/eslint-plugin@5.30.8-alpha.2
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   @typescript-eslint/eslint-plugin@"5.30.8-alpha.2" from @inrupt/eslint-config-lib@1.1.0
npm ERR!   eslint-config-lib
npm ERR!     @inrupt/eslint-config-lib@1.1.0
npm ERR!     node_modules/@inrupt/eslint-config-lib
npm ERR!       workspace eslint-config-lib from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See ~/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2022-07-19T00_27_47_653Z-debug-0.log

The report is:

# npm resolution error report

2022-07-19T00:27:49.081Z

While resolving: @inrupt/eslint-config-lib@1.1.0
Found: @typescript-eslint/parser@5.30.8-alpha.2
node_modules/@typescript-eslint/parser
  @typescript-eslint/parser@"5.30.8-alpha.2" from @inrupt/eslint-config-lib@1.1.0
  eslint-config-lib
    @inrupt/eslint-config-lib@1.1.0
    node_modules/@inrupt/eslint-config-lib
      workspace eslint-config-lib from the root project

Could not resolve dependency:
peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/eslint-plugin@5.30.8-alpha.2
node_modules/@typescript-eslint/eslint-plugin
  @typescript-eslint/eslint-plugin@"5.30.8-alpha.2" from @inrupt/eslint-config-lib@1.1.0
  eslint-config-lib
    @inrupt/eslint-config-lib@1.1.0
    node_modules/@inrupt/eslint-config-lib
      workspace eslint-config-lib from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "current": {
    "name": "@typescript-eslint/parser",
    "version": "5.30.8-alpha.2",
    "whileInstalling": {
      "name": "@inrupt/eslint-config-lib",
      "version": "1.1.0",
      "path": "[trunc]/javascript-style-configs/eslint-config-lib"
    },
    "location": "node_modules/@typescript-eslint/parser",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "prod",
        "name": "@typescript-eslint/parser",
        "spec": "5.30.8-alpha.2",
        "from": {
          "name": "@inrupt/eslint-config-lib",
          "version": "1.1.0",
          "location": "eslint-config-lib",
          "isWorkspace": true,
          "dependents": [],
          "linksIn": [
            {
              "name": "@inrupt/eslint-config-lib",
              "version": "1.1.0",
              "location": "node_modules/@inrupt/eslint-config-lib",
              "isWorkspace": true,
              "dependents": [
                {
                  "type": "workspace",
                  "name": "@inrupt/eslint-config-lib",
                  "spec": "file:[trunc]/javascript-style-configs/eslint-config-lib",
                  "from": {
                    "location": "[trunc]/javascript-style-configs"
                  }
                }
              ]
            }
          ]
        }
      }
    ]
  },
  "currentEdge": {
    "type": "prod",
    "name": "@typescript-eslint/parser",
    "spec": "5.30.8-alpha.2",
    "from": {
      "name": "@inrupt/eslint-config-lib",
      "version": "1.1.0",
      "location": "eslint-config-lib",
      "isWorkspace": true,
      "dependents": [],
      "linksIn": [
        {
          "name": "@inrupt/eslint-config-lib",
          "version": "1.1.0",
          "location": "node_modules/@inrupt/eslint-config-lib",
          "isWorkspace": true,
          "dependents": [
            {
              "type": "workspace",
              "name": "@inrupt/eslint-config-lib",
              "spec": "file:[trunc]/javascript-style-configs/eslint-config-lib",
              "from": {
                "location": "[trunc]/javascript-style-configs"
              }
            }
          ]
        }
      ]
    }
  },
  "edge": {
    "type": "peer",
    "name": "@typescript-eslint/parser",
    "spec": "^5.0.0",
    "error": "INVALID",
    "from": {
      "name": "@typescript-eslint/eslint-plugin",
      "version": "5.30.8-alpha.2",
      "whileInstalling": {
        "name": "@inrupt/eslint-config-lib",
        "version": "1.1.0",
        "path": "[trunc]/javascript-style-configs/eslint-config-lib"
      },
      "location": "node_modules/@typescript-eslint/eslint-plugin",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "prod",
          "name": "@typescript-eslint/eslint-plugin",
          "spec": "5.30.8-alpha.2",
          "from": {
            "name": "@inrupt/eslint-config-lib",
            "version": "1.1.0",
            "location": "eslint-config-lib",
            "isWorkspace": true,
            "dependents": [],
            "linksIn": [
              {
                "name": "@inrupt/eslint-config-lib",
                "version": "1.1.0",
                "location": "node_modules/@inrupt/eslint-config-lib",
                "isWorkspace": true,
                "dependents": [
                  {
                    "type": "workspace",
                    "name": "@inrupt/eslint-config-lib",
                    "spec": "file:[trunc]/javascript-style-configs/eslint-config-lib",
                    "from": {
                      "location": "[trunc]/javascript-style-configs"
                    }
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}

I've tried rerunning with --force and even using the overrides functionality in npm, but I'm thinking maybe something has gone wrong with the latest canary publish?

bradzacher commented 2 years ago

This occurs because npm by default (as of v7) automatically install peer dependencies for packages. This then butts up against npm's desire to install one version of a package if it's specified as a peer dependency.

Put another way, if you do:

npm i @typescript-eslint/eslint-plugin@canary

That's the same as doing this:

npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@^5.0.0

Which then follows that the command you mentioned in your post is actually:

npm i @typescript-eslint/eslint-plugin@canary @typescript-eslint/parser@canary @typescript-eslint/parser@^5.0.0

Which explains why npm is erroring here - it thinks you're asking it to install both @canary (@5.30.8-alpha.2) AND @^5.0.0 - which means you're asking for two incompatible versions to be installed in the root!

Why is the canary version incompatible? Because by definition npm's semver handling excludes pre-release tags from semver ranges, unless the range specifies a prerelease tag! I.e. ^5.0.0 does not match 5.30.8-alpha.2.

As far as I can tell from the docs - there's literally no semver that can be used to match "every v5.x.x pre-release AND every v5.x.x full-release".

Which means we're sadly stuck here with no possible resolution, I believe.

However, you can work around this locally by using the --legacy-peer-deps flag, which will opt-out of the auto-install behaviour.

ThisIsMissEm commented 2 years ago

@bradzacher hm, okay; would you be able to do a 5.30.8 release soon? The issue we're having is that npm audit is failing on the latest package (frustratingly, because of eslint-plugin-jest that's depended on by something in the @typescript-eslint package graph).

bradzacher commented 2 years ago

https://github.com/typescript-eslint/typescript-eslint#versioning

Next release is Monday. There have been no user-facing commits to main since the last release (which was yesterday) so a release now wouldn't do anything anyways.

If it's the audit I think you're talking about - it won't be resolved because we can't resolve it. https://github.com/typescript-eslint/typescript-eslint/issues/5353