@alexlit/config-eslint 161.4.0 → 162.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +156 -106
- package/base.js +5 -3
- package/index.d.ts +112 -0
- package/index.js +79 -23
- package/package.json +19 -16
- package/plugins/de-morgan.js +9 -4
- package/plugins/import-x.js +50 -37
- package/plugins/javascript.js +96 -85
- package/plugins/jsdoc.js +24 -17
- package/plugins/json.js +31 -24
- package/plugins/perfectionist.js +108 -95
- package/plugins/pinia.js +17 -10
- package/plugins/prettier.js +24 -10
- package/plugins/regexp.js +16 -9
- package/plugins/sonar.js +19 -12
- package/plugins/stylistic.js +107 -100
- package/plugins/tailwindcss.js +17 -6
- package/plugins/tanstack-query.js +16 -9
- package/plugins/typescript-type-checked.js +38 -33
- package/plugins/typescript.js +23 -14
- package/plugins/unicorn.js +73 -64
- package/plugins/unocss.js +12 -5
- package/plugins/vitest.js +20 -13
- package/plugins/vue-accessibility.js +22 -13
- package/plugins/vue-i18n.js +38 -31
- package/plugins/vue.js +255 -242
- package/plugins/zod.js +17 -10
- package/rules/typescript.js +1 -1
package/plugins/vue.js
CHANGED
|
@@ -5,254 +5,267 @@ import typescript from 'typescript-eslint';
|
|
|
5
5
|
import { DATA_FILES, TEST_FILES, VUE_FILES } from '../base.js';
|
|
6
6
|
import { NO_RESTRICTED_SYNTAX } from '../rules/restricted-syntax.js';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Правила для Vue.js.
|
|
10
|
+
*
|
|
11
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
12
|
+
*
|
|
13
|
+
* @see [eslint-plugin-vue](https://eslint.vuejs.org/rules/)
|
|
14
|
+
*/
|
|
15
|
+
export const vue = () =>
|
|
16
|
+
defineConfig([
|
|
17
|
+
...plugin.configs['flat/recommended'].map((config) => ({
|
|
18
|
+
...config,
|
|
19
|
+
ignores: [...(config.ignores ?? []), ...DATA_FILES],
|
|
20
|
+
})),
|
|
14
21
|
|
|
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
|
-
'error',
|
|
56
|
-
'PascalCase',
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
'error',
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
22
|
+
{
|
|
23
|
+
files: VUE_FILES,
|
|
24
|
+
languageOptions: { parserOptions: { parser: typescript.parser } },
|
|
25
|
+
rules: {
|
|
26
|
+
'@typescript-eslint/no-empty-object-type': [
|
|
27
|
+
'error',
|
|
28
|
+
{ allowWithName: 'Props$' },
|
|
29
|
+
],
|
|
30
|
+
'no-restricted-syntax': [
|
|
31
|
+
'error',
|
|
32
|
+
// Merge the shared list, do not replace it
|
|
33
|
+
...NO_RESTRICTED_SYNTAX,
|
|
34
|
+
{
|
|
35
|
+
message:
|
|
36
|
+
'Запрещено использовать имя "Props". Используйте именованный формат, например: <ИмяКомпонента>Props.',
|
|
37
|
+
selector:
|
|
38
|
+
"TSInterfaceDeclaration[id.name='Props'], TSTypeAliasDeclaration[id.name='Props']",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
message:
|
|
42
|
+
'При вызове useRoute() переменная должна называться строго "$route" (const $route = useRoute()).',
|
|
43
|
+
selector:
|
|
44
|
+
'VariableDeclarator[init.callee.name="useRoute"][id.name!="$route"]',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
message:
|
|
48
|
+
'При вызове useRouter() переменная должна называться строго "$router" (const $router = useRouter()).',
|
|
49
|
+
selector:
|
|
50
|
+
'VariableDeclarator[init.callee.name="useRouter"][id.name!="$router"]',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
'vue/attributes-order': ['error', { alphabetical: true }],
|
|
54
|
+
'vue/block-lang': [
|
|
55
|
+
'error',
|
|
56
|
+
{ script: { lang: 'ts' }, style: {}, template: {} },
|
|
57
|
+
],
|
|
58
|
+
'vue/block-order': [
|
|
59
|
+
'error',
|
|
60
|
+
{ order: ['script', 'template', 'style'] },
|
|
61
|
+
],
|
|
62
|
+
'vue/component-api-style': ['error', ['script-setup']],
|
|
63
|
+
'vue/component-definition-name-casing': ['error', 'PascalCase'],
|
|
64
|
+
'vue/component-name-in-template-casing': [
|
|
65
|
+
'error',
|
|
66
|
+
'PascalCase',
|
|
67
|
+
{
|
|
68
|
+
ignores: [String.raw`/^[A-Z][a-zA-Z]*\.[A-Z][a-zA-Z]*$/`],
|
|
69
|
+
registeredComponentsOnly: false,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
'vue/component-options-name-casing': ['error', 'PascalCase'],
|
|
73
|
+
'vue/custom-event-name-casing': ['error', 'camelCase', { ignores: [] }],
|
|
74
|
+
'vue/define-emits-declaration': ['error'],
|
|
75
|
+
'vue/define-macros-order': [
|
|
76
|
+
'error',
|
|
77
|
+
{
|
|
78
|
+
defineExposeLast: true,
|
|
79
|
+
order: [
|
|
80
|
+
'definePageMeta', // nuxt
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
'defineProps',
|
|
83
|
+
'defineModel',
|
|
84
|
+
'defineEmits',
|
|
85
|
+
'defineOptions',
|
|
86
|
+
'defineSlots',
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
88
|
+
// nuxt (can use props)
|
|
89
|
+
'createUseAsyncData',
|
|
90
|
+
'createUseFetch',
|
|
81
91
|
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
'onPrehydrate',
|
|
93
|
+
// /nuxt (can use props)
|
|
84
94
|
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
'
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
'
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
'
|
|
228
|
-
'
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
95
|
+
// nuxi-ui
|
|
96
|
+
'defineLocale',
|
|
97
|
+
'defineShortcuts',
|
|
98
|
+
'extendLocale',
|
|
99
|
+
'extractShortcuts',
|
|
100
|
+
// /nuxi-ui
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
'vue/define-props-declaration': ['error'],
|
|
105
|
+
'vue/define-props-destructuring': [
|
|
106
|
+
'warn',
|
|
107
|
+
{ destructure: 'only-when-assigned' },
|
|
108
|
+
],
|
|
109
|
+
'vue/dot-notation': ['error'],
|
|
110
|
+
'vue/enforce-style-attribute': ['error', { allow: ['scoped'] }],
|
|
111
|
+
'vue/eqeqeq': ['error'],
|
|
112
|
+
'vue/html-button-has-type': ['error'],
|
|
113
|
+
'vue/html-comment-content-newline': ['warn'],
|
|
114
|
+
'vue/html-comment-content-spacing': ['warn'],
|
|
115
|
+
'vue/html-comment-indent': ['warn'],
|
|
116
|
+
'vue/html-end-tags': ['error'],
|
|
117
|
+
'vue/html-self-closing': [
|
|
118
|
+
'error',
|
|
119
|
+
{
|
|
120
|
+
html: { component: 'always', normal: 'never', void: 'always' },
|
|
121
|
+
math: 'always',
|
|
122
|
+
svg: 'always',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
// Keep in sync with `unicorn/filename-case` in `unicorn.js`:
|
|
126
|
+
// components live in kebab-case files, so the component name is
|
|
127
|
+
// derived from a kebab-case file name instead of being required to be
|
|
128
|
+
// PascalCase in the file name itself.
|
|
129
|
+
'vue/match-component-file-name': [
|
|
130
|
+
'error',
|
|
131
|
+
{ extensions: ['vue'], shouldMatchCase: false },
|
|
132
|
+
],
|
|
133
|
+
'vue/match-component-import-name': ['error'],
|
|
134
|
+
'vue/max-attributes-per-line': ['error', { singleline: 3 }],
|
|
135
|
+
'vue/max-lines-per-block': [
|
|
136
|
+
'warn',
|
|
137
|
+
{ script: 500, skipBlankLines: true, style: 500, template: 500 },
|
|
138
|
+
],
|
|
139
|
+
'vue/new-line-between-multi-line-property': 'off',
|
|
140
|
+
'vue/next-tick-style': ['error', 'promise'],
|
|
141
|
+
'vue/no-child-content': ['error'],
|
|
142
|
+
'vue/no-console': ['error'],
|
|
143
|
+
'vue/no-custom-modifiers-on-v-model': 'off',
|
|
144
|
+
'vue/no-deprecated-delete-set': ['error'],
|
|
145
|
+
'vue/no-deprecated-model-definition': ['error'],
|
|
146
|
+
'vue/no-deprecated-scope-attribute': ['error'],
|
|
147
|
+
'vue/no-deprecated-slot-attribute': ['error'],
|
|
148
|
+
'vue/no-deprecated-slot-scope-attribute': ['error'],
|
|
149
|
+
'vue/no-duplicate-attr-inheritance': ['error'],
|
|
150
|
+
'vue/no-duplicate-class-names': ['error'],
|
|
151
|
+
'vue/no-empty-component-block': ['error'],
|
|
152
|
+
'vue/no-import-compiler-macros': ['error'],
|
|
153
|
+
'vue/no-irregular-whitespace': ['error'],
|
|
154
|
+
'vue/no-loss-of-precision': ['error'],
|
|
155
|
+
'vue/no-multiple-objects-in-class': ['error'],
|
|
156
|
+
'vue/no-multiple-template-root': 'off',
|
|
157
|
+
'vue/no-negated-condition': ['error'],
|
|
158
|
+
'vue/no-negated-v-if-condition': ['error'],
|
|
159
|
+
'vue/no-parsing-error': ['error'],
|
|
160
|
+
'vue/no-potential-component-option-typo': ['error'],
|
|
161
|
+
'vue/no-ref-object-reactivity-loss': ['error'],
|
|
162
|
+
'vue/no-required-prop-with-default': ['error', { autofix: true }],
|
|
163
|
+
'vue/no-reserved-component-names': [
|
|
164
|
+
'error',
|
|
165
|
+
{
|
|
166
|
+
disallowVue3BuiltInComponents: true,
|
|
167
|
+
disallowVueBuiltInComponents: true,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
'vue/no-restricted-component-names': ['error'],
|
|
171
|
+
'vue/no-restricted-component-options': ['error'],
|
|
172
|
+
'vue/no-restricted-props': ['error'],
|
|
173
|
+
'vue/no-root-v-if': ['error'],
|
|
174
|
+
'vue/no-setup-props-reactivity-loss': ['error'],
|
|
175
|
+
'vue/no-shadow-native-events': ['error'],
|
|
176
|
+
'vue/no-static-inline-styles': ['error', { allowBinding: true }],
|
|
177
|
+
'vue/no-this-in-before-route-enter': ['error'],
|
|
178
|
+
'vue/no-undef-components': ['error'],
|
|
179
|
+
'vue/no-undef-directives': ['error'],
|
|
180
|
+
'vue/no-unsupported-features': ['error'],
|
|
181
|
+
'vue/no-unused-components': ['error'],
|
|
182
|
+
'vue/no-unused-emit-declarations': ['error'],
|
|
183
|
+
'vue/no-unused-properties': [
|
|
184
|
+
'error',
|
|
185
|
+
{ groups: ['inject', 'props', 'asyncData', 'computed', 'methods'] },
|
|
186
|
+
],
|
|
187
|
+
'vue/no-unused-refs': ['error'],
|
|
188
|
+
'vue/no-use-computed-property-like-method': ['error'],
|
|
189
|
+
'vue/no-use-v-else-with-v-for': ['warn'],
|
|
190
|
+
'vue/no-use-v-if-with-v-for': [
|
|
191
|
+
'warn',
|
|
192
|
+
{ allowUsingIterationVar: true },
|
|
193
|
+
],
|
|
194
|
+
'vue/no-useless-mustaches': ['error'],
|
|
195
|
+
'vue/no-useless-template-attributes': ['error'],
|
|
196
|
+
'vue/no-useless-v-bind': ['error'],
|
|
197
|
+
'vue/no-v-for-template-key': 'off',
|
|
198
|
+
'vue/no-v-html': ['error', { ignorePattern: '^html' }],
|
|
199
|
+
'vue/no-v-model-argument': 'off',
|
|
200
|
+
'vue/no-v-text': ['error'],
|
|
201
|
+
'vue/no-v-text-v-html-on-component': ['error'],
|
|
202
|
+
'vue/object-shorthand': ['error'],
|
|
203
|
+
'vue/order-in-components': 'off',
|
|
204
|
+
'vue/padding-line-between-blocks': ['error'],
|
|
205
|
+
'vue/padding-line-between-tags': [
|
|
206
|
+
'error',
|
|
207
|
+
[{ blankLine: 'always', next: '*', prev: '*' }],
|
|
208
|
+
],
|
|
209
|
+
'vue/padding-lines-in-component-definition': [
|
|
210
|
+
'error',
|
|
211
|
+
{ groupSingleLineProperties: true },
|
|
212
|
+
],
|
|
213
|
+
'vue/prefer-define-options': ['error'],
|
|
214
|
+
'vue/prefer-prop-type-boolean-first': ['error'],
|
|
215
|
+
'vue/prefer-separate-static-class': ['error'],
|
|
216
|
+
'vue/prefer-single-event-payload': ['error'],
|
|
217
|
+
'vue/prefer-true-attribute-shorthand': ['error'],
|
|
218
|
+
'vue/prefer-use-template-ref': ['error'],
|
|
219
|
+
'vue/prefer-v-model': ['error'],
|
|
220
|
+
'vue/quote-props': ['error', 'as-needed'],
|
|
221
|
+
'vue/require-direct-export': 'off',
|
|
222
|
+
'vue/require-explicit-slots': ['warn'],
|
|
223
|
+
'vue/require-macro-variable-name': [
|
|
224
|
+
'error',
|
|
225
|
+
{
|
|
226
|
+
defineEmits: '$emit',
|
|
227
|
+
defineProps: '$props',
|
|
228
|
+
defineSlots: '$slots',
|
|
229
|
+
useAttrs: '$attrs',
|
|
230
|
+
useSlots: '$slots',
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
'vue/require-typed-object-prop': ['error'],
|
|
234
|
+
'vue/require-typed-ref': ['error'],
|
|
235
|
+
'vue/slot-name-casing': ['error', 'kebab-case'],
|
|
236
|
+
'vue/sort-keys': 'off',
|
|
237
|
+
'vue/static-class-names-order': ['warn'],
|
|
238
|
+
'vue/this-in-template': ['error', 'never'],
|
|
239
|
+
'vue/v-bind-style': [
|
|
240
|
+
'error',
|
|
241
|
+
'shorthand',
|
|
242
|
+
{ sameNameShorthand: 'always' },
|
|
243
|
+
],
|
|
244
|
+
'vue/v-for-delimiter-style': ['error'],
|
|
245
|
+
'vue/v-if-else-key': ['error'],
|
|
246
|
+
'vue/v-on-event-hyphenation': ['error'],
|
|
247
|
+
'vue/v-on-handler-style': ['error', 'inline-function'],
|
|
248
|
+
'vue/valid-define-options': ['error'],
|
|
249
|
+
'vue/valid-next-tick': ['error'],
|
|
250
|
+
'vue/valid-v-bind-sync': ['error'],
|
|
251
|
+
'vue/valid-v-slot': ['error'],
|
|
252
|
+
},
|
|
239
253
|
},
|
|
240
|
-
},
|
|
241
254
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
255
|
+
{
|
|
256
|
+
files: ['**/*.ts', '**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
257
|
+
rules: { 'vue/order-in-components': 'off' },
|
|
258
|
+
},
|
|
246
259
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
260
|
+
{
|
|
261
|
+
files: [
|
|
262
|
+
'**/app/*.vue',
|
|
263
|
+
'**/src/*.vue',
|
|
264
|
+
'**/layouts/**/*.vue',
|
|
265
|
+
'**/pages/**/*.vue',
|
|
266
|
+
],
|
|
267
|
+
rules: { 'vue/multi-word-component-names': 'off' },
|
|
268
|
+
},
|
|
256
269
|
|
|
257
|
-
|
|
258
|
-
]);
|
|
270
|
+
{ files: TEST_FILES, rules: { 'vue/one-component-per-file': 'off' } },
|
|
271
|
+
]);
|
package/plugins/zod.js
CHANGED
|
@@ -3,14 +3,21 @@ import { defineConfig } from 'eslint/config';
|
|
|
3
3
|
|
|
4
4
|
import { FILES } from '../base.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Правила для Zod-схем.
|
|
8
|
+
*
|
|
9
|
+
* @returns {import('eslint').Linter.Config[]}
|
|
10
|
+
*
|
|
11
|
+
* @see [eslint-plugin-zod](https://github.com/marcalexiei/eslint-zod/tree/main/plugins/eslint-plugin-zod)
|
|
12
|
+
*/
|
|
13
|
+
export const zod = () =>
|
|
14
|
+
defineConfig([
|
|
15
|
+
{
|
|
16
|
+
...plugin.configs.recommended,
|
|
17
|
+
files: FILES,
|
|
18
|
+
rules: {
|
|
19
|
+
...plugin.configs.recommended.rules,
|
|
20
|
+
'zod/consistent-import': ['error', { syntax: 'named' }],
|
|
21
|
+
},
|
|
14
22
|
},
|
|
15
|
-
|
|
16
|
-
]);
|
|
23
|
+
]);
|
package/rules/typescript.js
CHANGED