1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
| 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"
| }
| ]
| }
| }
| ]);
|
|