Failed to load plugin 'jest' eslint
benjgil opened this issue · comments
benjgil commented
Description:
I get the following when trying to build my components:
TypeError: Failed to load plugin 'jest' declared in 'CLIOptions ┬╗ C:\www\ng-workspace\node_modules\.pnpm\@teambit+react.react-env@1.0.38_@teambit+legacy@node_modules+@teambit+legacy_@types+node@12.20.4\node_modules\@teambit\react.react-env\config\eslintrc.js ┬╗ C:\www\ng-workspace\node_modules\.pnpm\@teambit+react.eslint-config-bit-react@1.0.105_@teambit+legacy@node_modules+@teambit+legacy_e_caxgnidt5jr32fl6agckwdo4jy\node_modules\@teambit\react.eslint-config-bit-react\dist\index.js': Class extends value undefined is not a constructor or null
Referenced from: C:\www\ng-workspace\node_modules\.pnpm\@teambit+react.eslint-config-bit-react@1.0.105_@teambit+legacy@node_modules+@teambit+legacy_e_caxgnidt5jr32fl6agckwdo4jy\node_modules\@teambit\react.eslint-config-bit-react\dist\index.js
at Object.<anonymous> (C:\www\ng-workspace\node_modules\.pnpm\@typescript-eslint+experimental-utils@4.33.0_eslint@8.56.0_typescript@5.2.2\node_modules\@typescript-eslint\experimental-utils\dist\ts-eslint\CLIEngine.js:12:34)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at module.constructor.require (C:\www\bit\node_modules\@teambit\bit\dist\hook-require.js:27:31)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (C:\www\ng-workspace\node_modules\.pnpm\@typescript-eslint+experimental-utils@4.33.0_eslint@8.56.0_typescript@5.2.2\node_modules\@typescript-eslint\experimental-utils\dist\ts-eslint\index.js:14:14)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
at Module.load (node:internal/modules/cjs/loader:1091:32)
at Module._load (node:internal/modules/cjs/loader:938:12)
at module.constructor.require (C:\www\bit\node_modules\@teambit\bit\dist\hook-require.js:27:31)
at require (node:internal/modules/helpers:130:18)
at Object.<anonymous> (C:\www\ng-workspace\node_modules\.pnpm\@typescript-eslint+experimental-utils@4.33.0_eslint@8.56.0_typescript@5.2.2\node_modules\@typescript-eslint\experimental-utils\dist\eslint-utils\RuleTester.js:36:31)
at Module._compile (node:internal/modules/cjs/loader:1241:14)
}
I have plugin-eslint-jest and other plugins installed in my workspace but that doesnt seem to fix the issue.
Expected Behavior
Shouldnt give this error :)
Specifications
- Bit version:
- Workspace type: (harmony)
- Node version:
- npm / yarn version:
- Platform:
for harmony workspace
- env - happens for a number of envs
benjgil commented
Turns out this is because if there are any missing eslint sub-packages then the eslint server doesnt manage to start up.
In the case of bit components, there are a number of packages being used in bit's core eslint configuration which is used by all bit's core envs.
So you need to add all of the following to your workspace.jsonc, run bit install
and then this should be resolved:
"eslint": "7.32.0",
"@typescript-eslint/eslint-plugin": "5.62.0",
"eslint-import-resolver-node": "0.3.6",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.5",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-mdx": "1.17.1",
"eslint-plugin-react": "7.22.0"