Search code examples
node.jsnext.jspnpm

Peer dependencies issue in eslint-config-next (with Typescript)


I create a new project with Next.js using pnpm, and i got this error for typescript depencencies missing from pnpm:

 WARN  Issues with peer dependencies found
.
└─┬ eslint-config-next 13.2.3
  ├── ✕ missing peer typescript@>=3.3.1
  └─┬ @typescript-eslint/parser 5.54.0
    ├── ✕ missing peer typescript@"*"
    └─┬ @typescript-eslint/typescript-estree 5.54.0
      ├── ✕ missing peer typescript@"*"
      └─┬ tsutils 3.21.0
        └── ✕ missing peer typescript@">=2.8.0 || ...

my package.json :

{
  "name": "nextjs-project",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@chakra-ui/react": "^2.5.1",
    "@emotion/react": "^11.10.6",
    "@emotion/styled": "^11.10.6",
    "eslint": "8.35.0",
    "eslint-config-next": "13.2.3",
    "framer-motion": "^10.0.1",
    "next": "13.2.3",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}

well it's normal since i didn't install typescript, i know i can solve this if i install it, however for this small project i am not using typescript, so is there a way to fix this error without installing typescript since i don't use it ? or i have no choice but to remove eslint-config-next?


Solution

  • Ok I found the answer from pnpm repository it was on the doc... https://pnpm.io/package_json#pnpmpeerdependencyrules I just need to add this in my package json to remove the warning :

    {
      "pnpm": {
        "peerDependencyRules": {
          "ignoreMissing": ["typescript"]
        }
      }
    }