[英]What is the purpose of eslint-plugin-prettier?
I have installed airbnb style guide in my eslint config.我已经在我的 eslint 配置中安装了 airbnb 风格指南。 So for airbnb it is recommended to use single quotes for strings.
所以对于airbnb,建议对字符串使用单引号。 But by adding plugin:prettier/recommended in extends it disables single quotes.
但是通过在扩展中添加 plugin:prettier/recommended 会禁用单引号。 So how do I make sure that the rule is followed.
那么我如何确保遵守规则。
.eslintrc.json .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
}
}
you should be able to override in the rules你应该能够在规则中覆盖
"rules": {
'prettier/prettier': ['error', { singleQuote: true }]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.