eslint-plugin-better-tailwindcss 4.2.0 → 4.3.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.
Files changed (155) hide show
  1. package/README.md +1 -1
  2. package/lib/api/defaults.d.ts +84 -14
  3. package/lib/api/defaults.d.ts.map +1 -1
  4. package/lib/api/defaults.js +25 -5
  5. package/lib/api/defaults.js.map +1 -1
  6. package/lib/api/types.d.ts +2 -2
  7. package/lib/api/types.d.ts.map +1 -1
  8. package/lib/api/types.js +1 -1
  9. package/lib/api/types.js.map +1 -1
  10. package/lib/configs/config.d.ts +1754 -194
  11. package/lib/configs/config.d.ts.map +1 -1
  12. package/lib/options/callees/cc.d.ts +28 -12
  13. package/lib/options/callees/cc.d.ts.map +1 -1
  14. package/lib/options/callees/cc.js +15 -13
  15. package/lib/options/callees/cc.js.map +1 -1
  16. package/lib/options/callees/clb.d.ts +33 -17
  17. package/lib/options/callees/clb.d.ts.map +1 -1
  18. package/lib/options/callees/clb.js +25 -22
  19. package/lib/options/callees/clb.js.map +1 -1
  20. package/lib/options/callees/clsx.d.ts +28 -12
  21. package/lib/options/callees/clsx.d.ts.map +1 -1
  22. package/lib/options/callees/clsx.js +15 -13
  23. package/lib/options/callees/clsx.js.map +1 -1
  24. package/lib/options/callees/cn.d.ts +28 -12
  25. package/lib/options/callees/cn.d.ts.map +1 -1
  26. package/lib/options/callees/cn.js +15 -13
  27. package/lib/options/callees/cn.js.map +1 -1
  28. package/lib/options/callees/cnb.d.ts +28 -12
  29. package/lib/options/callees/cnb.d.ts.map +1 -1
  30. package/lib/options/callees/cnb.js +15 -13
  31. package/lib/options/callees/cnb.js.map +1 -1
  32. package/lib/options/callees/ctl.d.ts +15 -7
  33. package/lib/options/callees/ctl.d.ts.map +1 -1
  34. package/lib/options/callees/ctl.js +8 -7
  35. package/lib/options/callees/ctl.js.map +1 -1
  36. package/lib/options/callees/cva.d.ts +38 -18
  37. package/lib/options/callees/cva.d.ts.map +1 -1
  38. package/lib/options/callees/cva.js +24 -21
  39. package/lib/options/callees/cva.js.map +1 -1
  40. package/lib/options/callees/cx.d.ts +28 -12
  41. package/lib/options/callees/cx.d.ts.map +1 -1
  42. package/lib/options/callees/cx.js +15 -13
  43. package/lib/options/callees/cx.js.map +1 -1
  44. package/lib/options/callees/dcnb.d.ts +28 -12
  45. package/lib/options/callees/dcnb.d.ts.map +1 -1
  46. package/lib/options/callees/dcnb.js +15 -13
  47. package/lib/options/callees/dcnb.js.map +1 -1
  48. package/lib/options/callees/objstr.d.ts +22 -10
  49. package/lib/options/callees/objstr.d.ts.map +1 -1
  50. package/lib/options/callees/objstr.js +15 -13
  51. package/lib/options/callees/objstr.js.map +1 -1
  52. package/lib/options/callees/tv.d.ts +62 -30
  53. package/lib/options/callees/tv.d.ts.map +1 -1
  54. package/lib/options/callees/tv.js +48 -42
  55. package/lib/options/callees/tv.js.map +1 -1
  56. package/lib/options/callees/twJoin.d.ts +15 -7
  57. package/lib/options/callees/twJoin.d.ts.map +1 -1
  58. package/lib/options/callees/twJoin.js +8 -7
  59. package/lib/options/callees/twJoin.js.map +1 -1
  60. package/lib/options/callees/twMerge.d.ts +15 -7
  61. package/lib/options/callees/twMerge.d.ts.map +1 -1
  62. package/lib/options/callees/twMerge.js +8 -7
  63. package/lib/options/callees/twMerge.js.map +1 -1
  64. package/lib/options/default-options.d.ts +78 -13
  65. package/lib/options/default-options.d.ts.map +1 -1
  66. package/lib/options/default-options.js +97 -50
  67. package/lib/options/default-options.js.map +1 -1
  68. package/lib/options/descriptions.d.ts +210 -17
  69. package/lib/options/descriptions.d.ts.map +1 -1
  70. package/lib/options/descriptions.js +2 -0
  71. package/lib/options/descriptions.js.map +1 -1
  72. package/lib/options/migrate.d.ts +16 -0
  73. package/lib/options/migrate.d.ts.map +1 -0
  74. package/lib/options/migrate.js +115 -0
  75. package/lib/options/migrate.js.map +1 -0
  76. package/lib/options/schemas/attributes.d.ts +1 -5
  77. package/lib/options/schemas/attributes.d.ts.map +1 -1
  78. package/lib/options/schemas/attributes.js +1 -2
  79. package/lib/options/schemas/attributes.js.map +1 -1
  80. package/lib/options/schemas/callees.d.ts +1 -8
  81. package/lib/options/schemas/callees.d.ts.map +1 -1
  82. package/lib/options/schemas/callees.js +1 -2
  83. package/lib/options/schemas/callees.js.map +1 -1
  84. package/lib/options/schemas/selectors.d.ts +488 -0
  85. package/lib/options/schemas/selectors.d.ts.map +1 -0
  86. package/lib/options/schemas/selectors.js +69 -0
  87. package/lib/options/schemas/selectors.js.map +1 -0
  88. package/lib/options/schemas/tags.d.ts +1 -1
  89. package/lib/options/schemas/tags.d.ts.map +1 -1
  90. package/lib/options/schemas/tags.js +1 -2
  91. package/lib/options/schemas/tags.js.map +1 -1
  92. package/lib/options/schemas/variables.d.ts +1 -3
  93. package/lib/options/schemas/variables.d.ts.map +1 -1
  94. package/lib/options/schemas/variables.js +1 -2
  95. package/lib/options/schemas/variables.js.map +1 -1
  96. package/lib/parsers/angular.d.ts +2 -2
  97. package/lib/parsers/angular.d.ts.map +1 -1
  98. package/lib/parsers/angular.js +21 -25
  99. package/lib/parsers/angular.js.map +1 -1
  100. package/lib/parsers/es.d.ts +5 -8
  101. package/lib/parsers/es.d.ts.map +1 -1
  102. package/lib/parsers/es.js +109 -47
  103. package/lib/parsers/es.js.map +1 -1
  104. package/lib/parsers/html.d.ts +2 -2
  105. package/lib/parsers/html.d.ts.map +1 -1
  106. package/lib/parsers/html.js +7 -10
  107. package/lib/parsers/html.js.map +1 -1
  108. package/lib/parsers/jsx.d.ts +2 -2
  109. package/lib/parsers/jsx.d.ts.map +1 -1
  110. package/lib/parsers/jsx.js +8 -13
  111. package/lib/parsers/jsx.js.map +1 -1
  112. package/lib/parsers/svelte.d.ts +3 -3
  113. package/lib/parsers/svelte.d.ts.map +1 -1
  114. package/lib/parsers/svelte.js +22 -25
  115. package/lib/parsers/svelte.js.map +1 -1
  116. package/lib/parsers/vue.d.ts +2 -2
  117. package/lib/parsers/vue.d.ts.map +1 -1
  118. package/lib/parsers/vue.js +14 -18
  119. package/lib/parsers/vue.js.map +1 -1
  120. package/lib/rules/enforce-canonical-classes.d.ts +146 -16
  121. package/lib/rules/enforce-canonical-classes.d.ts.map +1 -1
  122. package/lib/rules/enforce-consistent-class-order.d.ts +146 -16
  123. package/lib/rules/enforce-consistent-class-order.d.ts.map +1 -1
  124. package/lib/rules/enforce-consistent-important-position.d.ts +146 -16
  125. package/lib/rules/enforce-consistent-important-position.d.ts.map +1 -1
  126. package/lib/rules/enforce-consistent-line-wrapping.d.ts +146 -16
  127. package/lib/rules/enforce-consistent-line-wrapping.d.ts.map +1 -1
  128. package/lib/rules/enforce-consistent-variable-syntax.d.ts +148 -18
  129. package/lib/rules/enforce-consistent-variable-syntax.d.ts.map +1 -1
  130. package/lib/rules/enforce-shorthand-classes.d.ts +146 -16
  131. package/lib/rules/enforce-shorthand-classes.d.ts.map +1 -1
  132. package/lib/rules/no-conflicting-classes.d.ts +146 -16
  133. package/lib/rules/no-conflicting-classes.d.ts.map +1 -1
  134. package/lib/rules/no-deprecated-classes.d.ts +146 -16
  135. package/lib/rules/no-deprecated-classes.d.ts.map +1 -1
  136. package/lib/rules/no-duplicate-classes.d.ts +146 -16
  137. package/lib/rules/no-duplicate-classes.d.ts.map +1 -1
  138. package/lib/rules/no-restricted-classes.d.ts +146 -16
  139. package/lib/rules/no-restricted-classes.d.ts.map +1 -1
  140. package/lib/rules/no-unknown-classes.d.ts +146 -16
  141. package/lib/rules/no-unknown-classes.d.ts.map +1 -1
  142. package/lib/rules/no-unnecessary-whitespace.d.ts +146 -16
  143. package/lib/rules/no-unnecessary-whitespace.d.ts.map +1 -1
  144. package/lib/types/rule.d.ts +39 -0
  145. package/lib/types/rule.d.ts.map +1 -1
  146. package/lib/types/rule.js +7 -0
  147. package/lib/types/rule.js.map +1 -1
  148. package/lib/utils/rule.d.ts.map +1 -1
  149. package/lib/utils/rule.js +42 -2
  150. package/lib/utils/rule.js.map +1 -1
  151. package/lib/utils/selectors.d.ts +3 -0
  152. package/lib/utils/selectors.d.ts.map +1 -0
  153. package/lib/utils/selectors.js +4 -0
  154. package/lib/utils/selectors.js.map +1 -0
  155. package/package.json +1 -1
@@ -11,7 +11,7 @@ export declare const noUnknownClasses: {
11
11
  tailwindConfig?: string | undefined;
12
12
  messageStyle: "visual" | "compact" | "raw";
13
13
  entryPoint?: string | undefined;
14
- tags: (string | [string, ({
14
+ tags?: (string | [string, ({
15
15
  match: import("../types/rule.js").MatcherType.String;
16
16
  } | {
17
17
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -19,8 +19,8 @@ export declare const noUnknownClasses: {
19
19
  } | {
20
20
  match: import("../types/rule.js").MatcherType.ObjectValue;
21
21
  pathPattern?: string | undefined;
22
- })[]])[];
23
- variables: (string | [string, ({
22
+ })[]])[] | undefined;
23
+ variables?: (string | [string, ({
24
24
  match: import("../types/rule.js").MatcherType.String;
25
25
  } | {
26
26
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -28,8 +28,8 @@ export declare const noUnknownClasses: {
28
28
  } | {
29
29
  match: import("../types/rule.js").MatcherType.ObjectValue;
30
30
  pathPattern?: string | undefined;
31
- })[]])[];
32
- attributes: (string | [string, ({
31
+ })[]])[] | undefined;
32
+ attributes?: (string | [string, ({
33
33
  match: import("../types/rule.js").MatcherType.String;
34
34
  } | {
35
35
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -37,8 +37,8 @@ export declare const noUnknownClasses: {
37
37
  } | {
38
38
  match: import("../types/rule.js").MatcherType.ObjectValue;
39
39
  pathPattern?: string | undefined;
40
- })[]])[];
41
- callees: (string | [string, ({
40
+ })[]])[] | undefined;
41
+ callees?: (string | [string, ({
42
42
  match: import("../types/rule.js").MatcherType.String;
43
43
  } | {
44
44
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -46,7 +46,72 @@ export declare const noUnknownClasses: {
46
46
  } | {
47
47
  match: import("../types/rule.js").MatcherType.ObjectValue;
48
48
  pathPattern?: string | undefined;
49
- })[]])[];
49
+ })[]])[] | undefined;
50
+ selectors: ({
51
+ callTarget?: number | "all" | "first" | "last" | undefined;
52
+ kind: import("../types/rule.js").SelectorKind.Callee;
53
+ match?: ({
54
+ type: import("../types/rule.js").MatcherType.String;
55
+ } | {
56
+ path?: string | undefined;
57
+ type: import("../types/rule.js").MatcherType.ObjectKey;
58
+ } | {
59
+ path?: string | undefined;
60
+ type: import("../types/rule.js").MatcherType.ObjectValue;
61
+ })[] | undefined;
62
+ name: string;
63
+ path?: string | undefined;
64
+ } | {
65
+ callTarget?: number | "all" | "first" | "last" | undefined;
66
+ kind: import("../types/rule.js").SelectorKind.Callee;
67
+ match?: ({
68
+ type: import("../types/rule.js").MatcherType.String;
69
+ } | {
70
+ path?: string | undefined;
71
+ type: import("../types/rule.js").MatcherType.ObjectKey;
72
+ } | {
73
+ path?: string | undefined;
74
+ type: import("../types/rule.js").MatcherType.ObjectValue;
75
+ })[] | undefined;
76
+ name?: string | undefined;
77
+ path: string;
78
+ } | {
79
+ kind: import("../types/rule.js").SelectorKind.Attribute;
80
+ match?: ({
81
+ type: import("../types/rule.js").MatcherType.String;
82
+ } | {
83
+ path?: string | undefined;
84
+ type: import("../types/rule.js").MatcherType.ObjectKey;
85
+ } | {
86
+ path?: string | undefined;
87
+ type: import("../types/rule.js").MatcherType.ObjectValue;
88
+ })[] | undefined;
89
+ name: string;
90
+ } | {
91
+ kind: import("../types/rule.js").SelectorKind.Tag;
92
+ match?: ({
93
+ type: import("../types/rule.js").MatcherType.String;
94
+ } | {
95
+ path?: string | undefined;
96
+ type: import("../types/rule.js").MatcherType.ObjectKey;
97
+ } | {
98
+ path?: string | undefined;
99
+ type: import("../types/rule.js").MatcherType.ObjectValue;
100
+ })[] | undefined;
101
+ name: string;
102
+ } | {
103
+ kind: import("../types/rule.js").SelectorKind.Variable;
104
+ match?: ({
105
+ type: import("../types/rule.js").MatcherType.String;
106
+ } | {
107
+ path?: string | undefined;
108
+ type: import("../types/rule.js").MatcherType.ObjectKey;
109
+ } | {
110
+ path?: string | undefined;
111
+ type: import("../types/rule.js").MatcherType.ObjectValue;
112
+ })[] | undefined;
113
+ name: string;
114
+ })[];
50
115
  } & {
51
116
  ignore: string[];
52
117
  };
@@ -62,7 +127,7 @@ export declare const noUnknownClasses: {
62
127
  tailwindConfig?: string | undefined;
63
128
  messageStyle: "visual" | "compact" | "raw";
64
129
  entryPoint?: string | undefined;
65
- tags: (string | [string, ({
130
+ tags?: (string | [string, ({
66
131
  match: import("../types/rule.js").MatcherType.String;
67
132
  } | {
68
133
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -70,8 +135,8 @@ export declare const noUnknownClasses: {
70
135
  } | {
71
136
  match: import("../types/rule.js").MatcherType.ObjectValue;
72
137
  pathPattern?: string | undefined;
73
- })[]])[];
74
- variables: (string | [string, ({
138
+ })[]])[] | undefined;
139
+ variables?: (string | [string, ({
75
140
  match: import("../types/rule.js").MatcherType.String;
76
141
  } | {
77
142
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -79,8 +144,8 @@ export declare const noUnknownClasses: {
79
144
  } | {
80
145
  match: import("../types/rule.js").MatcherType.ObjectValue;
81
146
  pathPattern?: string | undefined;
82
- })[]])[];
83
- attributes: (string | [string, ({
147
+ })[]])[] | undefined;
148
+ attributes?: (string | [string, ({
84
149
  match: import("../types/rule.js").MatcherType.String;
85
150
  } | {
86
151
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -88,8 +153,8 @@ export declare const noUnknownClasses: {
88
153
  } | {
89
154
  match: import("../types/rule.js").MatcherType.ObjectValue;
90
155
  pathPattern?: string | undefined;
91
- })[]])[];
92
- callees: (string | [string, ({
156
+ })[]])[] | undefined;
157
+ callees?: (string | [string, ({
93
158
  match: import("../types/rule.js").MatcherType.String;
94
159
  } | {
95
160
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -97,7 +162,72 @@ export declare const noUnknownClasses: {
97
162
  } | {
98
163
  match: import("../types/rule.js").MatcherType.ObjectValue;
99
164
  pathPattern?: string | undefined;
100
- })[]])[];
165
+ })[]])[] | undefined;
166
+ selectors: ({
167
+ callTarget?: number | "all" | "first" | "last" | undefined;
168
+ kind: import("../types/rule.js").SelectorKind.Callee;
169
+ match?: ({
170
+ type: import("../types/rule.js").MatcherType.String;
171
+ } | {
172
+ path?: string | undefined;
173
+ type: import("../types/rule.js").MatcherType.ObjectKey;
174
+ } | {
175
+ path?: string | undefined;
176
+ type: import("../types/rule.js").MatcherType.ObjectValue;
177
+ })[] | undefined;
178
+ name: string;
179
+ path?: string | undefined;
180
+ } | {
181
+ callTarget?: number | "all" | "first" | "last" | undefined;
182
+ kind: import("../types/rule.js").SelectorKind.Callee;
183
+ match?: ({
184
+ type: import("../types/rule.js").MatcherType.String;
185
+ } | {
186
+ path?: string | undefined;
187
+ type: import("../types/rule.js").MatcherType.ObjectKey;
188
+ } | {
189
+ path?: string | undefined;
190
+ type: import("../types/rule.js").MatcherType.ObjectValue;
191
+ })[] | undefined;
192
+ name?: string | undefined;
193
+ path: string;
194
+ } | {
195
+ kind: import("../types/rule.js").SelectorKind.Attribute;
196
+ match?: ({
197
+ type: import("../types/rule.js").MatcherType.String;
198
+ } | {
199
+ path?: string | undefined;
200
+ type: import("../types/rule.js").MatcherType.ObjectKey;
201
+ } | {
202
+ path?: string | undefined;
203
+ type: import("../types/rule.js").MatcherType.ObjectValue;
204
+ })[] | undefined;
205
+ name: string;
206
+ } | {
207
+ kind: import("../types/rule.js").SelectorKind.Tag;
208
+ match?: ({
209
+ type: import("../types/rule.js").MatcherType.String;
210
+ } | {
211
+ path?: string | undefined;
212
+ type: import("../types/rule.js").MatcherType.ObjectKey;
213
+ } | {
214
+ path?: string | undefined;
215
+ type: import("../types/rule.js").MatcherType.ObjectValue;
216
+ })[] | undefined;
217
+ name: string;
218
+ } | {
219
+ kind: import("../types/rule.js").SelectorKind.Variable;
220
+ match?: ({
221
+ type: import("../types/rule.js").MatcherType.String;
222
+ } | {
223
+ path?: string | undefined;
224
+ type: import("../types/rule.js").MatcherType.ObjectKey;
225
+ } | {
226
+ path?: string | undefined;
227
+ type: import("../types/rule.js").MatcherType.ObjectValue;
228
+ })[] | undefined;
229
+ name: string;
230
+ })[];
101
231
  } & {
102
232
  ignore: string[];
103
233
  }>];
@@ -1 +1 @@
1
- {"version":3,"file":"no-unknown-classes.d.ts","sourceRoot":"","sources":["../../src/rules/no-unknown-classes.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC3B,CAAC"}
1
+ {"version":3,"file":"no-unknown-classes.d.ts","sourceRoot":"","sources":["../../src/rules/no-unknown-classes.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC3B,CAAC"}
@@ -11,7 +11,7 @@ export declare const noUnnecessaryWhitespace: {
11
11
  tailwindConfig?: string | undefined;
12
12
  messageStyle: "visual" | "compact" | "raw";
13
13
  entryPoint?: string | undefined;
14
- tags: (string | [string, ({
14
+ tags?: (string | [string, ({
15
15
  match: import("../types/rule.js").MatcherType.String;
16
16
  } | {
17
17
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -19,8 +19,8 @@ export declare const noUnnecessaryWhitespace: {
19
19
  } | {
20
20
  match: import("../types/rule.js").MatcherType.ObjectValue;
21
21
  pathPattern?: string | undefined;
22
- })[]])[];
23
- variables: (string | [string, ({
22
+ })[]])[] | undefined;
23
+ variables?: (string | [string, ({
24
24
  match: import("../types/rule.js").MatcherType.String;
25
25
  } | {
26
26
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -28,8 +28,8 @@ export declare const noUnnecessaryWhitespace: {
28
28
  } | {
29
29
  match: import("../types/rule.js").MatcherType.ObjectValue;
30
30
  pathPattern?: string | undefined;
31
- })[]])[];
32
- attributes: (string | [string, ({
31
+ })[]])[] | undefined;
32
+ attributes?: (string | [string, ({
33
33
  match: import("../types/rule.js").MatcherType.String;
34
34
  } | {
35
35
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -37,8 +37,8 @@ export declare const noUnnecessaryWhitespace: {
37
37
  } | {
38
38
  match: import("../types/rule.js").MatcherType.ObjectValue;
39
39
  pathPattern?: string | undefined;
40
- })[]])[];
41
- callees: (string | [string, ({
40
+ })[]])[] | undefined;
41
+ callees?: (string | [string, ({
42
42
  match: import("../types/rule.js").MatcherType.String;
43
43
  } | {
44
44
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -46,7 +46,72 @@ export declare const noUnnecessaryWhitespace: {
46
46
  } | {
47
47
  match: import("../types/rule.js").MatcherType.ObjectValue;
48
48
  pathPattern?: string | undefined;
49
- })[]])[];
49
+ })[]])[] | undefined;
50
+ selectors: ({
51
+ callTarget?: number | "all" | "first" | "last" | undefined;
52
+ kind: import("../types/rule.js").SelectorKind.Callee;
53
+ match?: ({
54
+ type: import("../types/rule.js").MatcherType.String;
55
+ } | {
56
+ path?: string | undefined;
57
+ type: import("../types/rule.js").MatcherType.ObjectKey;
58
+ } | {
59
+ path?: string | undefined;
60
+ type: import("../types/rule.js").MatcherType.ObjectValue;
61
+ })[] | undefined;
62
+ name: string;
63
+ path?: string | undefined;
64
+ } | {
65
+ callTarget?: number | "all" | "first" | "last" | undefined;
66
+ kind: import("../types/rule.js").SelectorKind.Callee;
67
+ match?: ({
68
+ type: import("../types/rule.js").MatcherType.String;
69
+ } | {
70
+ path?: string | undefined;
71
+ type: import("../types/rule.js").MatcherType.ObjectKey;
72
+ } | {
73
+ path?: string | undefined;
74
+ type: import("../types/rule.js").MatcherType.ObjectValue;
75
+ })[] | undefined;
76
+ name?: string | undefined;
77
+ path: string;
78
+ } | {
79
+ kind: import("../types/rule.js").SelectorKind.Attribute;
80
+ match?: ({
81
+ type: import("../types/rule.js").MatcherType.String;
82
+ } | {
83
+ path?: string | undefined;
84
+ type: import("../types/rule.js").MatcherType.ObjectKey;
85
+ } | {
86
+ path?: string | undefined;
87
+ type: import("../types/rule.js").MatcherType.ObjectValue;
88
+ })[] | undefined;
89
+ name: string;
90
+ } | {
91
+ kind: import("../types/rule.js").SelectorKind.Tag;
92
+ match?: ({
93
+ type: import("../types/rule.js").MatcherType.String;
94
+ } | {
95
+ path?: string | undefined;
96
+ type: import("../types/rule.js").MatcherType.ObjectKey;
97
+ } | {
98
+ path?: string | undefined;
99
+ type: import("../types/rule.js").MatcherType.ObjectValue;
100
+ })[] | undefined;
101
+ name: string;
102
+ } | {
103
+ kind: import("../types/rule.js").SelectorKind.Variable;
104
+ match?: ({
105
+ type: import("../types/rule.js").MatcherType.String;
106
+ } | {
107
+ path?: string | undefined;
108
+ type: import("../types/rule.js").MatcherType.ObjectKey;
109
+ } | {
110
+ path?: string | undefined;
111
+ type: import("../types/rule.js").MatcherType.ObjectValue;
112
+ })[] | undefined;
113
+ name: string;
114
+ })[];
50
115
  } & {
51
116
  allowMultiline: boolean;
52
117
  };
@@ -62,7 +127,7 @@ export declare const noUnnecessaryWhitespace: {
62
127
  tailwindConfig?: string | undefined;
63
128
  messageStyle: "visual" | "compact" | "raw";
64
129
  entryPoint?: string | undefined;
65
- tags: (string | [string, ({
130
+ tags?: (string | [string, ({
66
131
  match: import("../types/rule.js").MatcherType.String;
67
132
  } | {
68
133
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -70,8 +135,8 @@ export declare const noUnnecessaryWhitespace: {
70
135
  } | {
71
136
  match: import("../types/rule.js").MatcherType.ObjectValue;
72
137
  pathPattern?: string | undefined;
73
- })[]])[];
74
- variables: (string | [string, ({
138
+ })[]])[] | undefined;
139
+ variables?: (string | [string, ({
75
140
  match: import("../types/rule.js").MatcherType.String;
76
141
  } | {
77
142
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -79,8 +144,8 @@ export declare const noUnnecessaryWhitespace: {
79
144
  } | {
80
145
  match: import("../types/rule.js").MatcherType.ObjectValue;
81
146
  pathPattern?: string | undefined;
82
- })[]])[];
83
- attributes: (string | [string, ({
147
+ })[]])[] | undefined;
148
+ attributes?: (string | [string, ({
84
149
  match: import("../types/rule.js").MatcherType.String;
85
150
  } | {
86
151
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -88,8 +153,8 @@ export declare const noUnnecessaryWhitespace: {
88
153
  } | {
89
154
  match: import("../types/rule.js").MatcherType.ObjectValue;
90
155
  pathPattern?: string | undefined;
91
- })[]])[];
92
- callees: (string | [string, ({
156
+ })[]])[] | undefined;
157
+ callees?: (string | [string, ({
93
158
  match: import("../types/rule.js").MatcherType.String;
94
159
  } | {
95
160
  match: import("../types/rule.js").MatcherType.ObjectKey;
@@ -97,7 +162,72 @@ export declare const noUnnecessaryWhitespace: {
97
162
  } | {
98
163
  match: import("../types/rule.js").MatcherType.ObjectValue;
99
164
  pathPattern?: string | undefined;
100
- })[]])[];
165
+ })[]])[] | undefined;
166
+ selectors: ({
167
+ callTarget?: number | "all" | "first" | "last" | undefined;
168
+ kind: import("../types/rule.js").SelectorKind.Callee;
169
+ match?: ({
170
+ type: import("../types/rule.js").MatcherType.String;
171
+ } | {
172
+ path?: string | undefined;
173
+ type: import("../types/rule.js").MatcherType.ObjectKey;
174
+ } | {
175
+ path?: string | undefined;
176
+ type: import("../types/rule.js").MatcherType.ObjectValue;
177
+ })[] | undefined;
178
+ name: string;
179
+ path?: string | undefined;
180
+ } | {
181
+ callTarget?: number | "all" | "first" | "last" | undefined;
182
+ kind: import("../types/rule.js").SelectorKind.Callee;
183
+ match?: ({
184
+ type: import("../types/rule.js").MatcherType.String;
185
+ } | {
186
+ path?: string | undefined;
187
+ type: import("../types/rule.js").MatcherType.ObjectKey;
188
+ } | {
189
+ path?: string | undefined;
190
+ type: import("../types/rule.js").MatcherType.ObjectValue;
191
+ })[] | undefined;
192
+ name?: string | undefined;
193
+ path: string;
194
+ } | {
195
+ kind: import("../types/rule.js").SelectorKind.Attribute;
196
+ match?: ({
197
+ type: import("../types/rule.js").MatcherType.String;
198
+ } | {
199
+ path?: string | undefined;
200
+ type: import("../types/rule.js").MatcherType.ObjectKey;
201
+ } | {
202
+ path?: string | undefined;
203
+ type: import("../types/rule.js").MatcherType.ObjectValue;
204
+ })[] | undefined;
205
+ name: string;
206
+ } | {
207
+ kind: import("../types/rule.js").SelectorKind.Tag;
208
+ match?: ({
209
+ type: import("../types/rule.js").MatcherType.String;
210
+ } | {
211
+ path?: string | undefined;
212
+ type: import("../types/rule.js").MatcherType.ObjectKey;
213
+ } | {
214
+ path?: string | undefined;
215
+ type: import("../types/rule.js").MatcherType.ObjectValue;
216
+ })[] | undefined;
217
+ name: string;
218
+ } | {
219
+ kind: import("../types/rule.js").SelectorKind.Variable;
220
+ match?: ({
221
+ type: import("../types/rule.js").MatcherType.String;
222
+ } | {
223
+ path?: string | undefined;
224
+ type: import("../types/rule.js").MatcherType.ObjectKey;
225
+ } | {
226
+ path?: string | undefined;
227
+ type: import("../types/rule.js").MatcherType.ObjectValue;
228
+ })[] | undefined;
229
+ name: string;
230
+ })[];
101
231
  } & {
102
232
  allowMultiline: boolean;
103
233
  }>];
@@ -1 +1 @@
1
- {"version":3,"file":"no-unnecessary-whitespace.d.ts","sourceRoot":"","sources":["../../src/rules/no-unnecessary-whitespace.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBlC,CAAC"}
1
+ {"version":3,"file":"no-unnecessary-whitespace.d.ts","sourceRoot":"","sources":["../../src/rules/no-unnecessary-whitespace.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBlC,CAAC"}
@@ -11,6 +11,12 @@ export declare enum MatcherType {
11
11
  /** Matches all strings that are not matched by another matcher. */
12
12
  String = "strings"
13
13
  }
14
+ export declare enum SelectorKind {
15
+ Attribute = "attribute",
16
+ Callee = "callee",
17
+ Tag = "tag",
18
+ Variable = "variable"
19
+ }
14
20
  export type Regex = string;
15
21
  export type StringMatcher = {
16
22
  match: MatcherType.String;
@@ -26,6 +32,39 @@ export type ObjectValueMatcher = {
26
32
  export type MatcherFunction<Node> = (node: unknown) => node is Node;
27
33
  export type MatcherFunctions<Node> = MatcherFunction<Node>[];
28
34
  export type Matcher = ObjectKeyMatcher | ObjectValueMatcher | StringMatcher;
35
+ export type SelectorStringMatcher = {
36
+ type: MatcherType.String;
37
+ };
38
+ export type SelectorObjectKeyMatcher = {
39
+ type: MatcherType.ObjectKey;
40
+ path?: Regex | undefined;
41
+ };
42
+ export type SelectorObjectValueMatcher = {
43
+ type: MatcherType.ObjectValue;
44
+ path?: Regex | undefined;
45
+ };
46
+ export type SelectorMatcher = SelectorObjectKeyMatcher | SelectorObjectValueMatcher | SelectorStringMatcher;
47
+ type BaseSelector<Kind extends SelectorKind> = {
48
+ kind: Kind;
49
+ name: Regex;
50
+ match?: SelectorMatcher[] | undefined;
51
+ };
52
+ export type AttributeSelector = BaseSelector<SelectorKind.Attribute>;
53
+ export type CallTarget = "all" | "first" | "last" | number;
54
+ export type CalleeSelector = {
55
+ kind: SelectorKind.Callee;
56
+ callTarget?: CallTarget | undefined;
57
+ match?: SelectorMatcher[] | undefined;
58
+ name?: Regex | undefined;
59
+ path?: Regex | undefined;
60
+ };
61
+ export type TagSelector = BaseSelector<SelectorKind.Tag>;
62
+ export type VariableSelector = BaseSelector<SelectorKind.Variable>;
63
+ export type Selector = AttributeSelector | CalleeSelector | TagSelector | VariableSelector;
64
+ export type Selectors = Selector[];
65
+ export type SelectorByKind<Kind extends SelectorKind> = Extract<Selector, {
66
+ kind: Kind;
67
+ }>;
29
68
  export type Version = {
30
69
  major: number;
31
70
  minor: number;
@@ -1 +1 @@
1
- {"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/types/rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE/G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAGjE,oBAAY,WAAW;IACrB,gDAAgD;IAChD,SAAS,eAAe;IACxB,kDAAkD;IAClD,WAAW,iBAAiB;IAC5B,oEAAoE;IACpE,MAAM,YAAY;CACnB;AAED,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,WAAW,CA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AO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,OAAO,CAAC,IAAI,SAAS,UAAU,GAAG,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AAE3G,MAAM,MAAM,SAAS,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,IAAI,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1G,MAAM,QAAQ,GACd,KAAK,CAAC;AAEV,KAAK,IAAI,CAAC,OAAO,SAAS,MAAM,IAC9B,OAAO,SAAS,IAAI,MAAM,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,GACzC,OAAO,SAAS,GAAG,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAC3C,OAAO,CAAC;AAEhB,MAAM,MAAM,gBAAgB,CAAC,QAAQ,SAAS,MAAM,IAClD,QAAQ,SAAS,GAAG,MAAM,KAAK,MAAM,WAAW,KAAK,MAAM,IAAI,EAAE,GAC7D,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,GAC1C,KAAK,CAAC"}
package/lib/types/rule.js CHANGED
@@ -7,4 +7,11 @@ export var MatcherType;
7
7
  /** Matches all strings that are not matched by another matcher. */
8
8
  MatcherType["String"] = "strings";
9
9
  })(MatcherType || (MatcherType = {}));
10
+ export var SelectorKind;
11
+ (function (SelectorKind) {
12
+ SelectorKind["Attribute"] = "attribute";
13
+ SelectorKind["Callee"] = "callee";
14
+ SelectorKind["Tag"] = "tag";
15
+ SelectorKind["Variable"] = "variable";
16
+ })(SelectorKind || (SelectorKind = {}));
10
17
  //# sourceMappingURL=rule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/types/rule.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,gDAAgD;IAChD,uCAAwB,CAAA;IACxB,kDAAkD;IAClD,2CAA4B,CAAA;IAC5B,oEAAoE;IACpE,iCAAkB,CAAA;AACpB,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB"}
1
+ {"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/types/rule.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,gDAAgD;IAChD,uCAAwB,CAAA;IACxB,kDAAkD;IAClD,2CAA4B,CAAA;IAC5B,oEAAoE;IACpE,iCAAkB,CAAA;AACpB,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB;AAED,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iCAAiB,CAAA;IACjB,2BAAW,CAAA;IACX,qCAAqB,CAAA;AACvB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/utils/rule.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAMnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EAEjB,UAAU,EACV,YAAY,EAEZ,MAAM,EACP,MAAM,kCAAkC,CAAC;AAG1C,wBAAgB,UAAU,CACxB,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7C,KAAK,CAAC,aAAa,SAAS,MAAM,GAAG,MAAM,EAC3C,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,aAAa,GAAG,UAAU,CAAC,aA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AE,iBAAiB,CAAC,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8J1F;AAED,wBAAgB,kBAAkB,CAAC,GAAG,SAAS,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC,YAAY,CAiLrK"}
package/lib/utils/rule.js CHANGED
@@ -3,6 +3,7 @@ import { dirname, resolve } from "node:path";
3
3
  import { toJsonSchema } from "@valibot/to-json-schema";
4
4
  import { getDefaults, strictObject } from "valibot";
5
5
  import { COMMON_OPTIONS } from "../options/descriptions.js";
6
+ import { migrateLegacySelectorsToFlatSelectors } from "../options/migrate.js";
6
7
  import { getAttributesByAngularElement, getLiteralsByAngularAttribute } from "../parsers/angular.js";
7
8
  import { getLiteralsByCSSAtRule } from "../parsers/css.js";
8
9
  import { getLiteralsByESCallExpression, getLiteralsByESVariableDeclarator, getLiteralsByTaggedTemplateExpression } from "../parsers/es.js";
@@ -10,8 +11,10 @@ import { getAttributesByHTMLTag, getLiteralsByHTMLAttribute } from "../parsers/h
10
11
  import { getAttributesByJSXElement, getLiteralsByJSXAttribute } from "../parsers/jsx.js";
11
12
  import { getAttributesBySvelteTag, getDirectivesBySvelteTag, getLiteralsBySvelteAttribute, getLiteralsBySvelteDirective } from "../parsers/svelte.js";
12
13
  import { getAttributesByVueStartTag, getLiteralsByVueAttribute } from "../parsers/vue.js";
14
+ import { SelectorKind } from "../types/rule.js";
13
15
  import { getLocByRange } from "./ast.js";
14
16
  import { resolveJson } from "../async-utils/resolvers.js";
17
+ import { isSelectorKind } from "./selectors.js";
15
18
  import { augmentMessageWithWarnings, escapeMessage } from "./utils.js";
16
19
  import { removeDefaults } from "./valibot.js";
17
20
  import { parseSemanticVersion } from "./version.js";
@@ -36,12 +39,45 @@ export function createRule(options) {
36
39
  const defaultOptions = schema ? getDefaults(schema) : {};
37
40
  const settings = eslintContext?.settings?.["eslint-plugin-better-tailwindcss"] ?? eslintContext?.settings?.["better-tailwindcss"] ?? {};
38
41
  const options = eslintContext?.options[0] ?? {};
39
- return {
42
+ const mergedOptions = {
40
43
  ...defaultSettings,
41
44
  ...defaultOptions,
42
45
  ...settings,
43
46
  ...options
44
47
  };
48
+ const migratedSelectors = migrateLegacySelectorsToFlatSelectors({
49
+ attributes: mergedOptions.attributes,
50
+ callees: mergedOptions.callees,
51
+ tags: mergedOptions.tags,
52
+ variables: mergedOptions.variables
53
+ });
54
+ const hasAttributeOverride = mergedOptions.attributes !== undefined;
55
+ const hasCalleeOverride = mergedOptions.callees !== undefined;
56
+ const hasTagOverride = mergedOptions.tags !== undefined;
57
+ const hasVariableOverride = mergedOptions.variables !== undefined;
58
+ const preservedSelectors = (mergedOptions.selectors ?? []).filter(selector => {
59
+ if (hasAttributeOverride && selector.kind === SelectorKind.Attribute) {
60
+ return false;
61
+ }
62
+ if (hasCalleeOverride && selector.kind === SelectorKind.Callee) {
63
+ return false;
64
+ }
65
+ if (hasTagOverride && selector.kind === SelectorKind.Tag) {
66
+ return false;
67
+ }
68
+ if (hasVariableOverride && selector.kind === SelectorKind.Variable) {
69
+ return false;
70
+ }
71
+ return true;
72
+ });
73
+ const selectors = [
74
+ ...migratedSelectors,
75
+ ...preservedSelectors
76
+ ];
77
+ return {
78
+ ...mergedOptions,
79
+ selectors
80
+ };
45
81
  };
46
82
  return {
47
83
  category,
@@ -116,7 +152,11 @@ export function createRule(options) {
116
152
  };
117
153
  }
118
154
  export function createRuleListener(ctx, context, lintLiterals) {
119
- const { attributes, callees, tags, variables } = context.options;
155
+ const selectors = context.options.selectors;
156
+ const attributes = selectors.filter(isSelectorKind(SelectorKind.Attribute));
157
+ const callees = selectors.filter(isSelectorKind(SelectorKind.Callee));
158
+ const tags = selectors.filter(isSelectorKind(SelectorKind.Tag));
159
+ const variables = selectors.filter(isSelectorKind(SelectorKind.Variable));
120
160
  const callExpression = {
121
161
  CallExpression(node) {
122
162
  const callExpressionNode = node;