![](/img/trans.png)
[英]Failed to load plugin 'prettier' declared in '.eslintrc.json': Cannot find module 'eslint-plugin-prettier'
[英]What is the purpose of eslint-plugin-prettier?
我已经在我的 eslint 配置中安装了 airbnb 风格指南。 所以对于airbnb,建议对字符串使用单引号。 但是通过在扩展中添加 plugin:prettier/recommended 会禁用单引号。 那么我如何确保遵守规则。
.eslintrc.json
{
"env": {
"browser": true,
"es2021": true,
"jest": true
},
"extends": [
"eslint:recommended",
"airbnb-base",
"airbnb",
"plugin:prettier/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": 0,
"no-unused-vars": "error",
"no-console": "error",
"import/prefer-default-export": 0
}
}
你应该能够在规则中覆盖
"rules": {
'prettier/prettier': ['error', { singleQuote: true }]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.