Skip to content

Instantly share code, notes, and snippets.

@xfanwu
Last active August 30, 2018 10:04
Show Gist options
  • Save xfanwu/b6281300883811759a7c7641f367d5a7 to your computer and use it in GitHub Desktop.
Save xfanwu/b6281300883811759a7c7641f367d5a7 to your computer and use it in GitHub Desktop.
fgg eslintrc standard
module.exports = {
"env": {
"node": true,
"mocha": true
},
"extends": ["standard", "eslint:recommended"],
"rules": {
"prefer-const": ["error", { // 优先使用 const 来声明变量
"destructuring": "any",
"ignoreReadBeforeAssign": true
}],
"no-console": ["error", { "allow": ["info", "warn", "error"] }], // 禁止使用 console.log
"no-underscore-dangle": 0,
"quotes": [2, "single", "avoid-escape"], // 字符串优先使用单引号, 单双引号互相嵌套除外
"no-var": 2, // 禁止使用 var 声明变量
"no-unused-vars": ["error", { "varsIgnorePattern": "should$|[iI]gnored" }], // 禁止未使用的变量
"camelcase": ["error"], // 禁止使用'-'、'_'作为变量名分词符号
"indent": ["error", 4], // 缩进为4个空格,禁止 tab
"comma-dangle": 1, // 警告:数组、对象中末项不保留逗号
"max-len": 1, // 警告:每行最长字符数不超过80
"no-multi-str": 1, // 警告:不使用多行字符串
"global-require": 1, // 警告:不使用局部引入
"no-mixed-operators": 1 // 警告:与非判断时没有使用括号隔开
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment