xbx 1 vecka sedan
förälder
incheckning
6c9e0ee6ca
2 ändrade filer med 24 tillägg och 7 borttagningar
  1. 18 7
      config/eslint.config.mjs
  2. 6 0
      src/config/axios/errorCode.ts

+ 18 - 7
config/eslint.config.mjs

@@ -17,6 +17,9 @@ export default defineConfigWithVueTs(
   {
     name: 'app/files-to-lint',
     files: ['**/*.{ts,mts,tsx,vue}'],
+    rules: {
+      '@typescript-eslint/ban-ts-comment': 'off', // 彻底关闭 ts-comment 警告
+    }
   },
   globalIgnores([
     // 构建输出
@@ -84,8 +87,16 @@ export default defineConfigWithVueTs(
         ...globals.node,
         // 添加全局变量
         defineOptions: 'readonly', // 允许使用 defineOptions
-      } 
-    } 
+      },
+      parserOptions: {
+        ecmaFeatures: {
+          jsx: true
+        }
+      }
+    },
+    linterOptions: {
+      reportUnusedDisableDirectives: false
+    }
   },
   // Vue规则配置
   pluginVue.configs['flat/essential'],
@@ -93,6 +104,9 @@ export default defineConfigWithVueTs(
   eslintConfigPrettier,
   {
     rules: {
+      // 禁用烦人的 ts-comment 警告
+      '@typescript-eslint/ban-ts-comment': 'off',
+      
       // Vue特定规则
       'vue/multi-word-component-names': 'off', // 关闭组件名必须是多词的规则
       'vue/no-unused-vars': 'off', // 关闭未使用变量的警告
@@ -103,21 +117,18 @@ export default defineConfigWithVueTs(
           component: 'always'
         }
       }],
-      'vue/max-attributes-per-line': ['warn', {
-        singleline: 3,
-        multiline: 1
-      }],
+      'vue/max-attributes-per-line': 'off', // 关闭每行最大属性数量限制
       // 通用规则
       'no-console': 'off', // 关闭控制台语句的警告
       'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
       '@typescript-eslint/no-require-imports': 'off', // 允许 require 导入
-      '@typescript-eslint/ban-ts-comment': 'off', // 关闭 ts-comment 警告
     }
   },
   // TypeScript规则配置
   vueTsConfigs.recommended,
   {
     rules: {
+      '@typescript-eslint/ban-ts-comment': 'off', // 彻底关闭 ts-comment 警告
       '@typescript-eslint/explicit-function-return-type': 'off',
       '@typescript-eslint/explicit-module-boundary-types': 'off',
       '@typescript-eslint/no-explicit-any': 'off', // 关闭 any 类型的警告

+ 6 - 0
src/config/axios/errorCode.ts

@@ -0,0 +1,6 @@
+export default {
+  '401': '认证失败,无法访问系统资源',
+  '403': '当前操作没有权限',
+  '404': '访问资源不存在',
+  default: '系统未知错误,请反馈给管理员'
+}