[Error] There was trouble creating the ESLint CLIEngine
See original GitHub issueHello !
First of all, thanks for this amazing project, I love it 😃
Context : I’m using prettier-standard
with husky
and lint-staged
. Relevant parts of package.json :
{
"name": "client",
"version": "1.0.0",
"private": true,
"devDependencies": {
"husky": "^0.13.2",
"lint-staged": "^3.4.0",
"prettier-standard": "^1.0.4",
"react-scripts": "^0.8.4"
},
"dependencies": {
...
},
"scripts": {
...
"precommit": "lint-staged"
},
"lint-staged": {
"gitDir": "../",
"linters": {
"client/src/**/*.js": [
"prettier-standard",
"git add"
]
}
},
"proxy": "http://localhost:8080"
}
I don’t know if it’s relevant, but my git repository contains two folders : client and server. Server is a Java spring boot application, and client contains the package.json above (hence the ‘gitDir’ option and the linter pattern)
When I run yarn run precommit
, I get the following error :
yarn run v0.20.3
$ lint-staged
❯ Running tasks for client/src/**/*.js
→ failure formatting 1 file with prettier-standard
✖ prettier-standard
→ failure formatting 1 file with prettier-standard
git add
🚫 prettier-standard found some errors. Please fix them and try committing again.
prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine. Is "eslintPath: /home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-standard/node_modules/eslint" a correct path to the ESLint module?
prettier-standard [ERROR]: There was an error formatting "/home/benoit/Documents/YR/ihm-address-control/client/src/index.js":
Error: Cannot find module '/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-standard/node_modules/eslint'
at Function.Module._resolveFilename (module.js:472:15)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at getESLintCLIEngine (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-eslint/dist/index.js:219:20)
at getConfig (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-eslint/dist/index.js:187:22)
at format (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-eslint/dist/index.js:78:54)
at MapSubscriber.rxReadFile.map.text [as project] (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/prettier-standard/lib/format-files.js:242:55)
at MapSubscriber._next (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/home/benoit/Documents/YR/ihm-address-control/client/node_modules/rxjs/Subscriber.js:89:18)
failure formatting 1 file with prettier-standard
I’m guessing the problem commes from prettier-standard because the path it’s complaining about is in prettier-standard, but I could be wrong.
The problem is that eslint is included both by prettier-standard and prettier-eslint, so yarn doesn’t put it in the prettier-standard node_modules folder. I found a workaround by adding an old version of prettier-eslint in my package.json, so that the current version end up in the folder that causes the error.
Do you know what might be causng this ? I looked in the code a bit, and it seems this line should find the correct path, but it doesn’t for some reason.
Is there an option that I can give to prettier-standard to avoid this, or is there a bug ?
Thanks in advance
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:16 (6 by maintainers)
Top GitHub Comments
Oops, this is broken again in
6.0.0
, but works in5.1.0
I’m experiencing the same issue on version 9.0.1