eslint-plugin-vuetify 2.0.0-beta.2 → 2.0.0-beta.4
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
/** @type {Map<RegExp, (args: string[]) => string> | Map<string, string>} */
|
|
3
|
+
/** @type {Map<RegExp, ((args: string[]) => string | false) | false> | Map<string, string | false>} */
|
|
4
4
|
const replacements = new Map([[/^rounded-(r|l|tr|tl|br|bl)(-.*)?$/, ([side, rest]) => {
|
|
5
5
|
side = {
|
|
6
6
|
r: 'e',
|
|
@@ -17,7 +17,7 @@ const replacements = new Map([[/^rounded-(r|l|tr|tl|br|bl)(-.*)?$/, ([side, rest
|
|
|
17
17
|
l: 's'
|
|
18
18
|
}[side];
|
|
19
19
|
return `border-${side}${rest}`;
|
|
20
|
-
}], [/^text-xs-(left|right|center|justify)$/, ([align]) => `text-${align}`], ['scroll-y', 'overflow-y-auto'], ['hide-overflow', 'overflow-hidden'], ['show-overflow', 'overflow-visible'], ['no-wrap', 'text-no-wrap'], ['ellipsis', 'text-truncate'], ['left', 'float-left'], ['right', 'float-right'], ['display-4', 'text-h1'], ['display-3', 'text-h2'], ['display-2', 'text-h3'], ['display-1', 'text-h4'], ['headline', 'text-h5'], ['title', 'text-h6'], ['subtitle-1', 'text-subtitle-1'], ['subtitle-2', 'text-subtitle-2'], ['body-1', 'text-body-1'], ['body-2', 'text-body-2'], ['caption', 'text-caption'], ['caption', 'text-caption'], ['overline', 'text-overline']]);
|
|
20
|
+
}], [/^text-xs-(left|right|center|justify)$/, ([align]) => `text-${align}`], ['scroll-y', 'overflow-y-auto'], ['hide-overflow', 'overflow-hidden'], ['show-overflow', 'overflow-visible'], ['no-wrap', 'text-no-wrap'], ['ellipsis', 'text-truncate'], ['left', 'float-left'], ['right', 'float-right'], ['display-4', 'text-h1'], ['display-3', 'text-h2'], ['display-2', 'text-h3'], ['display-1', 'text-h4'], ['headline', 'text-h5'], ['title', 'text-h6'], ['subtitle-1', 'text-subtitle-1'], ['subtitle-2', 'text-subtitle-2'], ['body-1', 'text-body-1'], ['body-2', 'text-body-2'], ['caption', 'text-caption'], ['caption', 'text-caption'], ['overline', 'text-overline'], [/^transition-(fast-out-slow-in|linear-out-slow-in|fast-out-linear-in|ease-in-out|fast-in-fast-out|swing)$/, false]]);
|
|
21
21
|
|
|
22
22
|
// ------------------------------------------------------------------------------
|
|
23
23
|
// Rule Definition
|
|
@@ -50,8 +50,12 @@ module.exports = {
|
|
|
50
50
|
if (replacer[0] instanceof RegExp) {
|
|
51
51
|
const matches = (replacer[0].exec(className) || []).slice(1);
|
|
52
52
|
const replace = replacer[1];
|
|
53
|
-
if (matches.length
|
|
54
|
-
|
|
53
|
+
if (matches.length) {
|
|
54
|
+
if (typeof replace === 'function') {
|
|
55
|
+
return changed.push([className, replace(matches)]);
|
|
56
|
+
} else {
|
|
57
|
+
return changed.push([className, replace]);
|
|
58
|
+
}
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
}
|
|
@@ -63,17 +67,27 @@ module.exports = {
|
|
|
63
67
|
start: source.getLocFromIndex(range[0]),
|
|
64
68
|
end: source.getLocFromIndex(range[1])
|
|
65
69
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
if (change[1]) {
|
|
71
|
+
context.report({
|
|
72
|
+
loc,
|
|
73
|
+
messageId: 'replacedWith',
|
|
74
|
+
data: {
|
|
75
|
+
a: change[0],
|
|
76
|
+
b: change[1]
|
|
77
|
+
},
|
|
78
|
+
fix(fixer) {
|
|
79
|
+
return fixer.replaceTextRange(range, change[1]);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
context.report({
|
|
84
|
+
loc,
|
|
85
|
+
messageId: 'removed',
|
|
86
|
+
data: {
|
|
87
|
+
name: change[0]
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
77
91
|
});
|
|
78
92
|
}
|
|
79
93
|
});
|
|
@@ -27,6 +27,9 @@ const replacements = {
|
|
|
27
27
|
VDataTable: false,
|
|
28
28
|
VDatePicker: false,
|
|
29
29
|
VListItemGroup: false,
|
|
30
|
+
VListItemAvatar: false,
|
|
31
|
+
VListItemContent: false,
|
|
32
|
+
VListItemIcon: false,
|
|
30
33
|
VOtpInput: false,
|
|
31
34
|
VOverflowBtn: false,
|
|
32
35
|
VPicker: false,
|
|
@@ -35,6 +38,10 @@ const replacements = {
|
|
|
35
38
|
VSparkline: false,
|
|
36
39
|
VSpeedDial: false,
|
|
37
40
|
VStepper: false,
|
|
41
|
+
VSubheader: {
|
|
42
|
+
custom: 'v-list-subheader or class="text-subheader-2"'
|
|
43
|
+
},
|
|
44
|
+
VSimpleTable: 'v-table',
|
|
38
45
|
VTimePicker: false,
|
|
39
46
|
VTreeview: false,
|
|
40
47
|
VVirtualScroll: false
|
|
@@ -39,6 +39,10 @@ const inputs = {
|
|
|
39
39
|
name: 'variant',
|
|
40
40
|
value: 'filled'
|
|
41
41
|
},
|
|
42
|
+
dense: {
|
|
43
|
+
name: 'density',
|
|
44
|
+
value: 'compact'
|
|
45
|
+
},
|
|
42
46
|
errorCount: 'max-errors',
|
|
43
47
|
filled: {
|
|
44
48
|
name: 'variant',
|
|
@@ -92,7 +96,8 @@ const select = {
|
|
|
92
96
|
smallChips: false,
|
|
93
97
|
valueComparator: false,
|
|
94
98
|
filter: 'customFilter',
|
|
95
|
-
...inputs
|
|
99
|
+
...inputs,
|
|
100
|
+
dense: false
|
|
96
101
|
};
|
|
97
102
|
const theme = {
|
|
98
103
|
dark: false,
|
|
@@ -148,6 +153,10 @@ const replacements = {
|
|
|
148
153
|
left: 'start'
|
|
149
154
|
})[value] || value
|
|
150
155
|
},
|
|
156
|
+
dense: {
|
|
157
|
+
name: 'density',
|
|
158
|
+
value: 'compact'
|
|
159
|
+
},
|
|
151
160
|
outline: {
|
|
152
161
|
name: 'variant',
|
|
153
162
|
value: 'outlined'
|
|
@@ -274,7 +283,8 @@ const replacements = {
|
|
|
274
283
|
backgroundColor: false,
|
|
275
284
|
borderless: false,
|
|
276
285
|
dense: {
|
|
277
|
-
|
|
286
|
+
name: 'density',
|
|
287
|
+
value: 'compact'
|
|
278
288
|
},
|
|
279
289
|
shaped: false,
|
|
280
290
|
tile: {
|
|
@@ -336,6 +346,7 @@ const replacements = {
|
|
|
336
346
|
},
|
|
337
347
|
VCheckbox: {
|
|
338
348
|
backgroundColor: false,
|
|
349
|
+
dense: false,
|
|
339
350
|
errorCount: 'max-errors',
|
|
340
351
|
hideSpinButtons: false,
|
|
341
352
|
hint: false,
|
|
@@ -382,6 +393,18 @@ const replacements = {
|
|
|
382
393
|
value: 'model-value'
|
|
383
394
|
},
|
|
384
395
|
VExpansionPanels: {
|
|
396
|
+
accordion: {
|
|
397
|
+
name: 'variant',
|
|
398
|
+
value: 'accordion'
|
|
399
|
+
},
|
|
400
|
+
inset: {
|
|
401
|
+
name: 'variant',
|
|
402
|
+
value: 'inset'
|
|
403
|
+
},
|
|
404
|
+
popout: {
|
|
405
|
+
name: 'variant',
|
|
406
|
+
value: 'popout'
|
|
407
|
+
},
|
|
385
408
|
activeClass: 'selected-class',
|
|
386
409
|
flat: false,
|
|
387
410
|
focusable: false,
|
|
@@ -488,10 +511,8 @@ const replacements = {
|
|
|
488
511
|
custom: 'cover'
|
|
489
512
|
},
|
|
490
513
|
contentClass: false,
|
|
491
|
-
height: false,
|
|
492
514
|
position: false,
|
|
493
|
-
...theme
|
|
494
|
-
...size
|
|
515
|
+
...theme
|
|
495
516
|
},
|
|
496
517
|
VItemGroup: {
|
|
497
518
|
activeClass: 'selected-class',
|
|
@@ -505,6 +526,10 @@ const replacements = {
|
|
|
505
526
|
value: 'model-value'
|
|
506
527
|
},
|
|
507
528
|
VList: {
|
|
529
|
+
dense: {
|
|
530
|
+
name: 'density',
|
|
531
|
+
value: 'compact'
|
|
532
|
+
},
|
|
508
533
|
expand: false,
|
|
509
534
|
flat: false,
|
|
510
535
|
outlined: false,
|
|
@@ -530,6 +555,10 @@ const replacements = {
|
|
|
530
555
|
},
|
|
531
556
|
VListItem: {
|
|
532
557
|
append: false,
|
|
558
|
+
dense: {
|
|
559
|
+
name: 'density',
|
|
560
|
+
value: 'compact'
|
|
561
|
+
},
|
|
533
562
|
ripple: false,
|
|
534
563
|
selectable: {
|
|
535
564
|
custom: 'value'
|
|
@@ -589,7 +618,6 @@ const replacements = {
|
|
|
589
618
|
value: 'model-value'
|
|
590
619
|
},
|
|
591
620
|
VProgressLinear: {
|
|
592
|
-
absolute: false,
|
|
593
621
|
backgroundColor: 'bg-color',
|
|
594
622
|
backgroundOpacity: 'bg-opacity',
|
|
595
623
|
bottom: false,
|
|
@@ -648,6 +676,10 @@ const replacements = {
|
|
|
648
676
|
VRating: {
|
|
649
677
|
backgroundColor: false,
|
|
650
678
|
closeDelay: false,
|
|
679
|
+
dense: {
|
|
680
|
+
name: 'density',
|
|
681
|
+
value: 'compact'
|
|
682
|
+
},
|
|
651
683
|
halfIcon: false,
|
|
652
684
|
iconLabel: 'item-aria-label',
|
|
653
685
|
large: false,
|
|
@@ -676,7 +708,25 @@ const replacements = {
|
|
|
676
708
|
centered: {
|
|
677
709
|
custom: 'location'
|
|
678
710
|
},
|
|
679
|
-
elevation
|
|
711
|
+
elevation(attr) {
|
|
712
|
+
if (attr.directive ? attr.value.type === 'VExpressionContainer' && attr.value.expression.type === 'Literal' : attr.value.type === 'VLiteral') {
|
|
713
|
+
return {
|
|
714
|
+
name: 'class',
|
|
715
|
+
value: value => `elevation-${value}`,
|
|
716
|
+
bind: false
|
|
717
|
+
};
|
|
718
|
+
} else if (attr.directive && attr.value.type === 'VExpressionContainer') {
|
|
719
|
+
return {
|
|
720
|
+
name: 'class',
|
|
721
|
+
value: value => `\`elevation-$\{${value}}\``,
|
|
722
|
+
bind: true
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
return {
|
|
726
|
+
name: 'class',
|
|
727
|
+
custom: 'elevation-<value>'
|
|
728
|
+
};
|
|
729
|
+
},
|
|
680
730
|
left: {
|
|
681
731
|
name: 'location',
|
|
682
732
|
value: 'left'
|
|
@@ -700,6 +750,7 @@ const replacements = {
|
|
|
700
750
|
},
|
|
701
751
|
VSwitch: {
|
|
702
752
|
...inputs,
|
|
753
|
+
inputValue: 'model-value',
|
|
703
754
|
value: undefined
|
|
704
755
|
},
|
|
705
756
|
VSystemBar: {
|
|
@@ -714,7 +765,20 @@ const replacements = {
|
|
|
714
765
|
value: 'title'
|
|
715
766
|
},
|
|
716
767
|
backgroundColor: 'bg-color',
|
|
768
|
+
centered: {
|
|
769
|
+
name: 'align-tabs',
|
|
770
|
+
value: 'center'
|
|
771
|
+
},
|
|
772
|
+
iconsAndText: 'stacked',
|
|
773
|
+
right: {
|
|
774
|
+
name: 'align-tabs',
|
|
775
|
+
value: 'end'
|
|
776
|
+
},
|
|
717
777
|
value: 'model-value',
|
|
778
|
+
vertical: {
|
|
779
|
+
name: 'direction',
|
|
780
|
+
value: 'vertical'
|
|
781
|
+
},
|
|
718
782
|
...theme
|
|
719
783
|
},
|
|
720
784
|
VTab: {
|
|
@@ -730,6 +794,10 @@ const replacements = {
|
|
|
730
794
|
name: 'align',
|
|
731
795
|
value: 'top'
|
|
732
796
|
},
|
|
797
|
+
dense: {
|
|
798
|
+
name: 'density',
|
|
799
|
+
value: 'compact'
|
|
800
|
+
},
|
|
733
801
|
reverse: false
|
|
734
802
|
},
|
|
735
803
|
VTimelineItem: {
|
|
@@ -835,6 +903,9 @@ module.exports = {
|
|
|
835
903
|
const propNameNode = attr.directive ? attr.key.argument : attr.key;
|
|
836
904
|
Object.entries(replacements[tag]).forEach(([test, replace]) => {
|
|
837
905
|
if (hyphenate(test) === propName) {
|
|
906
|
+
if (typeof replace === 'function') {
|
|
907
|
+
replace = replace(attr);
|
|
908
|
+
}
|
|
838
909
|
if (replace === false) {
|
|
839
910
|
context.report({
|
|
840
911
|
messageId: 'removed',
|
|
@@ -856,8 +927,9 @@ module.exports = {
|
|
|
856
927
|
}
|
|
857
928
|
});
|
|
858
929
|
} else if (typeof replace === 'object' && 'name' in replace && 'value' in replace) {
|
|
859
|
-
const
|
|
860
|
-
|
|
930
|
+
const oldValue = attr.directive ? context.getSourceCode().getText(attr.value.expression) : attr.value?.value;
|
|
931
|
+
const value = typeof replace.value === 'function' ? replace.value(oldValue) : replace.value;
|
|
932
|
+
if (value == null || value === oldValue) return;
|
|
861
933
|
context.report({
|
|
862
934
|
messageId: 'replacedWith',
|
|
863
935
|
data: {
|
|
@@ -866,7 +938,7 @@ module.exports = {
|
|
|
866
938
|
},
|
|
867
939
|
node: propNameNode,
|
|
868
940
|
fix(fixer) {
|
|
869
|
-
if (attr.directive) {
|
|
941
|
+
if (attr.directive && replace.bind !== false) {
|
|
870
942
|
if (replace.bind) {
|
|
871
943
|
if (value === 'true' || value === '!(false)') {
|
|
872
944
|
return fixer.replaceText(attr, replace.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-vuetify",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "An eslint plugin for Vuetify",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Kael Watts-Deuchar <kaelwd@gmail.com>",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"lib"
|
|
19
19
|
],
|
|
20
|
+
"packageManager": "pnpm@7",
|
|
20
21
|
"homepage": "https://github.com/vuetifyjs/eslint-plugin-vuetify#readme",
|
|
21
22
|
"dependencies": {
|
|
22
23
|
"eslint-plugin-vue": "^9.6.0",
|
|
@@ -26,6 +27,9 @@
|
|
|
26
27
|
"@babel/cli": "^7.19.3",
|
|
27
28
|
"@babel/core": "^7.19.6",
|
|
28
29
|
"@babel/preset-env": "^7.19.4",
|
|
30
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
31
|
+
"conventional-changelog-vuetify": "^1.1.0",
|
|
32
|
+
"conventional-github-releaser": "^3.1.5",
|
|
29
33
|
"eslint": "^8.26.0",
|
|
30
34
|
"eslint-config-standard": "^17.0.0",
|
|
31
35
|
"eslint-plugin-import": "^2.26.0",
|