【发布时间】:2020-07-08 11:19:47
【问题描述】:
在本地运行时,它似乎工作正常,但在管道上运行时崩溃
编辑:删除 npx 后,会产生不同的错误:
我已按照安装插件的建议:
npm install eslint-plugin-react@latest --save-dev
但会不断重复。
这是我收回的 bitbucket-pipelines.yml 配置:
- step:
name: CI
caches:
- node
script:
- npm install
- npm run lint
- npm run test
等同于 package.json
"lint": "eslint --ext .js,.ts,.tsx src --ignore-pattern node_modules/",
"test": "jest --verbose --colors --coverage",
这是我的 eslint 配置文件:
{
"env": {
"browser": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"airbnb"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ts", ".tsx"],
"paths": ["src"]
}
}
},
"rules": {
...
}
}
}
【问题讨论】:
-
为什么要使用
npx进行lint?包文件和安装步骤说什么,是那些插件安装了吗? -
我读到它旨在运行依赖项的本地版本而不是全局版本。对吗?
-
如果它是本地安装的,直接调用
"lint": "eslint ..."也可以。 -
它现在给了我一个不同的错误:i.imgur.com/eJJbu2F.png。我已关注并安装但无济于事
-
请在问题中输入minimal reproducible example。截图没用。
标签: npm continuous-integration eslint bitbucket-pipelines