eslint-config-ke
Version:
ESLint configuration used by sh-fe
87 lines • 2.4 kB
JavaScript
module.exports = {
extends: ["eslint:recommended", "react-app"],
rules: {
"arrow-parens": [2, "always"],
"func-style": [2, "expression"],
"no-useless-rename": [
2,
{
ignoreDestructuring: false,
ignoreImport: false,
ignoreExport: false,
},
],
"no-var": 2,
"prefer-arrow-callback": [
2,
{
allowNamedFunctions: false,
allowUnboundThis: true,
},
],
"prefer-const": [
2,
{
destructuring: "all",
ignoreReadBeforeAssign: true,
},
],
"prefer-destructuring": [
2,
{
VariableDeclarator: {
array: false,
object: true,
},
AssignmentExpression: {
array: true,
object: true,
},
},
{
enforceForRenamedProperties: false,
},
],
"no-array-constructor": 2,
"arrow-body-style": [2, "as-needed"],
"prefer-rest-params": 2,
"prefer-template": 2,
"line-comment-position": [
2,
{
position: "above",
ignorePattern: "",
applyDefaultPatterns: true,
},
],
"semi": 2, //强制使用分号
"semi-style": [2, "last"],
"eqeqeq": [2, "always"],
"no-new-object": 2,
"no-use-before-define": [2, { functions: true, classes: true, variables: true }],
"no-extend-native": 2,
"no-empty": 2,
"no-console": 1,
"no-trailing-spaces": 1, // 禁用行尾空格
"eol-last": 0, // 要求或禁止文件末尾存在空行
"no-underscore-dangle": 0, //禁止标识符中有悬空下划线
"no-alert":2, // 禁用 alert、confirm 和 prompt
"no-invalid-this": 0, //禁止无效的this,只能用在构造器,类,对象字面量
"comma-dangle": 0,
"react/jsx-key": 2, //在数组或迭代器中验证JSX具有key属性
"react/jsx-no-duplicate-props": 2, //防止在JSX中重复的props
"react/no-unknown-property": 2, //防止使用未知的DOM属性
"react/sort-comp": 2, //强制组件方法顺序
"react/no-deprecated": 1, //不使用弃用的方法
// 2020-10-22 强哥提供
"line-comment-position": 0,
"no-console": 0,
"func-style": 0,
"array-callback-return": 0,
"eqeqeq": 0,
"prefer-destructuring": 0,
"jsx-a11y/anchor-is-valid": 0,
"jsx-a11y/alt-text": 0,
"react/sort-comp": 0,
},
}