ci를 위한 스크립트 작성중 lint에 대한 의존성 충돌 이슈가 발생 했다.
Oops! Something went wrong! :(
ESLint: 9.14.0
Error: @typescript-eslint/utils tried to access eslint (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
Required package: eslint (via "eslint/use-at-your-own-risk")
Required by: @typescript-...
https://velog.io/@hoon0123/peerdependency-박살난거-해결해야해 ← 참고 블로그
해당 오류는 @typescript-eslint/utils
패키지가 eslint
를 peer dependency로 요구하지만, 해당 의존성이 yarn의 의존성 트리에서 제대로 제공되지 않는 경우에 발생한다.
https://mitchell-up.github.io/mitchell-dictionary/docs/terms/peer-dependency/
일반적인 dependency는 패키지 자체에 필요한 모듈을 의미하며, 해당 패키지를 설치할 때 함께 설치된다.
peer dependency란 라이브러리나 플러그인에서 사용하는 패키지 중에서 라이브러리를 사용하는 사용자가 직접 설치해야 하는 패키지를 의미한다.
예를 들어 eslint-plugin-react
는 React와 관련된 ESLint 규칙을 제공합니다. 이 플러그인은 eslint
와 함께 사용해야 하므로, eslint
를 peer dependency로 지정해주어야 한다.
문제 목록을 확인하기 위해선 yarn explain peer-requirements
명령어로 확인해 볼 수 있다.
문제가 발생한 라이브러리와 제공되지 않은 라이브러리를 확인해볼 수 있다.
→ ✘ @typescript-eslint/utils@npm:8.14.0 [60205] doesn't provide typescript to @typescript-eslint/typescript-estree@npm:8.14.0 [55f0c] and 1 other dependency
⇒ @typescript-eslint/utils@npm:8.14.0
패키지가 하위 의존성들에게 typescript를 요구받고 있으나 제공을 못하고 있음