Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working when using next eslint configuration #42

Closed
barroudjo opened this issue Jun 14, 2022 · 5 comments
Closed

not working when using next eslint configuration #42

barroudjo opened this issue Jun 14, 2022 · 5 comments

Comments

@barroudjo
Copy link

Describe the bug
Next provides an eslint config.
if you have an eslint config that references it, then this extension will fail with the following message:

Error: Failed to load plugin 'react-hooks' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received '' 
TypeError: Failed to load plugin 'react-hooks' declared in 'CLIOptions': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
	at new NodeError (node:internal/errors:371:5)
	at createRequire (node:internal/modules/cjs/loader:1214:13)
	at Object.resolve (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2325:16)
	at Object.ModuleResolver.resolve (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:201:44)
	at ConfigArrayFactory._loadPlugin (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3376:33)
	at ConfigArrayFactory._loadPlugin (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@rushstack/eslint-patch/lib/modern-module-resolution.js:203:43)
	at /home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3267:33
	at Array.reduce (<anonymous>)
	at ConfigArrayFactory._loadPlugins (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3263:22)
	at ConfigArrayFactory._normalizeObjectConfigDataBody (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3063:44)
	at _normalizeObjectConfigDataBody.next (<anonymous>)
	at ConfigArrayFactory._normalizeObjectConfigData (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3003:20)
	at _normalizeObjectConfigData.next (<anonymous>)
	at ConfigArrayFactory.create (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2798:16)
	at createCLIConfigArray (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3608:47)
	at CascadingConfigArrayFactory.clearCache (/home/linuxpoutous/Ekwateur/edito-front/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3780:32)
	at new ESLint (/home/linuxpoutous/Ekwateur/edito-front/node_modules/eslint/lib/eslint/eslint.js:448:32)
	at Pge (/home/linuxpoutous/.vscode-server/extensions/rvest.vs-code-prettier-eslint-5.0.1/dist/extension.js:180:69)
	at /home/linuxpoutous/.vscode-server/extensions/rvest.vs-code-prettier-eslint-5.0.1/dist/extension.js:188:700
	at Lge (/home/linuxpoutous/.vscode-server/extensions/rvest.vs-code-prettier-eslint-5.0.1/dist/extension.js:180:1439)
	at processTicksAndRejections (node:internal/process/task_queues:96:5)

My guess is that it is because the next eslint config is using @rushstack/eslint-patch which changes the way plugins are loaded.

To Reproduce

  • use version v5.0.1 of the Prettier ESLint with prettier@^2.5.1 & eslint@^8.7.0 (the rest is provided by the next eslint config)
  • use "eslint-config-next": "^12.1.6"
  • use the following eslintrc.js:
module.exports = {
  extends: ["next", 'prettier']
};
  • you should see the problem

System Specifications (please complete the following information):

  • OS: windows 10 on WSL2
@idahogurl
Copy link
Owner

idahogurl commented Jun 14, 2022

@barroudjo Have you tried the prettier-eslint-cli (https://github.com/prettier/prettier-eslint-cli)? This should let us know if it's an issue with prettier-eslint or the extension.

@ownchoice
Copy link

eslint and next lint both work just fine, but prettier-eslint (from prettier-eslint-cli) throws the error.

@idahogurl
Copy link
Owner

@barroudjo Could you create an issue with pretter-eslint then?

@barroudjo
Copy link
Author

Yeah, I'll take care of that.

@ci-vamp
Copy link

ci-vamp commented Jul 5, 2023

FYI this has a resolution, see this comment for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants