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
| // ESLint 检查 .vue 文件需要单独配置编辑器:
| // https://eslint.vuejs.org/user-guide/#editor-integrations
| {
| "root": true,
|
| "env": {
| "node": true
| },
|
| // "extends": ["taro/vue3"]
|
| "extends": [
| "plugin:vue/vue3-essential",
| "eslint:recommended",
| "plugin:@typescript-eslint/recommended",
|
| "prettier",
| "@vue/prettier",
| "@vue/eslint-config-typescript",
| "./.eslintrc-auto-import.json"
| ],
| "parser": "vue-eslint-parser",
| "parserOptions": {
| "parser": "@typescript-eslint/parser",
| "ecmaVersion": "latest",
| "sourceType": "module",
| "jsxPragma": "React",
| "ecmaFeatures": {
| "jsx": true
| }
| },
| "plugins": ["vue", "@typescript-eslint", "prettier"],
| "globals": {
| "wx": "readonly",
| "CLIENT_ID": "readonly",
|
| // script setup
| "defineProps": "readonly",
| "defineEmits": "readonly",
| "defineExpose": "readonly",
| "withDefaults": "readonly",
| "API": true,
| "PropType": true,
| "WeMapModel": true,
| "uni": true
| },
| "rules": {
| "prettier/prettier": [
| "error",
| {
| // 一行最多 100 字符
| "printWidth": 100,
| // 使用 4 个空格缩进
| "tabWidth": 2,
| // 不使用缩进符,而使用空格
| "useTabs": false,
| // 行尾不需要有分号
| "semi": true,
| // 使用单引号
| "singleQuote": true,
| // 对象的 key 仅在必要时用引号
| "quoteProps": "as-needed",
| // jsx 不使用单引号,而使用双引号
| "jsxSingleQuote": false,
| // 尾随逗号
| "trailingComma": "es5",
| // 大括号内的首尾需要空格
| "bracketSpacing": true,
| // jsx 标签的反尖括号需要换行
| "jsxBracketSameLine": false,
| // 箭头函数,只有一个参数的时候,也需要括号
| "arrowParens": "always",
| // 每个文件格式化的范围是文件的全部内容
| "rangeStart": 0,
| // 不需要写文件开头的 @prettier
| "requirePragma": false,
| // 不需要自动在文件开头插入 @prettier
| "insertPragma": false,
| // 使用默认的折行标准
| "proseWrap": "preserve",
| // 根据显示样式决定 html 要不要折行
| "htmlWhitespaceSensitivity": "css",
| // 换行符使用 lf
| "endOfLine": "auto"
| }
| ],
| "no-debugger": "error",
| "comma-dangle": [
| "error",
| {
| "arrays": "always-multiline",
| "objects": "always-multiline",
| "imports": "always-multiline",
| "exports": "always-multiline",
| "functions": "never"
| }
| ],
| "vue/no-use-v-if-with-v-for": 0,
| "vue/multi-word-component-names": "off",
| "@typescript-eslint/no-explicit-any": ["off"], //禁止使用any
| "@typescript-eslint/explicit-module-boundary-types": "off", // setup()
| "@typescript-eslint/ban-types": "off",
| "@typescript-eslint/ban-ts-comment": "off",
| "@typescript-eslint/no-empty-function": "off",
| "@typescript-eslint/no-non-null-assertion": "off",
| "@typescript-eslint/no-namespace": "off",
| "@typescript-eslint/no-var-requires": "off",
| // note you must disable the base rule as it can report incorrect errors
| "@typescript-eslint/no-unused-vars": 0,
| "no-unused-vars": 0,
| "vue/no-unused-vars": 0,
| "eqeqeq": 2, //必须使用全等
| "max-lines": ["error", 600], //限制行数 请勿修改 请优化你的代码
| "complexity": ["error", 18], // 限制复杂度
| "require-await": "error",
| "no-useless-catch": 0,
| "no-empty": 0,
| "no-async-promise-executor": 0,
| "prefer-const": 0,
| "no-case-declarations": 0,
| "vue/no-parsing-error": [
| "error",
| {
| "x-invalid-end-tag": false
| }
| ]
| }
| }
|
|