Github动作抛出eslint错误,但本地构建成功

时间:2020-10-09 15:04:03

标签: eslint github-actions

我不熟悉Github动作。我正在尝试通过Github Action将Vue.js项目部署到Azure静态Web应用。

在部署它时会抛出eslint错误,但是当我在Windows上本地执行eslint修复时,它说没有要修复的东西。该项目几乎是全新的,只是添加了一些额外的设置(包括换行设置),这是我的eslint设置。

module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    'plugin:vue/essential',
    '@vue/airbnb',
  ],
  parserOptions: {
    parser: 'babel-eslint',
  },
  rules: {
    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
    'eol-last': 0,
    'linebreak-style': ['error', 'windows'],
    "indent": [2, 2],
  },
};

我阅读了这篇文章,并且正在使用airbnb设置,但是应该没问题,因为我用'linebreak-style'覆盖了规则:['error','windows']?

https://github.com/airbnb/javascript/pull/1224

Current runner version: '2.273.5'
Operating System
  Ubuntu
  18.04.5
  LTS
...
messageboard@0.1.0 build /github/workspace
vue-cli-service build

-  Building for production...
 ERROR  Build failed with errors.
 ERROR  Failed to compile with 7 errors2:31:51 PM

 error  in ./src/App.vue

Module Error (from ./node_modules/eslint-loader/index.js):

/github/workspace/src/App.vue
   1:11  error  Expected linebreaks to be 'CRLF' but found 'LF'  linebreak-style
   2:17  error  Expected linebreaks to be 'CRLF' but found 'LF'  linebreak-style
   3:19  error  Expected linebreaks to be 'CRLF' but found 'LF'  linebreak-style

有关整个错误日志,请参见:https://github.com/simari1/MessageBoard/runs/1231832137?check_suite_focus=true

问题似乎是我的电脑是Windows,但构建服务器是Ubuntu?我缺少某些设置吗?

到目前为止我尝试过的事情:

  • 在eslintignore中添加了github foloder
  • 更改了npm run lint的内容以进行修复

谢谢。

0 个答案:

没有答案