我有一个简单的例子,语句中没有分号。Prettier设置中的分号为false,但eslint的分号为true。为了避免它们之间的冲突,我安装了eslint-config-prettier。但我仍然在分号方面遇到了错误。它应该优先使用prettier的设置,但实际上并没有。
var var1, var2
var1 = 3
var2 = 4
var a = { name: "" }
"devDependencies": {
"eslint": "^7.8.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.1.1"
}
.prettierrcc
{
"arrowParens": "always",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 86,
"proseWrap": "preserve",
"quoteProps": "preserve",
"requirePragma": false,
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
.eslintrcc
{
"root": true,
"env": {
"node": true
},
"extends": ["prettier"],
"plugins": ["prettier"],
"rules": {
"semi": ["error", "always"],
"prettier/prettier": ["error"]
}
}
我遇到了以下错误:
/home/nick/Documents/Coding/NodeJs/simple-node/vanilla.js
1:17 error Missing semicolon semi
2:11 error Missing semicolon semi
3:9 error Missing semicolon semi
4:21 error Missing semicolon semi