eslint-plugin-better-tailwindcss 4.3.2 → 4.4.1

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 (178) hide show
  1. package/README.md +35 -0
  2. package/lib/api/defaults.d.ts +15 -0
  3. package/lib/api/defaults.d.ts.map +1 -1
  4. package/lib/api/types.d.ts +7 -2
  5. package/lib/api/types.d.ts.map +1 -1
  6. package/lib/api/types.js +4 -1
  7. package/lib/api/types.js.map +1 -1
  8. package/lib/async-utils/escape.d.ts.map +1 -1
  9. package/lib/async-utils/escape.js +2 -1
  10. package/lib/async-utils/escape.js.map +1 -1
  11. package/lib/async-utils/fs.d.ts +1 -1
  12. package/lib/async-utils/fs.d.ts.map +1 -1
  13. package/lib/async-utils/fs.js +2 -6
  14. package/lib/async-utils/fs.js.map +1 -1
  15. package/lib/async-utils/operations.d.ts +2 -0
  16. package/lib/async-utils/operations.d.ts.map +1 -1
  17. package/lib/async-utils/regex.d.ts +3 -0
  18. package/lib/async-utils/regex.d.ts.map +1 -0
  19. package/lib/async-utils/regex.js +32 -0
  20. package/lib/async-utils/regex.js.map +1 -0
  21. package/lib/async-utils/worker.d.ts.map +1 -1
  22. package/lib/async-utils/worker.js +3 -2
  23. package/lib/async-utils/worker.js.map +1 -1
  24. package/lib/configs/config.d.ts +2921 -33
  25. package/lib/configs/config.d.ts.map +1 -1
  26. package/lib/configs/config.js +4 -0
  27. package/lib/configs/config.js.map +1 -1
  28. package/lib/options/callees/cc.js +2 -2
  29. package/lib/options/callees/cc.js.map +1 -1
  30. package/lib/options/callees/clb.js +3 -3
  31. package/lib/options/callees/clb.js.map +1 -1
  32. package/lib/options/callees/clsx.js +2 -2
  33. package/lib/options/callees/clsx.js.map +1 -1
  34. package/lib/options/callees/cn.js +2 -2
  35. package/lib/options/callees/cn.js.map +1 -1
  36. package/lib/options/callees/cnb.js +2 -2
  37. package/lib/options/callees/cnb.js.map +1 -1
  38. package/lib/options/callees/ctl.js +1 -1
  39. package/lib/options/callees/ctl.js.map +1 -1
  40. package/lib/options/callees/cva.js +3 -3
  41. package/lib/options/callees/cva.js.map +1 -1
  42. package/lib/options/callees/cx.js +2 -2
  43. package/lib/options/callees/cx.js.map +1 -1
  44. package/lib/options/callees/dcnb.js +2 -2
  45. package/lib/options/callees/dcnb.js.map +1 -1
  46. package/lib/options/callees/objstr.js +2 -2
  47. package/lib/options/callees/objstr.js.map +1 -1
  48. package/lib/options/callees/tv.js +6 -6
  49. package/lib/options/callees/tv.js.map +1 -1
  50. package/lib/options/callees/twJoin.js +1 -1
  51. package/lib/options/callees/twJoin.js.map +1 -1
  52. package/lib/options/callees/twMerge.js +1 -1
  53. package/lib/options/callees/twMerge.js.map +1 -1
  54. package/lib/options/default-options.d.ts +31 -1
  55. package/lib/options/default-options.d.ts.map +1 -1
  56. package/lib/options/default-options.js +9 -3
  57. package/lib/options/default-options.js.map +1 -1
  58. package/lib/options/descriptions.d.ts +308 -2
  59. package/lib/options/descriptions.d.ts.map +1 -1
  60. package/lib/options/descriptions.js +3 -2
  61. package/lib/options/descriptions.js.map +1 -1
  62. package/lib/options/migrate.js +29 -12
  63. package/lib/options/migrate.js.map +1 -1
  64. package/lib/options/schemas/common.d.ts +4 -0
  65. package/lib/options/schemas/common.d.ts.map +1 -1
  66. package/lib/options/schemas/common.js +3 -0
  67. package/lib/options/schemas/common.js.map +1 -1
  68. package/lib/options/schemas/selectors.d.ts +806 -5
  69. package/lib/options/schemas/selectors.d.ts.map +1 -1
  70. package/lib/options/schemas/selectors.js +42 -11
  71. package/lib/options/schemas/selectors.js.map +1 -1
  72. package/lib/options/tags/twc.d.ts +36 -0
  73. package/lib/options/tags/twc.d.ts.map +1 -0
  74. package/lib/options/tags/twc.js +26 -0
  75. package/lib/options/tags/twc.js.map +1 -0
  76. package/lib/options/tags/twx.d.ts +36 -0
  77. package/lib/options/tags/twx.d.ts.map +1 -0
  78. package/lib/options/tags/twx.js +26 -0
  79. package/lib/options/tags/twx.js.map +1 -0
  80. package/lib/parsers/angular.d.ts.map +1 -1
  81. package/lib/parsers/angular.js +22 -12
  82. package/lib/parsers/angular.js.map +1 -1
  83. package/lib/parsers/es.d.ts +11 -2
  84. package/lib/parsers/es.d.ts.map +1 -1
  85. package/lib/parsers/es.js +249 -55
  86. package/lib/parsers/es.js.map +1 -1
  87. package/lib/parsers/svelte.d.ts.map +1 -1
  88. package/lib/parsers/svelte.js +6 -64
  89. package/lib/parsers/svelte.js.map +1 -1
  90. package/lib/parsers/vue.d.ts.map +1 -1
  91. package/lib/parsers/vue.js +5 -65
  92. package/lib/parsers/vue.js.map +1 -1
  93. package/lib/rules/enforce-canonical-classes.d.ts +172 -2
  94. package/lib/rules/enforce-canonical-classes.d.ts.map +1 -1
  95. package/lib/rules/enforce-consistent-class-order.d.ts +172 -2
  96. package/lib/rules/enforce-consistent-class-order.d.ts.map +1 -1
  97. package/lib/rules/enforce-consistent-class-order.js +14 -2
  98. package/lib/rules/enforce-consistent-class-order.js.map +1 -1
  99. package/lib/rules/enforce-consistent-important-position.d.ts +172 -2
  100. package/lib/rules/enforce-consistent-important-position.d.ts.map +1 -1
  101. package/lib/rules/enforce-consistent-important-position.js +2 -1
  102. package/lib/rules/enforce-consistent-important-position.js.map +1 -1
  103. package/lib/rules/enforce-consistent-line-wrapping.d.ts +172 -2
  104. package/lib/rules/enforce-consistent-line-wrapping.d.ts.map +1 -1
  105. package/lib/rules/enforce-consistent-line-wrapping.js +30 -0
  106. package/lib/rules/enforce-consistent-line-wrapping.js.map +1 -1
  107. package/lib/rules/enforce-consistent-variable-syntax.d.ts +172 -2
  108. package/lib/rules/enforce-consistent-variable-syntax.d.ts.map +1 -1
  109. package/lib/rules/enforce-consistent-variable-syntax.js +3 -2
  110. package/lib/rules/enforce-consistent-variable-syntax.js.map +1 -1
  111. package/lib/rules/enforce-consistent-variant-order.d.ts +426 -0
  112. package/lib/rules/enforce-consistent-variant-order.d.ts.map +1 -0
  113. package/lib/rules/enforce-consistent-variant-order.js +75 -0
  114. package/lib/rules/enforce-consistent-variant-order.js.map +1 -0
  115. package/lib/rules/enforce-logical-properties.d.ts +426 -0
  116. package/lib/rules/enforce-logical-properties.d.ts.map +1 -0
  117. package/lib/rules/enforce-logical-properties.js +118 -0
  118. package/lib/rules/enforce-logical-properties.js.map +1 -0
  119. package/lib/rules/enforce-shorthand-classes.d.ts +172 -2
  120. package/lib/rules/enforce-shorthand-classes.d.ts.map +1 -1
  121. package/lib/rules/no-conflicting-classes.d.ts +172 -2
  122. package/lib/rules/no-conflicting-classes.d.ts.map +1 -1
  123. package/lib/rules/no-deprecated-classes.d.ts +173 -3
  124. package/lib/rules/no-deprecated-classes.d.ts.map +1 -1
  125. package/lib/rules/no-duplicate-classes.d.ts +172 -2
  126. package/lib/rules/no-duplicate-classes.d.ts.map +1 -1
  127. package/lib/rules/no-restricted-classes.d.ts +172 -2
  128. package/lib/rules/no-restricted-classes.d.ts.map +1 -1
  129. package/lib/rules/no-unknown-classes.d.ts +172 -2
  130. package/lib/rules/no-unknown-classes.d.ts.map +1 -1
  131. package/lib/rules/no-unknown-classes.js +8 -7
  132. package/lib/rules/no-unknown-classes.js.map +1 -1
  133. package/lib/rules/no-unnecessary-whitespace.d.ts +172 -2
  134. package/lib/rules/no-unnecessary-whitespace.d.ts.map +1 -1
  135. package/lib/tailwindcss/dissect-classes.async.v3.d.ts.map +1 -1
  136. package/lib/tailwindcss/dissect-classes.async.v3.js +4 -3
  137. package/lib/tailwindcss/dissect-classes.async.v3.js.map +1 -1
  138. package/lib/tailwindcss/dissect-classes.async.v4.d.ts.map +1 -1
  139. package/lib/tailwindcss/dissect-classes.async.v4.js +6 -5
  140. package/lib/tailwindcss/dissect-classes.async.v4.js.map +1 -1
  141. package/lib/tailwindcss/tailwind.async.worker.v3.js +5 -0
  142. package/lib/tailwindcss/tailwind.async.worker.v3.js.map +1 -1
  143. package/lib/tailwindcss/tailwind.async.worker.v4.js +6 -0
  144. package/lib/tailwindcss/tailwind.async.worker.v4.js.map +1 -1
  145. package/lib/tailwindcss/variant-order.async.v3.d.ts +3 -0
  146. package/lib/tailwindcss/variant-order.async.v3.d.ts.map +1 -0
  147. package/lib/tailwindcss/variant-order.async.v3.js +4 -0
  148. package/lib/tailwindcss/variant-order.async.v3.js.map +1 -0
  149. package/lib/tailwindcss/variant-order.async.v4.d.ts +3 -0
  150. package/lib/tailwindcss/variant-order.async.v4.d.ts.map +1 -0
  151. package/lib/tailwindcss/variant-order.async.v4.js +18 -0
  152. package/lib/tailwindcss/variant-order.async.v4.js.map +1 -0
  153. package/lib/tailwindcss/variant-order.d.ts +11 -0
  154. package/lib/tailwindcss/variant-order.d.ts.map +1 -0
  155. package/lib/tailwindcss/variant-order.js +15 -0
  156. package/lib/tailwindcss/variant-order.js.map +1 -0
  157. package/lib/types/rule.d.ts +27 -5
  158. package/lib/types/rule.d.ts.map +1 -1
  159. package/lib/types/rule.js +7 -0
  160. package/lib/types/rule.js.map +1 -1
  161. package/lib/utils/context.js +5 -5
  162. package/lib/utils/context.js.map +1 -1
  163. package/lib/utils/matchers.d.ts +1 -3
  164. package/lib/utils/matchers.d.ts.map +1 -1
  165. package/lib/utils/matchers.js +56 -37
  166. package/lib/utils/matchers.js.map +1 -1
  167. package/lib/utils/project.d.ts +4 -0
  168. package/lib/utils/project.d.ts.map +1 -0
  169. package/lib/utils/project.js +22 -0
  170. package/lib/utils/project.js.map +1 -0
  171. package/lib/utils/rule.d.ts +1 -1
  172. package/lib/utils/rule.d.ts.map +1 -1
  173. package/lib/utils/rule.js +50 -10
  174. package/lib/utils/rule.js.map +1 -1
  175. package/lib/utils/utils.d.ts.map +1 -1
  176. package/lib/utils/utils.js +6 -5
  177. package/lib/utils/utils.js.map +1 -1
  178. package/package.json +22 -21
@@ -0,0 +1,426 @@
1
+ export declare const enforceConsistentVariantOrder: {
2
+ category: "stylistic";
3
+ messages: {
4
+ readonly order: "Incorrect variant order. '{{ className }}' should be '{{ fix }}'.";
5
+ } | undefined;
6
+ name: "enforce-consistent-variant-order";
7
+ readonly options: {
8
+ cwd?: string | undefined;
9
+ rootFontSize?: number | undefined;
10
+ detectComponentClasses: boolean;
11
+ tsconfig?: string | undefined;
12
+ tailwindConfig?: string | undefined;
13
+ messageStyle: "visual" | "compact" | "raw";
14
+ entryPoint?: string | undefined;
15
+ tags?: (string | [string, ({
16
+ match: import("../types/rule.js").MatcherType.String;
17
+ } | {
18
+ match: import("../types/rule.js").MatcherType.ObjectKey;
19
+ pathPattern?: string | undefined;
20
+ } | {
21
+ match: import("../types/rule.js").MatcherType.ObjectValue;
22
+ pathPattern?: string | undefined;
23
+ })[]])[] | undefined;
24
+ variables?: (string | [string, ({
25
+ match: import("../types/rule.js").MatcherType.String;
26
+ } | {
27
+ match: import("../types/rule.js").MatcherType.ObjectKey;
28
+ pathPattern?: string | undefined;
29
+ } | {
30
+ match: import("../types/rule.js").MatcherType.ObjectValue;
31
+ pathPattern?: string | undefined;
32
+ })[]])[] | undefined;
33
+ attributes?: (string | [string, ({
34
+ match: import("../types/rule.js").MatcherType.String;
35
+ } | {
36
+ match: import("../types/rule.js").MatcherType.ObjectKey;
37
+ pathPattern?: string | undefined;
38
+ } | {
39
+ match: import("../types/rule.js").MatcherType.ObjectValue;
40
+ pathPattern?: string | undefined;
41
+ })[]])[] | undefined;
42
+ callees?: (string | [string, ({
43
+ match: import("../types/rule.js").MatcherType.String;
44
+ } | {
45
+ match: import("../types/rule.js").MatcherType.ObjectKey;
46
+ pathPattern?: string | undefined;
47
+ } | {
48
+ match: import("../types/rule.js").MatcherType.ObjectValue;
49
+ pathPattern?: string | undefined;
50
+ })[]])[] | undefined;
51
+ selectors: ({
52
+ callTarget?: number | "all" | "first" | "last" | undefined;
53
+ kind: import("../types/rule.js").SelectorKind.Callee;
54
+ match?: ({
55
+ type: import("../types/rule.js").MatcherType.String;
56
+ } | {
57
+ path?: string | undefined;
58
+ type: import("../types/rule.js").MatcherType.ObjectKey;
59
+ } | {
60
+ path?: string | undefined;
61
+ type: import("../types/rule.js").MatcherType.ObjectValue;
62
+ } | {
63
+ match: ({
64
+ type: import("../types/rule.js").MatcherType.String;
65
+ } | {
66
+ path?: string | undefined;
67
+ type: import("../types/rule.js").MatcherType.ObjectKey;
68
+ } | {
69
+ path?: string | undefined;
70
+ type: import("../types/rule.js").MatcherType.ObjectValue;
71
+ })[];
72
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
73
+ })[] | undefined;
74
+ name: string;
75
+ path?: string | undefined;
76
+ targetArgument?: number | "all" | "first" | "last" | undefined;
77
+ targetCall?: number | "all" | "first" | "last" | undefined;
78
+ } | {
79
+ callTarget?: number | "all" | "first" | "last" | undefined;
80
+ kind: import("../types/rule.js").SelectorKind.Callee;
81
+ match?: ({
82
+ type: import("../types/rule.js").MatcherType.String;
83
+ } | {
84
+ path?: string | undefined;
85
+ type: import("../types/rule.js").MatcherType.ObjectKey;
86
+ } | {
87
+ path?: string | undefined;
88
+ type: import("../types/rule.js").MatcherType.ObjectValue;
89
+ } | {
90
+ match: ({
91
+ type: import("../types/rule.js").MatcherType.String;
92
+ } | {
93
+ path?: string | undefined;
94
+ type: import("../types/rule.js").MatcherType.ObjectKey;
95
+ } | {
96
+ path?: string | undefined;
97
+ type: import("../types/rule.js").MatcherType.ObjectValue;
98
+ })[];
99
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
100
+ })[] | undefined;
101
+ name?: string | undefined;
102
+ path: string;
103
+ targetArgument?: number | "all" | "first" | "last" | undefined;
104
+ targetCall?: number | "all" | "first" | "last" | undefined;
105
+ } | {
106
+ kind: import("../types/rule.js").SelectorKind.Tag;
107
+ match?: ({
108
+ type: import("../types/rule.js").MatcherType.String;
109
+ } | {
110
+ path?: string | undefined;
111
+ type: import("../types/rule.js").MatcherType.ObjectKey;
112
+ } | {
113
+ path?: string | undefined;
114
+ type: import("../types/rule.js").MatcherType.ObjectValue;
115
+ } | {
116
+ match: ({
117
+ type: import("../types/rule.js").MatcherType.String;
118
+ } | {
119
+ path?: string | undefined;
120
+ type: import("../types/rule.js").MatcherType.ObjectKey;
121
+ } | {
122
+ path?: string | undefined;
123
+ type: import("../types/rule.js").MatcherType.ObjectValue;
124
+ })[];
125
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
126
+ })[] | undefined;
127
+ name: string;
128
+ path?: string | undefined;
129
+ } | {
130
+ kind: import("../types/rule.js").SelectorKind.Tag;
131
+ match?: ({
132
+ type: import("../types/rule.js").MatcherType.String;
133
+ } | {
134
+ path?: string | undefined;
135
+ type: import("../types/rule.js").MatcherType.ObjectKey;
136
+ } | {
137
+ path?: string | undefined;
138
+ type: import("../types/rule.js").MatcherType.ObjectValue;
139
+ } | {
140
+ match: ({
141
+ type: import("../types/rule.js").MatcherType.String;
142
+ } | {
143
+ path?: string | undefined;
144
+ type: import("../types/rule.js").MatcherType.ObjectKey;
145
+ } | {
146
+ path?: string | undefined;
147
+ type: import("../types/rule.js").MatcherType.ObjectValue;
148
+ })[];
149
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
150
+ })[] | undefined;
151
+ name?: string | undefined;
152
+ path: string;
153
+ } | {
154
+ kind: import("../types/rule.js").SelectorKind.Attribute;
155
+ match?: ({
156
+ type: import("../types/rule.js").MatcherType.String;
157
+ } | {
158
+ path?: string | undefined;
159
+ type: import("../types/rule.js").MatcherType.ObjectKey;
160
+ } | {
161
+ path?: string | undefined;
162
+ type: import("../types/rule.js").MatcherType.ObjectValue;
163
+ } | {
164
+ match: ({
165
+ type: import("../types/rule.js").MatcherType.String;
166
+ } | {
167
+ path?: string | undefined;
168
+ type: import("../types/rule.js").MatcherType.ObjectKey;
169
+ } | {
170
+ path?: string | undefined;
171
+ type: import("../types/rule.js").MatcherType.ObjectValue;
172
+ })[];
173
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
174
+ })[] | undefined;
175
+ name: string;
176
+ } | {
177
+ kind: import("../types/rule.js").SelectorKind.Variable;
178
+ match?: ({
179
+ type: import("../types/rule.js").MatcherType.String;
180
+ } | {
181
+ path?: string | undefined;
182
+ type: import("../types/rule.js").MatcherType.ObjectKey;
183
+ } | {
184
+ path?: string | undefined;
185
+ type: import("../types/rule.js").MatcherType.ObjectValue;
186
+ } | {
187
+ match: ({
188
+ type: import("../types/rule.js").MatcherType.String;
189
+ } | {
190
+ path?: string | undefined;
191
+ type: import("../types/rule.js").MatcherType.ObjectKey;
192
+ } | {
193
+ path?: string | undefined;
194
+ type: import("../types/rule.js").MatcherType.ObjectValue;
195
+ })[];
196
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
197
+ })[] | undefined;
198
+ name: string;
199
+ })[];
200
+ } & {
201
+ [x: string]: unknown;
202
+ };
203
+ recommended: false;
204
+ rule: {
205
+ create: (ctx: import("node_modules/@eslint/core/dist/cjs/types.cjs").RuleContext<{
206
+ LangOptions: import("eslint").Linter.LanguageOptions;
207
+ Code: import("eslint").SourceCode;
208
+ RuleOptions: [Required<{
209
+ cwd?: string | undefined;
210
+ rootFontSize?: number | undefined;
211
+ detectComponentClasses: boolean;
212
+ tsconfig?: string | undefined;
213
+ tailwindConfig?: string | undefined;
214
+ messageStyle: "visual" | "compact" | "raw";
215
+ entryPoint?: string | undefined;
216
+ tags?: (string | [string, ({
217
+ match: import("../types/rule.js").MatcherType.String;
218
+ } | {
219
+ match: import("../types/rule.js").MatcherType.ObjectKey;
220
+ pathPattern?: string | undefined;
221
+ } | {
222
+ match: import("../types/rule.js").MatcherType.ObjectValue;
223
+ pathPattern?: string | undefined;
224
+ })[]])[] | undefined;
225
+ variables?: (string | [string, ({
226
+ match: import("../types/rule.js").MatcherType.String;
227
+ } | {
228
+ match: import("../types/rule.js").MatcherType.ObjectKey;
229
+ pathPattern?: string | undefined;
230
+ } | {
231
+ match: import("../types/rule.js").MatcherType.ObjectValue;
232
+ pathPattern?: string | undefined;
233
+ })[]])[] | undefined;
234
+ attributes?: (string | [string, ({
235
+ match: import("../types/rule.js").MatcherType.String;
236
+ } | {
237
+ match: import("../types/rule.js").MatcherType.ObjectKey;
238
+ pathPattern?: string | undefined;
239
+ } | {
240
+ match: import("../types/rule.js").MatcherType.ObjectValue;
241
+ pathPattern?: string | undefined;
242
+ })[]])[] | undefined;
243
+ callees?: (string | [string, ({
244
+ match: import("../types/rule.js").MatcherType.String;
245
+ } | {
246
+ match: import("../types/rule.js").MatcherType.ObjectKey;
247
+ pathPattern?: string | undefined;
248
+ } | {
249
+ match: import("../types/rule.js").MatcherType.ObjectValue;
250
+ pathPattern?: string | undefined;
251
+ })[]])[] | undefined;
252
+ selectors: ({
253
+ callTarget?: number | "all" | "first" | "last" | undefined;
254
+ kind: import("../types/rule.js").SelectorKind.Callee;
255
+ match?: ({
256
+ type: import("../types/rule.js").MatcherType.String;
257
+ } | {
258
+ path?: string | undefined;
259
+ type: import("../types/rule.js").MatcherType.ObjectKey;
260
+ } | {
261
+ path?: string | undefined;
262
+ type: import("../types/rule.js").MatcherType.ObjectValue;
263
+ } | {
264
+ match: ({
265
+ type: import("../types/rule.js").MatcherType.String;
266
+ } | {
267
+ path?: string | undefined;
268
+ type: import("../types/rule.js").MatcherType.ObjectKey;
269
+ } | {
270
+ path?: string | undefined;
271
+ type: import("../types/rule.js").MatcherType.ObjectValue;
272
+ })[];
273
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
274
+ })[] | undefined;
275
+ name: string;
276
+ path?: string | undefined;
277
+ targetArgument?: number | "all" | "first" | "last" | undefined;
278
+ targetCall?: number | "all" | "first" | "last" | undefined;
279
+ } | {
280
+ callTarget?: number | "all" | "first" | "last" | undefined;
281
+ kind: import("../types/rule.js").SelectorKind.Callee;
282
+ match?: ({
283
+ type: import("../types/rule.js").MatcherType.String;
284
+ } | {
285
+ path?: string | undefined;
286
+ type: import("../types/rule.js").MatcherType.ObjectKey;
287
+ } | {
288
+ path?: string | undefined;
289
+ type: import("../types/rule.js").MatcherType.ObjectValue;
290
+ } | {
291
+ match: ({
292
+ type: import("../types/rule.js").MatcherType.String;
293
+ } | {
294
+ path?: string | undefined;
295
+ type: import("../types/rule.js").MatcherType.ObjectKey;
296
+ } | {
297
+ path?: string | undefined;
298
+ type: import("../types/rule.js").MatcherType.ObjectValue;
299
+ })[];
300
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
301
+ })[] | undefined;
302
+ name?: string | undefined;
303
+ path: string;
304
+ targetArgument?: number | "all" | "first" | "last" | undefined;
305
+ targetCall?: number | "all" | "first" | "last" | undefined;
306
+ } | {
307
+ kind: import("../types/rule.js").SelectorKind.Tag;
308
+ match?: ({
309
+ type: import("../types/rule.js").MatcherType.String;
310
+ } | {
311
+ path?: string | undefined;
312
+ type: import("../types/rule.js").MatcherType.ObjectKey;
313
+ } | {
314
+ path?: string | undefined;
315
+ type: import("../types/rule.js").MatcherType.ObjectValue;
316
+ } | {
317
+ match: ({
318
+ type: import("../types/rule.js").MatcherType.String;
319
+ } | {
320
+ path?: string | undefined;
321
+ type: import("../types/rule.js").MatcherType.ObjectKey;
322
+ } | {
323
+ path?: string | undefined;
324
+ type: import("../types/rule.js").MatcherType.ObjectValue;
325
+ })[];
326
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
327
+ })[] | undefined;
328
+ name: string;
329
+ path?: string | undefined;
330
+ } | {
331
+ kind: import("../types/rule.js").SelectorKind.Tag;
332
+ match?: ({
333
+ type: import("../types/rule.js").MatcherType.String;
334
+ } | {
335
+ path?: string | undefined;
336
+ type: import("../types/rule.js").MatcherType.ObjectKey;
337
+ } | {
338
+ path?: string | undefined;
339
+ type: import("../types/rule.js").MatcherType.ObjectValue;
340
+ } | {
341
+ match: ({
342
+ type: import("../types/rule.js").MatcherType.String;
343
+ } | {
344
+ path?: string | undefined;
345
+ type: import("../types/rule.js").MatcherType.ObjectKey;
346
+ } | {
347
+ path?: string | undefined;
348
+ type: import("../types/rule.js").MatcherType.ObjectValue;
349
+ })[];
350
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
351
+ })[] | undefined;
352
+ name?: string | undefined;
353
+ path: string;
354
+ } | {
355
+ kind: import("../types/rule.js").SelectorKind.Attribute;
356
+ match?: ({
357
+ type: import("../types/rule.js").MatcherType.String;
358
+ } | {
359
+ path?: string | undefined;
360
+ type: import("../types/rule.js").MatcherType.ObjectKey;
361
+ } | {
362
+ path?: string | undefined;
363
+ type: import("../types/rule.js").MatcherType.ObjectValue;
364
+ } | {
365
+ match: ({
366
+ type: import("../types/rule.js").MatcherType.String;
367
+ } | {
368
+ path?: string | undefined;
369
+ type: import("../types/rule.js").MatcherType.ObjectKey;
370
+ } | {
371
+ path?: string | undefined;
372
+ type: import("../types/rule.js").MatcherType.ObjectValue;
373
+ })[];
374
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
375
+ })[] | undefined;
376
+ name: string;
377
+ } | {
378
+ kind: import("../types/rule.js").SelectorKind.Variable;
379
+ match?: ({
380
+ type: import("../types/rule.js").MatcherType.String;
381
+ } | {
382
+ path?: string | undefined;
383
+ type: import("../types/rule.js").MatcherType.ObjectKey;
384
+ } | {
385
+ path?: string | undefined;
386
+ type: import("../types/rule.js").MatcherType.ObjectValue;
387
+ } | {
388
+ match: ({
389
+ type: import("../types/rule.js").MatcherType.String;
390
+ } | {
391
+ path?: string | undefined;
392
+ type: import("../types/rule.js").MatcherType.ObjectKey;
393
+ } | {
394
+ path?: string | undefined;
395
+ type: import("../types/rule.js").MatcherType.ObjectValue;
396
+ })[];
397
+ type: import("../types/rule.js").MatcherType.AnonymousFunctionReturn;
398
+ })[] | undefined;
399
+ name: string;
400
+ })[];
401
+ } & {
402
+ [x: string]: unknown;
403
+ }>];
404
+ Node: import("eslint").JSSyntaxElement;
405
+ MessageIds: "order";
406
+ }>) => import("eslint").Rule.RuleListener;
407
+ meta: {
408
+ messages?: {
409
+ readonly order: "Incorrect variant order. '{{ className }}' should be '{{ fix }}'.";
410
+ };
411
+ docs: {
412
+ description: string;
413
+ recommended: boolean;
414
+ url: string;
415
+ };
416
+ fixable: "code" | undefined;
417
+ schema: {
418
+ additionalProperties: false;
419
+ properties: Record<string, boolean | import("@valibot/to-json-schema").JsonSchema> | undefined;
420
+ type: "object";
421
+ }[];
422
+ type: "problem" | "layout";
423
+ };
424
+ };
425
+ };
426
+ //# sourceMappingURL=enforce-consistent-variant-order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enforce-consistent-variant-order.d.ts","sourceRoot":"","sources":["../../src/rules/enforce-consistent-variant-order.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoExC,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { createGetDissectedClasses, getDissectedClasses } from "../tailwindcss/dissect-classes.js";
2
+ import { createGetVariantOrder, getVariantOrder } from "../tailwindcss/variant-order.js";
3
+ import { buildClass } from "../utils/class.js";
4
+ import { async } from "../utils/context.js";
5
+ import { lintClasses } from "../utils/lint.js";
6
+ import { createRule } from "../utils/rule.js";
7
+ import { splitClasses } from "../utils/utils.js";
8
+ export const enforceConsistentVariantOrder = createRule({
9
+ autofix: true,
10
+ category: "stylistic",
11
+ description: "Enforce a consistent variant order for Tailwind classes.",
12
+ docs: "https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-variant-order.md",
13
+ name: "enforce-consistent-variant-order",
14
+ recommended: false,
15
+ messages: {
16
+ order: "Incorrect variant order. '{{ className }}' should be '{{ fix }}'."
17
+ },
18
+ initialize: ctx => {
19
+ createGetDissectedClasses(ctx);
20
+ createGetVariantOrder(ctx);
21
+ },
22
+ lintLiterals: (ctx, literals) => {
23
+ if (ctx.version.major <= 3) {
24
+ return;
25
+ }
26
+ for (const literal of literals) {
27
+ const classes = splitClasses(literal.content);
28
+ const { dissectedClasses, warnings: dissectedWarnings } = getDissectedClasses(async(ctx), classes);
29
+ const { variantOrder, warnings } = getVariantOrder(async(ctx), classes);
30
+ const allWarnings = [...dissectedWarnings, ...warnings];
31
+ lintClasses(ctx, literal, className => {
32
+ const dissectedClass = dissectedClasses[className];
33
+ if (!dissectedClass?.variants || dissectedClass.variants.length <= 1) {
34
+ return;
35
+ }
36
+ if (dissectedClass.variants.some(variant => variantOrder[variant] === undefined)) {
37
+ return;
38
+ }
39
+ const sortedVariants = dissectedClass.variants.toSorted((variantA, variantB) => {
40
+ return compareVariantOrder(variantOrder[variantA], variantOrder[variantB]);
41
+ });
42
+ if (dissectedClass.variants.every((value, index) => value === sortedVariants[index])) {
43
+ return false;
44
+ }
45
+ const fix = buildClass(ctx, {
46
+ ...dissectedClass,
47
+ variants: sortedVariants
48
+ });
49
+ return {
50
+ data: {
51
+ className,
52
+ fix
53
+ },
54
+ fix,
55
+ id: "order",
56
+ warnings: allWarnings
57
+ };
58
+ });
59
+ }
60
+ }
61
+ });
62
+ function compareVariantOrder(orderA, orderB) {
63
+ if (orderA === orderB) {
64
+ return 0;
65
+ }
66
+ if (orderA === undefined) {
67
+ return +1;
68
+ }
69
+ if (orderB === undefined) {
70
+ return -1;
71
+ }
72
+ // Match Tailwind language service behavior: variants with higher order index come first.
73
+ return +(orderB - orderA > 0) - +(orderB - orderA < 0);
74
+ }
75
+ //# sourceMappingURL=enforce-consistent-variant-order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enforce-consistent-variant-order.js","sourceRoot":"","sources":["../../src/rules/enforce-consistent-variant-order.ts"],"names":[],"mappings":"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"}