lanjianrong 5 лет назад
Родитель
Сommit
1d5a8efbbe
1 измененных файлов с 34 добавлено и 20 удалено
  1. 34 20
      .eslintrc.js

+ 34 - 20
.eslintrc.js

@@ -1,22 +1,36 @@
+// eslint-disable-next-line no-undef
 module.exports = {
-    "env": {
-        "browser": true,
-        "es2021": true
-    },
-    "extends": [
-        "eslint:recommended",
-        "plugin:react/recommended"
+  // eslint-disable-next-line no-undef
+  extends: [require.resolve('@umijs/fabric/dist/eslint')],
+  globals: {
+    ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
+    page: true,
+    REACT_APP_ENV: true
+  },
+  rules: {
+    semi: ['error', 'never'],
+    'no-multiple-empty-lines': [1, { max: 2 }],
+    'no-use-before-define': 'off',
+    'comma-dangle': [2, 'never'],
+    'react/prop-types': 0,
+    'spaced-comment': 'error',
+    'react/no-array-index-key': 0,
+    // 'array-bracket-spacing': ['error', 'always'], // 和prettier冲突
+    'object-curly-spacing': ['error', 'always'],
+    // 'no-use-before-define': ['error', { functions: false }], // 允许在未定义function前调用
+    'react/self-closing-comp': [
+      'error',
+      {
+        component: true,
+        html: true
+      }
     ],
-    "parserOptions": {
-        "ecmaFeatures": {
-            "jsx": true
-        },
-        "ecmaVersion": 12,
-        "sourceType": "module"
-    },
-    "plugins": [
-        "react"
-    ],
-    "rules": {
-    }
-};
+    'react-hooks/exhaustive-deps': 0,
+    'no-unused-expressions': [
+      'error',
+      {
+        allowShortCircuit: true
+      }
+    ]
+  }
+}