安装了prettier,eslint-plugin-vue,eslint,这三个插件,vue项目开启了实时校验eslint,一保存就报错:
Error: Failed to load plugin 'prettier' declared in 'e:\vvan\project\ht_agent_mobile\.eslintrc.js': Cannot find module 'eslint-plugin-prettier'
// eslint配置
module.exports = {
root: true,
env: {
node: true,
},
globals: {
$api: true,
$config: true,
$utils: true,
},
extends: [
"plugin:vue/essential",
"eslint:recommended",
"plugin:prettier/recommended",
],
parserOptions: {
parser: "@babel/eslint-parser",
// 允许任意位置导入导出
// allowImportExportEverywhere: true,
},
// off 0 warn 1 error 2 - always never
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": "warn", // 未使用的变量,显示警告
semi: [2, "never"],
"prettier/prettier": [
"error",
{
semi: false,
// 忽略git的自动追加的CR 换行符号
endOfLine: "auto",
// 使结束标签不换行
htmlWhitespaceSensitivity: "ignore",
},
],
},
}
0 个回复