nestjs / nest-cli

CLI tool for Nest applications 🍹
https://nestjs.com
Other
1.98k stars 395 forks source link

Invalid script: pnpm lint #2759

Closed PerryFinn closed 1 month ago

PerryFinn commented 1 month ago

Is there an existing issue for this?

Current behavior

I tried to create a project using nest/cli within a certain folder. After the creation was complete, I wanted to run pnpm lint to format my code, but it gave me a warning and prevented this action.

pnpm lint

> fail-to-lint@0.0.1 lint /Users/good-man/Desktop/personal-workspace/fail-to-lint
> eslint "{src,apps,libs,test}/**/*.ts" --fix

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=4.7.4 <5.6.0

YOUR TYPESCRIPT VERSION: 5.6.3

Please only submit bug reports when using the officially supported version.

=============

Minimum reproduction code

https://github.com/Chen-913/fail-to-lint

Steps to reproduce

  1. cd ./some-dir

  2. nest new my-project -p pnpm something happen...

    image
  3. cd fail-to-lint & pnpm install

  4. pnpm lint

Expected behavior

I hope that pnpm lint can work properly. I noticed some differences in the CLI-generated package.json. When I run nest new demo on my computer to generate a project, the TypeScript version in the package.json is always ^5.1.3. You can see this in the repository link I provided.

However, when I use the same CLI version on my StackBlitz project , the generated TypeScript version is higher. I’m not sure why this is happening. Additionally, the ESLint version has also changed from version 8 to 9. I originally thought that NestJS intentionally kept ESLint at version 8, but it seems there’s a discrepancy compared to what I expected.

I hope this information helps a bit. Thanks!

Package version

10.4.5

NestJS version

^10.0.0

Node.js version

v18.20.4

In which operating systems have you tested?

Other

  1. pnpm@9.12.1
  2. Apple M2 Pro
  3. macOS Sonoma 14.5
micalevisk commented 1 month ago

this has nothing to do with PNPM btw

the current version of the app generated by nest new is broken because the installed typescript version (the latest one, v5.6.3) is not compatible with the latest version of ESLint typescript plugin

To fix that, downgrade typescript or wait the next release of @typescript-eslint/eslint-plugin

In order to address this on NestJS's CLI side, we would have to change the semver range of eslint, I guess

micalevisk commented 1 month ago

duplicate of https://github.com/nestjs/schematics/issues/1909