January 26, 2023
eslint를 upgrade한 lint 명령어를 실행시켰는데 아래와 같은 에러를 만났습니다.
$ eslint --ext .js,.vue --ignore-path .gitignore --fix src
Oops! Something went wrong! :(
ESLint: 8.32.0
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Failed to load plugin 'import' declared in '.eslintrc.js': Package subpath './lib/util/glob-util' is not defined by "exports" in /Users/donghoonsong/project/comento-ui/node_modules/eslint/package.json
Referenced from: /Users/donghoonsong/project/comento-ui/.eslintrc.js
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/Users/donghoonsong/project/comento-ui/node_modules/eslint-plugin-import/lib/rules/no-unused-modules.js:43:34)
error Command failed with exit code 2.
아래 명령어를 실행해서 plugin을 upgrade했더니 해결됐습니다.
yarn upgrade eslint-plugin-import
https://github.com/import-js/eslint-plugin-import/issues/2252