Skip to content

Commit

Permalink
add code style config files
Browse files Browse the repository at this point in the history
  • Loading branch information
meikidd committed Dec 7, 2017
1 parent 4335c24 commit 2551d1c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
// 基于 airbnb 规则
"extends": "airbnb",
// 使用 babel 解析器,支持一些还没有进入 ES6+ 标准的特性。比如 class property
"parser": "babel-eslint",
// 解析 webpack alias 中的模块名
"settings": {
"import/resolver": "webpack"
},
"env": {
"browser": true
},
"rules": {
"no-plusplus": [
"error",
{
// 允许 for 循环中的 i++
"allowForLoopAfterthoughts": true
}
],
"no-param-reassign": [
"error",
{
// 允许修改参数的属性
"props": false
}
],
// 允许在循环里使用 await
"no-await-in-loop": 0,
// 允许在一个表达式里使用多种操作符,否则与 prettier 冲突
// see https://github.com/prettier/eslint-config-prettier#no-mixed-operators
"no-mixed-operators": 0,
// 允许在 jsx 中使用 bind
"react/jsx-no-bind": 0,
// 允许所有类型的 proptype
"react/forbid-prop-types": 0
}
}
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"eslint.enable": true,
"eslint.packageManager": "yarn",
"prettier.eslintIntegration": true
}

0 comments on commit 2551d1c

Please sign in to comment.