incompatibility with Next eslint config
See original GitHub issueprettier-eslint-cliversion: 6.0.1prettierversion: 2.7.1eslintversion: 8.18.0
Relevant code/config.
\\ .eslintrc.js
module.exports = {
extends: ['next', 'prettier'],
};
What you did:
I installed the latest version of prettier-eslint-cli (@6.0.1)
I launched it on a project using the above .eslintrc.js with the command npx prettier-eslint "src/**/*.js"
What happened:
prettier-eslint [ERROR]: eslint fix failed due to an eslint error
prettier-eslint-cli [ERROR]: There was an error formatting "/home/linuxpoutous/Ekwateur/edito-front/src/prismic-template/content/InteractiveBills/EnergyButton/EnergyButton.js":
TypeError [ERR_INVALID_ARG_VALUE]: 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:1218: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)
prettier-eslint [ERROR]: eslint fix failed due to an eslint error
prettier-eslint-cli [ERROR]: There was an error formatting "/home/linuxpoutous/Ekwateur/edito-front/src/prismic-template/content/InteractiveBills/EnergyButton/EnergyButton.styles.js":
TypeError [ERR_INVALID_ARG_VALUE]: 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 ''
Problem description:
My guess is that it is because the next eslint config is using @rushstack/eslint-patch which changes the way plugins are loaded. I found out about this issue when using vs-code-prettier-eslint, and raised an issue for this there (https://github.com/idahogurl/vs-code-prettier-eslint/issues/42), but since the problem lies with prettier-eslint, here is the relevant issue !
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
[eslint-config-next] Incompatible with eslint@8.0.0 #29829
I'm managing my own eslintrc.js and I have all dependencies versions strict (without ^). I've created this issue, cos I've tested updating ...
Read more >Unable to run eslint in Next.js - Stack Overflow
I tried running yarn add --dev eslint , but I still receive the same error after running the lint command. Edit: This is...
Read more >Basic Features: ESLint - Next.js
Next.js provides an integrated ESLint experience by default. These conformance rules help you use Next.js in the optimal way.
Read more >Lift-Off I Setup Client Error - eslint version incompatibility?
Hey there, I'm having an issue with eslint and running npm start in the client directory. While in /client directory in terminal, after...
Read more >eslint-config-standard-next - npm
Shareable configs are designed to work with the extends feature of .eslintrc files. You can learn more about Shareable Configs on the official ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@mattbrannon Sorry I was a bit busy these days, hope I can find some free time to invest today.
@JounQin Sure thing. In the example, the file at
pages/index.jshas this code with a long string of text:Problem: Running
prettier-eslinton this file throws an error:Expected:
prettier-eslintshould format the file without throwing an error.Steps to reproduce:
yarn formatoryarn prettier-eslint pages/.*jsThe eslint config is the default provided by Next.js. If the config is removed,
prettier-eslintformats the code as expected.