eslint - Github 操作抛出 eslint 错误但在本地构建成功
问题描述
我是 Github 操作的新手。我正在尝试通过 Github Action 将我的 Vue.js 项目部署到 Azure 静态 Web 应用程序。
部署时会引发 eslint 错误,但是当我在 Windows 上本地执行 eslint fix 时,它说没有什么可修复的。该项目几乎是全新的,只是添加了一些额外的设置(包括换行设置),这是我的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?我缺少一些设置吗?
到目前为止我尝试了什么:
- 将 github 文件夹添加到 eslintignore
- 更改了 npm run lint 的内容以修复
先感谢您。
解决方案
推荐阅读
- java - Spring Cloud Config Server:错误:没有这样的标签:master
- video-streaming - 如何解决使用 SimpleWebRTC 直播视频的问题?
- ios - MacOS Catalina Simulators 屏幕保护程序捕获相同的屏幕
- sql - 选择特定列中重复值最多的行
- tensorflow - 说卷积实现是基于 GEMM(矩阵乘法)还是基于 1x1 内核是什么意思?
- laravel - 在 Laravel 8 项目上安装 hyn/多租户时出错
- ubuntu - Kubernetes:如何设置作业 / pod 的最短生命周期?
- minecraft - Minecraft Education 不会始终如一地运行代码
- c# - c#如何为序列化指定自定义接口
- html - “C++”而不是“C++”会阻碍搜索引擎索引吗?