Man*_*cal 6 javascript continuous-integration github eslint github-actions
我是第一次使用Github Actions 。我正在使用Vue-CLI并且我想创建一个作业来检查我的文件push并中断构建过程(如果有)ESLint'errors.
这是我package.json的脚本:
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
},
Run Code Online (Sandbox Code Playgroud)
这是我的.github/workflows/main.yml文件:
name: Lint files on push
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: npm install
- name: Run ESLint
run: npm run lint
Run Code Online (Sandbox Code Playgroud)
我使用这个模板作为灵感。正如您在下面的屏幕截图中看到的那样。该作业已成功完成,但它不会破坏构建或修复 linting。我究竟做错了什么?
您可以指定--no-fix它不会自动修复错误/警告并设置--max-warnings为0,因为您的项目中似乎有一个警告并希望将其视为错误。
在你的package.json:
{\n ....\n "scripts": {\n "lint": "vue-cli-service lint --no-fix --max-warnings 0",\n ....\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n日志输出:
\nwarning: Delete `\xe2\x8f\x8e\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7\xc2\xb7` (prettier/prettier) at src/components/QuestionInfo.vue:5:25:\n 3 | <div class="question_card container">\n 4 | <BaseTag\n> 5 | :class="[\'tag\', \n | ^\n 6 | \'p-5\', \'pb-0\', \'pl-0\', \'ml-5\']"\n 7 | :tag-name="this.tag"\n 8 | />\n\n\n1 warning found.\n1 warning potentially fixable with the `--fix` option.\nEslint found too many warnings (maximum: 0).\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4159 次 |
| 最近记录: |