nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
67.73k stars 7.63k forks source link

yarn berry pnp => Save delay!! #13736

Closed jungsikjeong closed 4 months ago

jungsikjeong commented 4 months ago

Is there an existing issue for this?

Current behavior

I created a new project using @nestjs/cli and followed these steps:

  1. Set Yarn version to Berry using yarn set version berry.
  2. Added nodeLinker: pnp to .yarnrc.yml file.
  3. Installed dependencies using yarn install and installed the zipFS plugin from the market.
  4. Ran yarn dlx @yarnpkg/sdks vscode in the terminal to set up Yarn SDKs for VSCode.

After setting up Yarn Berry with PnP, I'm experiencing delays when changing and saving files due to ESLint.

스크린샷 2024-06-30 21-59-49

After step 4, the .vscode folder was created, and it contains the extensions.json and settings.json files. It seems that the save delays started occurring around this time.

What could be the cause of this issue?

}


- .eslintrc.js
```js
module.exports = {
  parser: '@typescript-eslint/parser',
  parserOptions: {
    project: 'tsconfig.json',
    tsconfigRootDir: __dirname,
    sourceType: 'module',
  },
  plugins: ['@typescript-eslint/eslint-plugin'],
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
  ],
  root: true,
  env: {
    node: true,
    jest: true,
  },
  ignorePatterns: ['.eslintrc.js'],
  rules: {
    '@typescript-eslint/interface-name-prefix': 'off',
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/explicit-module-boundary-types': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
  },
};

- tsconfig.build.json
- 
```js
{
  "extends": "./tsconfig.json",
  "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}

Minimum reproduction code

https://codesandbox.io/p/devbox/github/nestjs/typescript-starter/tree/master

Steps to reproduce

No response

Expected behavior

After setting up Yarn Berry with PnP, I'm experiencing delays when changing and saving files due to ESLint.

Package

Other package

No response

NestJS version

10.0.0

Packages versions

{
  "name": "server",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/apollo": "^12.1.0",
    "@nestjs/common": "^10.0.0",
    "@nestjs/config": "^3.2.2",
    "@nestjs/core": "^10.0.0",
    "@nestjs/passport": "^10.0.3",
    "@nestjs/platform-express": "^10.0.0",
    "@nestjs/typeorm": "^10.0.2",
    "passport-jwt": "^4.0.1",
    "reflect-metadata": "^0.2.0",
    "rxjs": "^7.8.1"
  },
  "devDependencies": {
    "@nestjs/cli": "^10.0.0",
    "@nestjs/schematics": "^10.0.0",
    "@nestjs/testing": "^10.0.0",
    "@types/express": "^4.17.17",
    "@types/jest": "^29.5.2",
    "@types/node": "^20.3.1",
    "@types/passport-jwt": "^4",
    "@types/supertest": "^6.0.0",
    "@typescript-eslint/eslint-plugin": "^6.0.0",
    "@typescript-eslint/parser": "^6.0.0",
    "eslint": "^8.42.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.0",
    "jest": "^29.5.0",
    "prettier": "^3.0.0",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.3",
    "ts-jest": "^29.1.0",
    "ts-loader": "^9.4.3",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "^4.2.0",
    "typescript": "5.3.3"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  },
  "packageManager": "yarn@4.3.1"
}

Node.js version

18.19.1

In which operating systems have you tested?

Other

No response

micalevisk commented 4 months ago

I'm experiencing delays when changing and saving files due to ESLint.

if it's due to ESLint, how does this could be related with @nestjs/cli? :thinking:

perhaps this is related with https://github.com/yarnpkg/berry/issues/8

jungsikjeong commented 4 months ago

if it's due to ESLint, how does this could be related with @nestjs/cli? 🤔

@micalevisk I'm curious if I correctly configured the yarn berry pnp option after fetching the boilerplate with nestjs/cli.

micalevisk commented 4 months ago

I guess you should configure it just as you would for any nodejs+typescript project

kamilmysliwiec commented 4 months ago

Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the #⁠ 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.