在配置了Eslint和Prettier的ReactJS中添加Airbnb样式指南

时间:2018-07-18 17:36:09

标签: reactjs eslint prettier eslint-config-airbnb eslintrc

我试图为ReactJS应用设置 Airbnb样式指南。但是,它已经配置了eslintprettier

这是我的配置:

.eslintrc

{
  "extends": ["react-app", "prettier"],
  "rules": {
    "prettier/prettier": "error",
    "no-console": "warn"
  },
  "plugins": ["prettier"]
}

package.json

"scripts": {
    .
    .
    "precommit": "pretty-quick --staged"
  },
  "devDependencies": {
    "eslint-config-prettier": "^2.9.0",
    "eslint-plugin-prettier": "^2.6.2",
    "husky": "^0.14.3",
    "prettier": "^1.13.7",
    "pretty-quick": "^1.6.0"
  }
}

vscode设置:

"editor.formatOnSave": true,
"[javascript]": {
    "editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
"eslint.alwaysShowStatus": true,
"prettier.disableLanguages": [
    "js"
]

如何向其中添加Airbnb样式指南?

0 个答案:

没有答案