There was trouble creating the ESLint CLIEngine. -
'basePath' should be an absolute path尝试使用eslint
$ npx prettier-eslint **/*.js但得到的是:
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.发布于 2020-02-07 05:09:40
这是由于使用选择文件时出现问题
**/*.js
目前的解决方法是:使用$PWD,即
$ npx prettier-eslint $PWD/'**/*.js'这将生成正确的文件作为输出
回复:https://github.com/prettier/prettier-eslint-cli/issues/208
这也适用于使用package.json的类似问题
例如,具有
"lint": "eslint . && prettier-eslint --list-different **/*.js",
"format": "prettier-eslint --write **/*.js"也会生成该错误。在Unix上,这个问题目前可以用$PWD修复。
"lint": "eslint . && prettier-eslint --list-different $PWD/'**/*.js'",
// /|\
"format": "prettier-eslint --write $PWD/'**/*.js'"
// /|\https://stackoverflow.com/questions/60103564
复制相似问题