欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

linebreak_vue-cli构建的项目,eslint一直报CRLF/LF的linebreak错误

发布时间:2024/1/1 46 豆豆
生活随笔 收集整理的这篇文章主要介绍了 linebreak_vue-cli构建的项目,eslint一直报CRLF/LF的linebreak错误 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

如题,vue在构建项目的时候选择了airbnb规则,同时项目构建后被windows的unix bash工具pull并且push过,这之后在windows上进行开发,就开始一直报

Expected linebreaks to be 'CRLF' but found 'LF'

这样的错误,后经查是一种强制统一方式,并且解决方法是

linebreak-style: ["error", "windows"]

强制使用windows方式,我将之添加到了项目根目录下的 .eslintrc.js 文件中的rule字段下:

// add your custom rules here

'rules': {

// don't require .vue extension when importing

'import/extensions': ['error', 'always', {

'js': 'never',

'vue': 'never'

}],

// allow optionalDependencies

'import/no-extraneous-dependencies': ['error', {

'optionalDependencies': ['test/unit/index.js']

}],

// try to fix the line break problem

'linebreak-style': ["error", "windows"],

// allow debugger during development

'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0

}

结果无效,现有问题二个:

是否是因为系统环境不同而造成了某种强制转换才会引发如上的错误?

如何选择性的关闭eslint某个功能(linebreak检查)?

总结

以上是生活随笔为你收集整理的linebreak_vue-cli构建的项目,eslint一直报CRLF/LF的linebreak错误的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。