There was trouble creating the ESLint CLIEngine. -
'basePath' should be an absolute path
Trying to use eslint
$ npx prettier-eslint **/*.js
but getting:
prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine.
prettier-eslint-cli [ERROR]: There was an error formatting "test/fizzBuzz.test.js":
AssertionError [ERR_ASSERTION]: 'basePath' should be an absolute path.
**/*.js
A current UNIX workaround: use $PWD
, i.e.
$ npx prettier-eslint $PWD/'**/*.js'
This produced correct files as output
re: https://github.com/prettier/prettier-eslint-cli/issues/208
This also applies to similar issues using package.json
for instance having
"lint": "eslint . && prettier-eslint --list-different **/*.js",
"format": "prettier-eslint --write **/*.js"
will also generate that error.
On Unix this can currently be fixed with $PWD
"lint": "eslint . && prettier-eslint --list-different $PWD/'**/*.js'",
// /|\
"format": "prettier-eslint --write $PWD/'**/*.js'"
// /|\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With