mirror of
				https://github.com/pure-admin/vue-pure-admin.git
				synced 2025-11-03 13:44:47 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			174 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			174 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import js from "@eslint/js";
 | 
						|
import tseslint from "typescript-eslint";
 | 
						|
import pluginVue from "eslint-plugin-vue";
 | 
						|
import * as parserVue from "vue-eslint-parser";
 | 
						|
import configPrettier from "eslint-config-prettier";
 | 
						|
import pluginPrettier from "eslint-plugin-prettier";
 | 
						|
import { defineConfig, globalIgnores } from "eslint/config";
 | 
						|
 | 
						|
export default defineConfig([
 | 
						|
  globalIgnores([
 | 
						|
    "**/.*",
 | 
						|
    "dist/*",
 | 
						|
    "*.d.ts",
 | 
						|
    "public/*",
 | 
						|
    "src/assets/**",
 | 
						|
    "src/**/iconfont/**"
 | 
						|
  ]),
 | 
						|
  {
 | 
						|
    ...js.configs.recommended,
 | 
						|
    languageOptions: {
 | 
						|
      globals: {
 | 
						|
        // types/index.d.ts
 | 
						|
        RefType: "readonly",
 | 
						|
        EmitType: "readonly",
 | 
						|
        TargetContext: "readonly",
 | 
						|
        ComponentRef: "readonly",
 | 
						|
        ElRef: "readonly",
 | 
						|
        ForDataType: "readonly",
 | 
						|
        AnyFunction: "readonly",
 | 
						|
        PropType: "readonly",
 | 
						|
        Writable: "readonly",
 | 
						|
        Nullable: "readonly",
 | 
						|
        NonNullable: "readonly",
 | 
						|
        Recordable: "readonly",
 | 
						|
        ReadonlyRecordable: "readonly",
 | 
						|
        Indexable: "readonly",
 | 
						|
        DeepPartial: "readonly",
 | 
						|
        Without: "readonly",
 | 
						|
        Exclusive: "readonly",
 | 
						|
        TimeoutHandle: "readonly",
 | 
						|
        IntervalHandle: "readonly",
 | 
						|
        Effect: "readonly",
 | 
						|
        ChangeEvent: "readonly",
 | 
						|
        WheelEvent: "readonly",
 | 
						|
        ImportMetaEnv: "readonly",
 | 
						|
        Fn: "readonly",
 | 
						|
        PromiseFn: "readonly",
 | 
						|
        ComponentElRef: "readonly",
 | 
						|
        parseInt: "readonly",
 | 
						|
        parseFloat: "readonly"
 | 
						|
      }
 | 
						|
    },
 | 
						|
    plugins: {
 | 
						|
      prettier: pluginPrettier
 | 
						|
    },
 | 
						|
    rules: {
 | 
						|
      ...configPrettier.rules,
 | 
						|
      ...pluginPrettier.configs.recommended.rules,
 | 
						|
      "no-debugger": "off",
 | 
						|
      "no-unused-vars": [
 | 
						|
        "error",
 | 
						|
        {
 | 
						|
          argsIgnorePattern: "^_",
 | 
						|
          varsIgnorePattern: "^_"
 | 
						|
        }
 | 
						|
      ],
 | 
						|
      "prettier/prettier": [
 | 
						|
        "error",
 | 
						|
        {
 | 
						|
          endOfLine: "auto"
 | 
						|
        }
 | 
						|
      ]
 | 
						|
    }
 | 
						|
  },
 | 
						|
  ...tseslint.config({
 | 
						|
    extends: [...tseslint.configs.recommended],
 | 
						|
    files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
 | 
						|
    rules: {
 | 
						|
      "@typescript-eslint/no-redeclare": "error",
 | 
						|
      "@typescript-eslint/ban-ts-comment": "off",
 | 
						|
      "@typescript-eslint/no-explicit-any": "off",
 | 
						|
      "@typescript-eslint/prefer-as-const": "warn",
 | 
						|
      "@typescript-eslint/no-empty-function": "off",
 | 
						|
      "@typescript-eslint/no-non-null-assertion": "off",
 | 
						|
      "@typescript-eslint/no-unused-expressions": "off",
 | 
						|
      "@typescript-eslint/no-unsafe-function-type": "off",
 | 
						|
      "@typescript-eslint/no-import-type-side-effects": "error",
 | 
						|
      "@typescript-eslint/explicit-module-boundary-types": "off",
 | 
						|
      "@typescript-eslint/consistent-type-imports": [
 | 
						|
        "error",
 | 
						|
        { disallowTypeAnnotations: false, fixStyle: "inline-type-imports" }
 | 
						|
      ],
 | 
						|
      "@typescript-eslint/prefer-literal-enum-member": [
 | 
						|
        "error",
 | 
						|
        { allowBitwiseExpressions: true }
 | 
						|
      ],
 | 
						|
      "@typescript-eslint/no-unused-vars": [
 | 
						|
        "error",
 | 
						|
        {
 | 
						|
          argsIgnorePattern: "^_",
 | 
						|
          varsIgnorePattern: "^_"
 | 
						|
        }
 | 
						|
      ]
 | 
						|
    }
 | 
						|
  }),
 | 
						|
  {
 | 
						|
    files: ["**/*.d.ts"],
 | 
						|
    rules: {
 | 
						|
      "eslint-comments/no-unlimited-disable": "off",
 | 
						|
      "import/no-duplicates": "off",
 | 
						|
      "no-restricted-syntax": "off",
 | 
						|
      "unused-imports/no-unused-vars": "off"
 | 
						|
    }
 | 
						|
  },
 | 
						|
  {
 | 
						|
    files: ["**/*.?([cm])js"],
 | 
						|
    rules: {
 | 
						|
      "@typescript-eslint/no-require-imports": "off"
 | 
						|
    }
 | 
						|
  },
 | 
						|
  {
 | 
						|
    files: ["**/*.vue"],
 | 
						|
    languageOptions: {
 | 
						|
      globals: {
 | 
						|
        $: "readonly",
 | 
						|
        $$: "readonly",
 | 
						|
        $computed: "readonly",
 | 
						|
        $customRef: "readonly",
 | 
						|
        $ref: "readonly",
 | 
						|
        $shallowRef: "readonly",
 | 
						|
        $toRef: "readonly"
 | 
						|
      },
 | 
						|
      parser: parserVue,
 | 
						|
      parserOptions: {
 | 
						|
        ecmaFeatures: {
 | 
						|
          jsx: true
 | 
						|
        },
 | 
						|
        extraFileExtensions: [".vue"],
 | 
						|
        parser: tseslint.parser,
 | 
						|
        sourceType: "module"
 | 
						|
      }
 | 
						|
    },
 | 
						|
    plugins: {
 | 
						|
      "@typescript-eslint": tseslint.plugin,
 | 
						|
      vue: pluginVue
 | 
						|
    },
 | 
						|
    processor: pluginVue.processors[".vue"],
 | 
						|
    rules: {
 | 
						|
      ...pluginVue.configs.base.rules,
 | 
						|
      ...pluginVue.configs.essential.rules,
 | 
						|
      ...pluginVue.configs.recommended.rules,
 | 
						|
      "no-undef": "off",
 | 
						|
      "no-unused-vars": "off",
 | 
						|
      "vue/no-v-html": "off",
 | 
						|
      "vue/require-default-prop": "off",
 | 
						|
      "vue/require-explicit-emits": "off",
 | 
						|
      "vue/multi-word-component-names": "off",
 | 
						|
      "vue/no-setup-props-reactivity-loss": "off",
 | 
						|
      "vue/html-self-closing": [
 | 
						|
        "error",
 | 
						|
        {
 | 
						|
          html: {
 | 
						|
            void: "always",
 | 
						|
            normal: "always",
 | 
						|
            component: "always"
 | 
						|
          },
 | 
						|
          svg: "always",
 | 
						|
          math: "always"
 | 
						|
        }
 | 
						|
      ]
 | 
						|
    }
 | 
						|
  }
 | 
						|
]);
 |