[英]Error " prettier/prettier: Delete `·· ` " while setting up prettier on vim
I created a NextJs project and I wanted to integrate Prettier ans Eslint to help me out.我创建了一个 NextJs 项目,我想集成 Prettier ans Eslint 来帮助我。 Here's my config files:
这是我的配置文件:
.prettierrc .prettierrc
{
"trailingComma": "es5",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"endOfLine": "auto"
}
.eslintrc .eslintrc
{
"plugins": ["prettier"],
"extends": ["prettier"],
"rules": {
"prettier/prettier": "error"
},
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
}
}
}
I also have a .editor config file我也有一个 .editor 配置文件
# EditorConfig is awesome: http://EditorConfig.org
2
3 # top-most EditorConfig file
4 root = true
5
6 # Unix-style newlines with a newline ending every file
7 [*]
8 end_of_line = lf
9 insert_final_newline = true
10 indent_style = space
11 indent_size = 4
12 charset = utf-8
13
14 [*.{js,json}]
15 indent_size = 2
16
17 [*.sql]
18 indent_size = 8
When save my files, I get the error保存文件时,出现错误
prettier/prettier: Delete `··`
Can someone help me out?有人可以帮我吗?
there is a conflict between .prettierrc
and .editorconfig
. .prettierrc
和.editorconfig
之间存在冲突。 ESLint will only follow what is in the .prettierrc
. ESLint 只会遵循
.prettierrc
中的.prettierrc
。 In your case, your file is following .editorconfig
rule (that overwrites what is in .prettierrc
) but your ESLint is following .prettierrc
rule.在您的情况下,您的文件遵循
.editorconfig
规则(覆盖.prettierrc
)但您的 ESLint 遵循.prettierrc
规则。
in your .prettierrc
,在你的
.prettierrc
,
"tabWidth": 2
in your .editorconfig
,在您的
.editorconfig
,
indent_size = 4
you can either set "tabWidth": 4
or remove indent_size = 4
to resolve the problem (depends on whether you prefer 2 or 4).您可以设置
"tabWidth": 4
或删除indent_size = 4
来解决问题(取决于您喜欢 2 还是 4)。
in fact these parameters in .editorconfig
实际上这些参数在
.editorconfig
end_of_line
indent_style
indent_size/tab_width
max_line_length
will conflict with these in .prettierrc
将与
.prettierrc
这些冲突
"endOfLine"
"useTabs"
"tabWidth"
"printWidth"
you can either let .editorconfig
to follow .prettierrc
default or sync both .editorconfig
and .prettierrc
for things to work properly.您可以让
.editorconfig
遵循.prettierrc
默认设置或同步.editorconfig
和.prettierrc
以使事情正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.