简体   繁体   English

LF或CRLF的Visual Studio代码安装eslint错误

[英]visual studio code install eslint error for LF or CRLF

cation:I test js-stack-from-scratch,my OS is windows.When I yarn start,it dead! 阳离子:我从头测试js-stack-from-scratch,我的操作系统是Windows。当我启动纱线时,它死了! 在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

I know that the line-break-style of OS 'unix' or 'windows' is different, that make the error. 我知道OS'unix'或'windows'的换行样式不同,这会导致错误。 but how to deal it? 但是如何处理呢? My IDE is VSC. 我的IDE是VSC。 pageage 'gulp-eslint' is yarn add. 分页'gulp-eslint'是纱线添加。

There are two ways you can achieve this. 有两种方法可以实现此目的。 In both ways the objective is to change the linebreak style rule for eslint. 两种方式的目标都是更改eslint的换行样式规则。

  1. Add /*eslint linebreak-style: ["error", "windows"]*/ to the top of your file. 在文件顶部添加/*eslint linebreak-style: ["error", "windows"]*/ This will only remove the error from the specific file you add this code to. 这只会从您添加此代码的特定文件中删除错误。

  2. The more long term solution is the modify the code in the eslint.json file of your project. 较长期的解决方案是修改项目的eslint.json文件中的代码。 In general from the root of your project, you should find it in the root directory of your project named .eslint.json . 通常,从项目的根目录开始,应该在名为.eslint.json的项目的根目录中找到它。 Add the following code: 添加以下代码:

, "rules": { "linebreak-style": 0 }

The comma is for the line above it after the closing bracket of whatever other parameter is in the file. 逗号用于文件上方任何其他参数的右括号后的行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM