I have created a repo using turborepo, And have the following folder structure
The API directory contains loopback API.
If I run yarn lint
from the project level it throws this error
api:lint: $ lb-eslint --report-unused-disable-directives .
api:lint: node:internal/modules/cjs/loader:488
api:lint: throw e;
api:lint: ^
api:lint:
api:lint: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin/eslint' is not defined by "exports" in ....Project0/node_modules/eslint/package.json
api:lint: at new NodeError (node:internal/errors:371:5)
api:lint: at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
api:lint: at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
api:lint: at resolveExports (node:internal/modules/cjs/loader:482:36)
api:lint: at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
api:lint: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
api:lint: at Function.resolve (node:internal/modules/cjs/helpers:108:19)
api:lint: at resolveCLI (....Project0/node_modules/@loopback/build/bin/utils.js:76:18)
api:lint: at Object.runCLI (....Project0/node_modules/@loopback/build/bin/utils.js:128:9)
api:lint: at run (..../node_modules/@loopback/build/bin/run-eslint.js:45:16) {
api:lint: code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
api:lint: }
Same issue if I run the same command from within the API directory. Help!
I was able to get linting working in lastest version of tubrorepo and loopback 4 by following the docs. I would suggest removing any orphan files in directory using git clean -fdx
and then running yarn install
.
➜ test-repo git:(main) ✗ yarn lint
yarn run v1.22.19
$ turbo run lint
• Packages in scope: apis, docs, eslint-config-custom, tsconfig, ui, web
• Running lint in 6 packages
apis:lint: cache miss, executing 088ca76a1deb7d80
ui:lint: cache miss, executing 01f15b1f691f55cb
docs:lint: cache miss, executing 2f27d4a1a57d2944
web:lint: cache miss, executing 252eb2868bb904ab
apis:lint: warning package.json: License should be a valid SPDX license expression
ui:lint: $ eslint *.ts*
docs:lint: $ next lint
web:lint: $ next lint
apis:lint: $ yarn run eslint && yarn run prettier:check
apis:lint: warning package.json: License should be a valid SPDX license expression
apis:lint: $ lb-eslint --report-unused-disable-directives .
docs:lint: ✔ No ESLint warnings or errors
apis:lint: warning package.json: License should be a valid SPDX license expression
web:lint: ✔ No ESLint warnings or errors
apis:lint: $ yarn run prettier:cli -l
apis:lint: warning package.json: License should be a valid SPDX license expression
apis:lint: $ lb-prettier "**/*.ts" "**/*.js" -l
Tasks: 4 successful, 4 total
Cached: 0 cached, 4 total
Time: 3.644s