microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.95k stars 601 forks source link

[eslint-config] rush update fails on eslint-config using @rushstack/heft-node-rig riggable dependencies #2832

Open mpellegrini opened 3 years ago

mpellegrini commented 3 years ago

I had posted a question in the chat room here but not getting any responses https://rushstack.zulipchat.com/#narrow/stream/262513-general/topic/later.20version.20of.20pnpm.20not.20resolving.20deps.20defined.20in.20rig

Summary

Trying to define a project in rush that has a devDependency on the following in package.json:

As per the docs here https://rushstack.io/pages/heft/rig_packages/, I should not have to explicitly list eslint and typescript as devDependencies because they are already defined in heft-node-rig. However, if I don't explicitly list eslint and typescript, running rush update fails.

I have been able to reproduce this issue using a modified version of the rush-examples repo. See below for details.

Repro steps

To reproduce the error,

  1. Start by cloning https://github.com/mpellegrini/rush-rig-issue
  2. in the root of the project run rush build

    Expected result: successful build

    Actual result:

    
     ERROR  @rush-temp/heft-node-rig-tutorial > @rushstack/eslint-config > @rushstack/eslint-plugin > @typescript-eslint/experimental-utils > @typescript-eslint/typescript-estree: tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none was installed.rg/typescript/4.3.2: 2.52 MB/10.6 MB
    Progress: resolved 653, reused 651, downloaded 0, added 0
    Downloading registry.npmjs.org/typescript/3.9.9: 2.52 MB/9.58 MB
    Downloading registry.npmjs.org/typescript/4.3.2: 2.52 MB/10.6 MB

The command failed: /Users/michael/delme/rushstack-samples/common/temp/pnpm-local/node_modules/.bin/pnpm install --store /Users/michael/delme/rushstack-samples/common/temp/pnpm-store --no-prefer-frozen-lockfile --strict-peer-dependencies ERROR: Error: The command failed with exit code 1

Giving up after 3 attempts



## Details

What is interesting is if I clone https://github.com/microsoft/rushstack-samples and then run `rush update` everything works.
But if I remove all other projects and just leave `heft/heft-node-rig-tutorial/` then the failure occurs. So it seems that if at least one project has declared typescript and eslint then other projects like heft/heft-node-rig-tutorial which don't explicitly declare these dependencies works fine.

## Standard questions

Please answer these questions to help us investigate your issue more quickly:

| Question | Answer |
| -------- | -------- |
| `@rushstack/eslint-config` version? | 2.3.4
| Operating system? | Mac
| Would you consider contributing a PR? | unsure, don't know a ton about rush just yet
| TypeScript compiler version? | 4.3.2
| Node.js version (`node -v`)? | v14.17.3
mpellegrini commented 3 years ago

This seems to be related to when useWorkspaces is true in rush.json.
When I turn this flag to false, then able to rush build successfully.

iclanton commented 3 years ago

I've seen this issue before as well. @octogonz, I remember you having a solution?

octogonz commented 3 years ago

There are multiple different ways this problem can arise. Someone needs to investigate @mpellegrini's repro and determine what's up. I'll see if I can find some time.