@db-ux/core-eslint-plugin 0.0.0 → 4.4.2-eslint-plugin2-696cb23
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/CHANGELOG.md +1 -0
- package/README.md +843 -0
- package/build/index.d.ts +352 -0
- package/build/index.js +82 -0
- package/build/rules/accordion/accordion-item-headline-required.d.ts +16 -0
- package/build/rules/accordion/accordion-item-headline-required.js +61 -0
- package/build/rules/accordion/no-nested-accordion.d.ts +16 -0
- package/build/rules/accordion/no-nested-accordion.js +54 -0
- package/build/rules/badge/badge-corner-placement-rules.d.ts +18 -0
- package/build/rules/badge/badge-corner-placement-rules.js +114 -0
- package/build/rules/badge/badge-no-inline-in-interactive.d.ts +17 -0
- package/build/rules/badge/badge-no-inline-in-interactive.js +129 -0
- package/build/rules/button/button-no-text-requires-tooltip.d.ts +18 -0
- package/build/rules/button/button-no-text-requires-tooltip.js +109 -0
- package/build/rules/button/button-single-icon-attribute.d.ts +16 -0
- package/build/rules/button/button-single-icon-attribute.js +49 -0
- package/build/rules/button/button-type-required.d.ts +17 -0
- package/build/rules/button/button-type-required.js +58 -0
- package/build/rules/close-button/close-button-text-required.d.ts +16 -0
- package/build/rules/close-button/close-button-text-required.js +38 -0
- package/build/rules/content/text-or-children-required.d.ts +16 -0
- package/build/rules/content/text-or-children-required.js +47 -0
- package/build/rules/form/form-label-required.d.ts +16 -0
- package/build/rules/form/form-label-required.js +45 -0
- package/build/rules/form/form-validation-message-required.d.ts +16 -0
- package/build/rules/form/form-validation-message-required.js +91 -0
- package/build/rules/header/header-burger-menu-label-required.d.ts +16 -0
- package/build/rules/header/header-burger-menu-label-required.js +43 -0
- package/build/rules/icon/prefer-icon-attribute.d.ts +17 -0
- package/build/rules/icon/prefer-icon-attribute.js +82 -0
- package/build/rules/input/input-file-type-validation.d.ts +18 -0
- package/build/rules/input/input-file-type-validation.js +50 -0
- package/build/rules/input/input-type-required.d.ts +17 -0
- package/build/rules/input/input-type-required.js +54 -0
- package/build/rules/link/link-external-security.d.ts +19 -0
- package/build/rules/link/link-external-security.js +166 -0
- package/build/rules/navigation/navigation-item-back-button-text-required.d.ts +16 -0
- package/build/rules/navigation/navigation-item-back-button-text-required.js +43 -0
- package/build/rules/select/custom-select-tags-remove-text-required.d.ts +16 -0
- package/build/rules/select/custom-select-tags-remove-text-required.js +33 -0
- package/build/rules/select/select-requires-options.d.ts +16 -0
- package/build/rules/select/select-requires-options.js +45 -0
- package/build/rules/tag/tag-removable-remove-button-required.d.ts +16 -0
- package/build/rules/tag/tag-removable-remove-button-required.js +49 -0
- package/build/rules/tooltip/no-interactive-tooltip-content.d.ts +15 -0
- package/build/rules/tooltip/no-interactive-tooltip-content.js +49 -0
- package/build/rules/tooltip/tooltip-requires-interactive-parent.d.ts +15 -0
- package/build/rules/tooltip/tooltip-requires-interactive-parent.js +47 -0
- package/build/shared/constants.d.ts +58 -0
- package/build/shared/constants.js +98 -0
- package/build/shared/utils.d.ts +54 -0
- package/build/shared/utils.js +178 -0
- package/package.json +37 -1
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
declare const plugin: {
|
|
2
|
+
meta: {
|
|
3
|
+
name: string;
|
|
4
|
+
version: string;
|
|
5
|
+
};
|
|
6
|
+
rules: {
|
|
7
|
+
'button-no-text-requires-tooltip': {
|
|
8
|
+
meta: {
|
|
9
|
+
type: string;
|
|
10
|
+
docs: {
|
|
11
|
+
description: string;
|
|
12
|
+
url: string;
|
|
13
|
+
};
|
|
14
|
+
fixable: string;
|
|
15
|
+
messages: {
|
|
16
|
+
[x: string]: string;
|
|
17
|
+
};
|
|
18
|
+
schema: never[];
|
|
19
|
+
};
|
|
20
|
+
create(context: any): any;
|
|
21
|
+
};
|
|
22
|
+
'button-type-required': {
|
|
23
|
+
meta: {
|
|
24
|
+
type: string;
|
|
25
|
+
docs: {
|
|
26
|
+
description: string;
|
|
27
|
+
url: string;
|
|
28
|
+
};
|
|
29
|
+
fixable: string;
|
|
30
|
+
messages: {
|
|
31
|
+
[x: string]: string;
|
|
32
|
+
};
|
|
33
|
+
schema: never[];
|
|
34
|
+
};
|
|
35
|
+
create(context: any): any;
|
|
36
|
+
};
|
|
37
|
+
'button-single-icon-attribute': {
|
|
38
|
+
meta: {
|
|
39
|
+
type: string;
|
|
40
|
+
docs: {
|
|
41
|
+
description: string;
|
|
42
|
+
url: string;
|
|
43
|
+
};
|
|
44
|
+
messages: {
|
|
45
|
+
[x: string]: string;
|
|
46
|
+
};
|
|
47
|
+
schema: never[];
|
|
48
|
+
};
|
|
49
|
+
create(context: any): any;
|
|
50
|
+
};
|
|
51
|
+
'form-label-required': {
|
|
52
|
+
meta: {
|
|
53
|
+
type: string;
|
|
54
|
+
docs: {
|
|
55
|
+
description: string;
|
|
56
|
+
url: string;
|
|
57
|
+
};
|
|
58
|
+
messages: {
|
|
59
|
+
[x: string]: string;
|
|
60
|
+
};
|
|
61
|
+
schema: never[];
|
|
62
|
+
};
|
|
63
|
+
create(context: any): any;
|
|
64
|
+
};
|
|
65
|
+
'form-validation-message-required': {
|
|
66
|
+
meta: {
|
|
67
|
+
type: string;
|
|
68
|
+
docs: {
|
|
69
|
+
description: string;
|
|
70
|
+
url: string;
|
|
71
|
+
};
|
|
72
|
+
messages: {
|
|
73
|
+
[x: string]: string;
|
|
74
|
+
};
|
|
75
|
+
schema: never[];
|
|
76
|
+
};
|
|
77
|
+
create(context: any): any;
|
|
78
|
+
};
|
|
79
|
+
'prefer-icon-attribute': {
|
|
80
|
+
meta: {
|
|
81
|
+
type: string;
|
|
82
|
+
docs: {
|
|
83
|
+
description: string;
|
|
84
|
+
url: string;
|
|
85
|
+
};
|
|
86
|
+
fixable: string;
|
|
87
|
+
messages: {
|
|
88
|
+
[x: string]: string;
|
|
89
|
+
};
|
|
90
|
+
schema: never[];
|
|
91
|
+
};
|
|
92
|
+
create(context: any): any;
|
|
93
|
+
};
|
|
94
|
+
'text-or-children-required': {
|
|
95
|
+
meta: {
|
|
96
|
+
type: string;
|
|
97
|
+
docs: {
|
|
98
|
+
description: string;
|
|
99
|
+
url: string;
|
|
100
|
+
};
|
|
101
|
+
messages: {
|
|
102
|
+
[x: string]: string;
|
|
103
|
+
};
|
|
104
|
+
schema: never[];
|
|
105
|
+
};
|
|
106
|
+
create(context: any): any;
|
|
107
|
+
};
|
|
108
|
+
'no-interactive-tooltip-content': {
|
|
109
|
+
meta: {
|
|
110
|
+
type: string;
|
|
111
|
+
docs: {
|
|
112
|
+
description: string;
|
|
113
|
+
url: string;
|
|
114
|
+
};
|
|
115
|
+
messages: {
|
|
116
|
+
noInteractive: string;
|
|
117
|
+
};
|
|
118
|
+
schema: never[];
|
|
119
|
+
};
|
|
120
|
+
create(context: any): any;
|
|
121
|
+
};
|
|
122
|
+
'tooltip-requires-interactive-parent': {
|
|
123
|
+
meta: {
|
|
124
|
+
type: string;
|
|
125
|
+
docs: {
|
|
126
|
+
description: string;
|
|
127
|
+
url: string;
|
|
128
|
+
};
|
|
129
|
+
messages: {
|
|
130
|
+
requiresInteractive: string;
|
|
131
|
+
};
|
|
132
|
+
schema: never[];
|
|
133
|
+
};
|
|
134
|
+
create(context: any): any;
|
|
135
|
+
};
|
|
136
|
+
'no-nested-accordion': {
|
|
137
|
+
meta: {
|
|
138
|
+
type: string;
|
|
139
|
+
docs: {
|
|
140
|
+
description: string;
|
|
141
|
+
url: string;
|
|
142
|
+
};
|
|
143
|
+
messages: {
|
|
144
|
+
[x: string]: string;
|
|
145
|
+
};
|
|
146
|
+
schema: never[];
|
|
147
|
+
};
|
|
148
|
+
create(context: any): any;
|
|
149
|
+
};
|
|
150
|
+
'accordion-item-headline-required': {
|
|
151
|
+
meta: {
|
|
152
|
+
type: string;
|
|
153
|
+
docs: {
|
|
154
|
+
description: string;
|
|
155
|
+
url: string;
|
|
156
|
+
};
|
|
157
|
+
messages: {
|
|
158
|
+
[x: string]: string;
|
|
159
|
+
};
|
|
160
|
+
schema: never[];
|
|
161
|
+
};
|
|
162
|
+
create(context: any): any;
|
|
163
|
+
};
|
|
164
|
+
'badge-corner-placement-rules': {
|
|
165
|
+
meta: {
|
|
166
|
+
type: string;
|
|
167
|
+
docs: {
|
|
168
|
+
description: string;
|
|
169
|
+
url: string;
|
|
170
|
+
};
|
|
171
|
+
fixable: string;
|
|
172
|
+
messages: {
|
|
173
|
+
[x: string]: string;
|
|
174
|
+
};
|
|
175
|
+
schema: never[];
|
|
176
|
+
};
|
|
177
|
+
create(context: any): any;
|
|
178
|
+
};
|
|
179
|
+
'badge-no-inline-in-interactive': {
|
|
180
|
+
meta: {
|
|
181
|
+
type: string;
|
|
182
|
+
docs: {
|
|
183
|
+
description: string;
|
|
184
|
+
url: string;
|
|
185
|
+
};
|
|
186
|
+
fixable: string;
|
|
187
|
+
messages: {
|
|
188
|
+
[x: string]: string;
|
|
189
|
+
};
|
|
190
|
+
schema: never[];
|
|
191
|
+
};
|
|
192
|
+
create(context: any): any;
|
|
193
|
+
};
|
|
194
|
+
'link-external-security': {
|
|
195
|
+
meta: {
|
|
196
|
+
type: string;
|
|
197
|
+
docs: {
|
|
198
|
+
description: string;
|
|
199
|
+
url: string;
|
|
200
|
+
};
|
|
201
|
+
fixable: string;
|
|
202
|
+
messages: {
|
|
203
|
+
[x: string]: string;
|
|
204
|
+
};
|
|
205
|
+
schema: never[];
|
|
206
|
+
};
|
|
207
|
+
create(context: any): any;
|
|
208
|
+
};
|
|
209
|
+
'select-requires-options': {
|
|
210
|
+
meta: {
|
|
211
|
+
type: string;
|
|
212
|
+
docs: {
|
|
213
|
+
description: string;
|
|
214
|
+
url: string;
|
|
215
|
+
};
|
|
216
|
+
messages: {
|
|
217
|
+
[x: string]: string;
|
|
218
|
+
};
|
|
219
|
+
schema: never[];
|
|
220
|
+
};
|
|
221
|
+
create(context: any): any;
|
|
222
|
+
};
|
|
223
|
+
'custom-select-tags-remove-text-required': {
|
|
224
|
+
meta: {
|
|
225
|
+
type: string;
|
|
226
|
+
docs: {
|
|
227
|
+
description: string;
|
|
228
|
+
url: string;
|
|
229
|
+
};
|
|
230
|
+
messages: {
|
|
231
|
+
[x: string]: string;
|
|
232
|
+
};
|
|
233
|
+
schema: never[];
|
|
234
|
+
};
|
|
235
|
+
create(context: any): any;
|
|
236
|
+
};
|
|
237
|
+
'close-button-text-required': {
|
|
238
|
+
meta: {
|
|
239
|
+
type: string;
|
|
240
|
+
docs: {
|
|
241
|
+
description: string;
|
|
242
|
+
url: string;
|
|
243
|
+
};
|
|
244
|
+
messages: {
|
|
245
|
+
[x: string]: string;
|
|
246
|
+
};
|
|
247
|
+
schema: never[];
|
|
248
|
+
};
|
|
249
|
+
create(context: any): any;
|
|
250
|
+
};
|
|
251
|
+
'header-burger-menu-label-required': {
|
|
252
|
+
meta: {
|
|
253
|
+
type: string;
|
|
254
|
+
docs: {
|
|
255
|
+
description: string;
|
|
256
|
+
url: string;
|
|
257
|
+
};
|
|
258
|
+
messages: {
|
|
259
|
+
[x: string]: string;
|
|
260
|
+
};
|
|
261
|
+
schema: never[];
|
|
262
|
+
};
|
|
263
|
+
create(context: any): any;
|
|
264
|
+
};
|
|
265
|
+
'navigation-item-back-button-text-required': {
|
|
266
|
+
meta: {
|
|
267
|
+
type: string;
|
|
268
|
+
docs: {
|
|
269
|
+
description: string;
|
|
270
|
+
url: string;
|
|
271
|
+
};
|
|
272
|
+
messages: {
|
|
273
|
+
[x: string]: string;
|
|
274
|
+
};
|
|
275
|
+
schema: never[];
|
|
276
|
+
};
|
|
277
|
+
create(context: any): any;
|
|
278
|
+
};
|
|
279
|
+
'tag-removable-remove-button-required': {
|
|
280
|
+
meta: {
|
|
281
|
+
type: string;
|
|
282
|
+
docs: {
|
|
283
|
+
description: string;
|
|
284
|
+
url: string;
|
|
285
|
+
};
|
|
286
|
+
messages: {
|
|
287
|
+
[x: string]: string;
|
|
288
|
+
};
|
|
289
|
+
schema: never[];
|
|
290
|
+
};
|
|
291
|
+
create(context: any): any;
|
|
292
|
+
};
|
|
293
|
+
'input-type-required': {
|
|
294
|
+
meta: {
|
|
295
|
+
type: string;
|
|
296
|
+
docs: {
|
|
297
|
+
description: string;
|
|
298
|
+
url: string;
|
|
299
|
+
};
|
|
300
|
+
fixable: string;
|
|
301
|
+
messages: {
|
|
302
|
+
[x: string]: string;
|
|
303
|
+
};
|
|
304
|
+
schema: never[];
|
|
305
|
+
};
|
|
306
|
+
create(context: any): any;
|
|
307
|
+
};
|
|
308
|
+
'input-file-type-validation': {
|
|
309
|
+
meta: {
|
|
310
|
+
type: string;
|
|
311
|
+
docs: {
|
|
312
|
+
description: string;
|
|
313
|
+
url: string;
|
|
314
|
+
};
|
|
315
|
+
messages: {
|
|
316
|
+
[x: string]: string;
|
|
317
|
+
};
|
|
318
|
+
schema: never[];
|
|
319
|
+
};
|
|
320
|
+
create(context: any): any;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
configs: {
|
|
324
|
+
recommended: {
|
|
325
|
+
rules: {
|
|
326
|
+
'db-ux/accordion-item-headline-required': string;
|
|
327
|
+
'db-ux/badge-corner-placement-rules': string;
|
|
328
|
+
'db-ux/badge-no-inline-in-interactive': string;
|
|
329
|
+
'db-ux/button-no-text-requires-tooltip': string;
|
|
330
|
+
'db-ux/button-single-icon-attribute': string;
|
|
331
|
+
'db-ux/button-type-required': string;
|
|
332
|
+
'db-ux/close-button-text-required': string;
|
|
333
|
+
'db-ux/custom-select-tags-remove-text-required': string;
|
|
334
|
+
'db-ux/form-label-required': string;
|
|
335
|
+
'db-ux/form-validation-message-required': string;
|
|
336
|
+
'db-ux/header-burger-menu-label-required': string;
|
|
337
|
+
'db-ux/input-file-type-validation': string;
|
|
338
|
+
'db-ux/input-type-required': string;
|
|
339
|
+
'db-ux/link-external-security': string;
|
|
340
|
+
'db-ux/navigation-item-back-button-text-required': string;
|
|
341
|
+
'db-ux/no-interactive-tooltip-content': string;
|
|
342
|
+
'db-ux/no-nested-accordion': string;
|
|
343
|
+
'db-ux/prefer-icon-attribute': string;
|
|
344
|
+
'db-ux/select-requires-options': string;
|
|
345
|
+
'db-ux/tag-removable-remove-button-required': string;
|
|
346
|
+
'db-ux/text-or-children-required': string;
|
|
347
|
+
'db-ux/tooltip-requires-interactive-parent': string;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
};
|
|
352
|
+
export default plugin;
|
package/build/index.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import accordionItemHeadlineRequired from './rules/accordion/accordion-item-headline-required.js';
|
|
2
|
+
import noNestedAccordion from './rules/accordion/no-nested-accordion.js';
|
|
3
|
+
import badgeCornerPlacementRules from './rules/badge/badge-corner-placement-rules.js';
|
|
4
|
+
import badgeNoInlineInInteractive from './rules/badge/badge-no-inline-in-interactive.js';
|
|
5
|
+
import buttonNoTextRequiresTooltip from './rules/button/button-no-text-requires-tooltip.js';
|
|
6
|
+
import buttonSingleIconAttribute from './rules/button/button-single-icon-attribute.js';
|
|
7
|
+
import buttonTypeRequired from './rules/button/button-type-required.js';
|
|
8
|
+
import closeButtonTextRequired from './rules/close-button/close-button-text-required.js';
|
|
9
|
+
import textOrChildrenRequired from './rules/content/text-or-children-required.js';
|
|
10
|
+
import formLabelRequired from './rules/form/form-label-required.js';
|
|
11
|
+
import formValidationMessageRequired from './rules/form/form-validation-message-required.js';
|
|
12
|
+
import headerBurgerMenuLabelRequired from './rules/header/header-burger-menu-label-required.js';
|
|
13
|
+
import preferIconAttribute from './rules/icon/prefer-icon-attribute.js';
|
|
14
|
+
import inputFileTypeValidation from './rules/input/input-file-type-validation.js';
|
|
15
|
+
import inputTypeRequired from './rules/input/input-type-required.js';
|
|
16
|
+
import linkExternalSecurity from './rules/link/link-external-security.js';
|
|
17
|
+
import navigationItemBackButtonTextRequired from './rules/navigation/navigation-item-back-button-text-required.js';
|
|
18
|
+
import customSelectTagsRemoveTextRequired from './rules/select/custom-select-tags-remove-text-required.js';
|
|
19
|
+
import selectRequiresOptions from './rules/select/select-requires-options.js';
|
|
20
|
+
import tagRemovableRemoveButtonRequired from './rules/tag/tag-removable-remove-button-required.js';
|
|
21
|
+
import noInteractiveTooltipContent from './rules/tooltip/no-interactive-tooltip-content.js';
|
|
22
|
+
import tooltipRequiresInteractiveParent from './rules/tooltip/tooltip-requires-interactive-parent.js';
|
|
23
|
+
const recommended = {
|
|
24
|
+
rules: {
|
|
25
|
+
'db-ux/accordion-item-headline-required': 'error',
|
|
26
|
+
'db-ux/badge-corner-placement-rules': 'error',
|
|
27
|
+
'db-ux/badge-no-inline-in-interactive': 'error',
|
|
28
|
+
'db-ux/button-no-text-requires-tooltip': 'error',
|
|
29
|
+
'db-ux/button-single-icon-attribute': 'error',
|
|
30
|
+
'db-ux/button-type-required': 'error',
|
|
31
|
+
'db-ux/close-button-text-required': 'error',
|
|
32
|
+
'db-ux/custom-select-tags-remove-text-required': 'error',
|
|
33
|
+
'db-ux/form-label-required': 'error',
|
|
34
|
+
'db-ux/form-validation-message-required': 'warn',
|
|
35
|
+
'db-ux/header-burger-menu-label-required': 'error',
|
|
36
|
+
'db-ux/input-file-type-validation': 'error',
|
|
37
|
+
'db-ux/input-type-required': 'warn',
|
|
38
|
+
'db-ux/link-external-security': 'warn',
|
|
39
|
+
'db-ux/navigation-item-back-button-text-required': 'error',
|
|
40
|
+
'db-ux/no-interactive-tooltip-content': 'error',
|
|
41
|
+
'db-ux/no-nested-accordion': 'error',
|
|
42
|
+
'db-ux/prefer-icon-attribute': 'warn',
|
|
43
|
+
'db-ux/select-requires-options': 'error',
|
|
44
|
+
'db-ux/tag-removable-remove-button-required': 'error',
|
|
45
|
+
'db-ux/text-or-children-required': 'error',
|
|
46
|
+
'db-ux/tooltip-requires-interactive-parent': 'error'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const plugin = {
|
|
50
|
+
meta: {
|
|
51
|
+
name: '@db-ux/eslint-plugin',
|
|
52
|
+
version: '0.0.1'
|
|
53
|
+
},
|
|
54
|
+
rules: {
|
|
55
|
+
'button-no-text-requires-tooltip': buttonNoTextRequiresTooltip,
|
|
56
|
+
'button-type-required': buttonTypeRequired,
|
|
57
|
+
'button-single-icon-attribute': buttonSingleIconAttribute,
|
|
58
|
+
'form-label-required': formLabelRequired,
|
|
59
|
+
'form-validation-message-required': formValidationMessageRequired,
|
|
60
|
+
'prefer-icon-attribute': preferIconAttribute,
|
|
61
|
+
'text-or-children-required': textOrChildrenRequired,
|
|
62
|
+
'no-interactive-tooltip-content': noInteractiveTooltipContent,
|
|
63
|
+
'tooltip-requires-interactive-parent': tooltipRequiresInteractiveParent,
|
|
64
|
+
'no-nested-accordion': noNestedAccordion,
|
|
65
|
+
'accordion-item-headline-required': accordionItemHeadlineRequired,
|
|
66
|
+
'badge-corner-placement-rules': badgeCornerPlacementRules,
|
|
67
|
+
'badge-no-inline-in-interactive': badgeNoInlineInInteractive,
|
|
68
|
+
'link-external-security': linkExternalSecurity,
|
|
69
|
+
'select-requires-options': selectRequiresOptions,
|
|
70
|
+
'custom-select-tags-remove-text-required': customSelectTagsRemoveTextRequired,
|
|
71
|
+
'close-button-text-required': closeButtonTextRequired,
|
|
72
|
+
'header-burger-menu-label-required': headerBurgerMenuLabelRequired,
|
|
73
|
+
'navigation-item-back-button-text-required': navigationItemBackButtonTextRequired,
|
|
74
|
+
'tag-removable-remove-button-required': tagRemovableRemoveButtonRequired,
|
|
75
|
+
'input-type-required': inputTypeRequired,
|
|
76
|
+
'input-file-type-validation': inputFileTypeValidation
|
|
77
|
+
},
|
|
78
|
+
configs: {
|
|
79
|
+
recommended
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export default plugin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MESSAGE_IDS } from '../../shared/constants.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
meta: {
|
|
4
|
+
type: string;
|
|
5
|
+
docs: {
|
|
6
|
+
description: string;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
messages: {
|
|
10
|
+
[MESSAGE_IDS.ACCORDION_ITEM_HEADLINE_REQUIRED]: string;
|
|
11
|
+
};
|
|
12
|
+
schema: never[];
|
|
13
|
+
};
|
|
14
|
+
create(context: any): any;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createAngularVisitors, defineTemplateBodyVisitor, getAttributeValue, isDBComponent } from '../../shared/utils.js';
|
|
2
|
+
import { COMPONENTS, MESSAGES, MESSAGE_IDS } from '../../shared/constants.js';
|
|
3
|
+
function hasHeadlineSlot(node) {
|
|
4
|
+
return node.children?.some((child) => {
|
|
5
|
+
// Angular: <div slot="headline">
|
|
6
|
+
if (child.type === 'Element') {
|
|
7
|
+
const slotAttr = child.attributes?.find((a) => a.name === 'slot');
|
|
8
|
+
return slotAttr?.value === 'headline';
|
|
9
|
+
}
|
|
10
|
+
// Vue: <template #headline> or <template v-slot:headline>
|
|
11
|
+
if (child.type === 'VElement' && child.rawName === 'template') {
|
|
12
|
+
return child.startTag.attributes.some((a) => a.key.name === 'slot' && a.key.argument?.name === 'headline' ||
|
|
13
|
+
a.key.name === 'headline');
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export default {
|
|
19
|
+
meta: {
|
|
20
|
+
type: 'problem',
|
|
21
|
+
docs: {
|
|
22
|
+
description: 'Ensure DBAccordionItem has headline or headlinePlain',
|
|
23
|
+
url: 'https://github.com/db-ux-design-system/core-web/blob/main/packages/eslint-plugin/README.md#accordion-item-headline-required'
|
|
24
|
+
},
|
|
25
|
+
messages: {
|
|
26
|
+
[MESSAGE_IDS.ACCORDION_ITEM_HEADLINE_REQUIRED]: MESSAGES.ACCORDION_ITEM_HEADLINE_REQUIRED
|
|
27
|
+
},
|
|
28
|
+
schema: []
|
|
29
|
+
},
|
|
30
|
+
create(context) {
|
|
31
|
+
const angularHandler = (node, parserServices) => {
|
|
32
|
+
const headlinePlain = getAttributeValue(node, 'headlinePlain');
|
|
33
|
+
const hasSlot = hasHeadlineSlot(node);
|
|
34
|
+
if (!headlinePlain && !hasSlot) {
|
|
35
|
+
const loc = parserServices.convertNodeSourceSpanToLoc(node.sourceSpan);
|
|
36
|
+
context.report({
|
|
37
|
+
loc,
|
|
38
|
+
messageId: MESSAGE_IDS.ACCORDION_ITEM_HEADLINE_REQUIRED
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const angularVisitors = createAngularVisitors(context, COMPONENTS.DBAccordionItem, angularHandler);
|
|
43
|
+
if (angularVisitors)
|
|
44
|
+
return angularVisitors;
|
|
45
|
+
const checkAccordionItem = (node) => {
|
|
46
|
+
const openingElement = node.openingElement || node;
|
|
47
|
+
if (!isDBComponent(openingElement, COMPONENTS.DBAccordionItem))
|
|
48
|
+
return;
|
|
49
|
+
const headlinePlain = getAttributeValue(openingElement, 'headlinePlain');
|
|
50
|
+
const headline = getAttributeValue(openingElement, 'headline');
|
|
51
|
+
const hasSlot = hasHeadlineSlot(node);
|
|
52
|
+
if (!headlinePlain && !headline && !hasSlot) {
|
|
53
|
+
context.report({
|
|
54
|
+
node: openingElement,
|
|
55
|
+
messageId: MESSAGE_IDS.ACCORDION_ITEM_HEADLINE_REQUIRED
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return defineTemplateBodyVisitor(context, { VElement: checkAccordionItem, Element: checkAccordionItem }, { JSXElement: checkAccordionItem });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MESSAGE_IDS } from '../../shared/constants.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
meta: {
|
|
4
|
+
type: string;
|
|
5
|
+
docs: {
|
|
6
|
+
description: string;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
messages: {
|
|
10
|
+
[MESSAGE_IDS.ACCORDION_NO_NESTED]: string;
|
|
11
|
+
};
|
|
12
|
+
schema: never[];
|
|
13
|
+
};
|
|
14
|
+
create(context: any): any;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createAngularVisitors, defineTemplateBodyVisitor, isDBComponent } from '../../shared/utils.js';
|
|
2
|
+
import { COMPONENTS, MESSAGES, MESSAGE_IDS } from '../../shared/constants.js';
|
|
3
|
+
export default {
|
|
4
|
+
meta: {
|
|
5
|
+
type: 'problem',
|
|
6
|
+
docs: {
|
|
7
|
+
description: 'Prevent nesting DBAccordion components',
|
|
8
|
+
url: 'https://github.com/db-ux-design-system/core-web/blob/main/packages/eslint-plugin/README.md#no-nested-accordion'
|
|
9
|
+
},
|
|
10
|
+
messages: {
|
|
11
|
+
[MESSAGE_IDS.ACCORDION_NO_NESTED]: MESSAGES.ACCORDION_NO_NESTED
|
|
12
|
+
},
|
|
13
|
+
schema: []
|
|
14
|
+
},
|
|
15
|
+
create(context) {
|
|
16
|
+
const angularHandler = (node, parserServices) => {
|
|
17
|
+
let parent = node.parent;
|
|
18
|
+
while (parent) {
|
|
19
|
+
if (parent.type === 'Element' && isDBComponent(parent, COMPONENTS.DBAccordion)) {
|
|
20
|
+
const loc = parserServices.convertNodeSourceSpanToLoc(node.sourceSpan);
|
|
21
|
+
context.report({
|
|
22
|
+
loc,
|
|
23
|
+
messageId: MESSAGE_IDS.ACCORDION_NO_NESTED
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
parent = parent.parent;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const angularVisitors = createAngularVisitors(context, COMPONENTS.DBAccordion, angularHandler);
|
|
31
|
+
if (angularVisitors)
|
|
32
|
+
return angularVisitors;
|
|
33
|
+
const checkAccordion = (node) => {
|
|
34
|
+
const openingElement = node.openingElement || node;
|
|
35
|
+
if (!isDBComponent(openingElement, COMPONENTS.DBAccordion))
|
|
36
|
+
return;
|
|
37
|
+
let parent = node.parent;
|
|
38
|
+
while (parent) {
|
|
39
|
+
const parentOpening = parent.openingElement || parent;
|
|
40
|
+
if ((parent.type === 'JSXElement' ||
|
|
41
|
+
parent.type === 'VElement') &&
|
|
42
|
+
isDBComponent(parentOpening, COMPONENTS.DBAccordion)) {
|
|
43
|
+
context.report({
|
|
44
|
+
node: openingElement,
|
|
45
|
+
messageId: MESSAGE_IDS.ACCORDION_NO_NESTED
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
parent = parent.parent;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return defineTemplateBodyVisitor(context, { VElement: checkAccordion, Element: checkAccordion }, { JSXElement: checkAccordion });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MESSAGE_IDS } from '../../shared/constants.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
meta: {
|
|
4
|
+
type: string;
|
|
5
|
+
docs: {
|
|
6
|
+
description: string;
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
fixable: string;
|
|
10
|
+
messages: {
|
|
11
|
+
[MESSAGE_IDS.BADGE_CORNER_TEXT_TOO_LONG]: string;
|
|
12
|
+
[MESSAGE_IDS.BADGE_CORNER_MISSING_LABEL]: string;
|
|
13
|
+
};
|
|
14
|
+
schema: never[];
|
|
15
|
+
};
|
|
16
|
+
create(context: any): any;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|