简体   繁体   中英

What is the purpose of eslint-plugin-prettier?

I have installed airbnb style guide in my eslint config. So for airbnb it is recommended to use single quotes for strings. But by adding plugin:prettier/recommended in extends it disables single quotes. So how do I make sure that the rule is followed.

.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 }]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM