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 enforceLogicalProperties: {
2
+ category: "stylistic";
3
+ messages: {
4
+ readonly replaceable: "Physical class detected. Replace \"{{ className }}\" with logical class \"{{fix}}\".";
5
+ } | undefined;
6
+ name: "enforce-logical-properties";
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: "replaceable";
406
+ }>) => import("eslint").Rule.RuleListener;
407
+ meta: {
408
+ messages?: {
409
+ readonly replaceable: "Physical class detected. Replace \"{{ className }}\" with logical class \"{{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-logical-properties.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enforce-logical-properties.d.ts","sourceRoot":"","sources":["../../src/rules/enforce-logical-properties.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBnC,CAAC"}
@@ -0,0 +1,118 @@
1
+ import { createGetDissectedClasses, getDissectedClasses } from "../tailwindcss/dissect-classes.js";
2
+ import { createGetUnknownClasses, getUnknownClasses } from "../tailwindcss/unknown-classes.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 { replacePlaceholders, splitClasses } from "../utils/utils.js";
8
+ export const enforceLogicalProperties = createRule({
9
+ autofix: true,
10
+ category: "stylistic",
11
+ description: "Enforce logical property class names instead of physical directions.",
12
+ docs: "https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-logical-properties.md",
13
+ name: "enforce-logical-properties",
14
+ recommended: false,
15
+ messages: {
16
+ replaceable: "Physical class detected. Replace \"{{ className }}\" with logical class \"{{fix}}\"."
17
+ },
18
+ initialize: ctx => {
19
+ createGetDissectedClasses(ctx);
20
+ createGetUnknownClasses(ctx);
21
+ },
22
+ lintLiterals: (ctx, literals) => lintLiterals(ctx, literals)
23
+ });
24
+ const mappings = [
25
+ [/^pl-(.*)$/, "ps-$1"],
26
+ [/^pr-(.*)$/, "pe-$1"],
27
+ [/^pt-(.*)$/, "pbs-$1"],
28
+ [/^pb-(.*)$/, "pbe-$1"],
29
+ [/^ml-(.*)$/, "ms-$1"],
30
+ [/^mr-(.*)$/, "me-$1"],
31
+ [/^mt-(.*)$/, "mbs-$1"],
32
+ [/^mb-(.*)$/, "mbe-$1"],
33
+ [/^scroll-ml-(.*)$/, "scroll-ms-$1"],
34
+ [/^scroll-mr-(.*)$/, "scroll-me-$1"],
35
+ [/^scroll-pl-(.*)$/, "scroll-ps-$1"],
36
+ [/^scroll-pr-(.*)$/, "scroll-pe-$1"],
37
+ [/^scroll-mt-(.*)$/, "scroll-mbs-$1"],
38
+ [/^scroll-mb-(.*)$/, "scroll-mbe-$1"],
39
+ [/^scroll-pt-(.*)$/, "scroll-pbs-$1"],
40
+ [/^scroll-pb-(.*)$/, "scroll-pbe-$1"],
41
+ [/^left-(.*)$/, "inset-s-$1"],
42
+ [/^right-(.*)$/, "inset-e-$1"],
43
+ [/^top-(.*)$/, "inset-bs-$1"],
44
+ [/^bottom-(.*)$/, "inset-be-$1"],
45
+ [/^border-l$/, "border-s"],
46
+ [/^border-l-(.*)$/, "border-s-$1"],
47
+ [/^border-r$/, "border-e"],
48
+ [/^border-r-(.*)$/, "border-e-$1"],
49
+ [/^border-t$/, "border-bs"],
50
+ [/^border-t-(.*)$/, "border-bs-$1"],
51
+ [/^border-b$/, "border-be"],
52
+ [/^border-b-(.*)$/, "border-be-$1"],
53
+ [/^rounded-l$/, "rounded-s"],
54
+ [/^rounded-l-(.*)$/, "rounded-s-$1"],
55
+ [/^rounded-r$/, "rounded-e"],
56
+ [/^rounded-r-(.*)$/, "rounded-e-$1"],
57
+ [/^rounded-tl$/, "rounded-ss"],
58
+ [/^rounded-tl-(.*)$/, "rounded-ss-$1"],
59
+ [/^rounded-tr$/, "rounded-se"],
60
+ [/^rounded-tr-(.*)$/, "rounded-se-$1"],
61
+ [/^rounded-br$/, "rounded-ee"],
62
+ [/^rounded-br-(.*)$/, "rounded-ee-$1"],
63
+ [/^rounded-bl$/, "rounded-es"],
64
+ [/^rounded-bl-(.*)$/, "rounded-es-$1"],
65
+ [/^text-left$/, "text-start"],
66
+ [/^text-right$/, "text-end"],
67
+ [/^float-left$/, "float-start"],
68
+ [/^float-right$/, "float-end"],
69
+ [/^clear-left$/, "clear-start"],
70
+ [/^clear-right$/, "clear-end"]
71
+ ];
72
+ function lintLiterals(ctx, literals) {
73
+ for (const literal of literals) {
74
+ const classes = splitClasses(literal.content);
75
+ const { dissectedClasses, warnings } = getDissectedClasses(async(ctx), classes);
76
+ const possibleFixes = Object.values(dissectedClasses).flatMap(dissectedClass => {
77
+ const replacementBase = getReplacementBase(dissectedClass.base);
78
+ if (!replacementBase) {
79
+ return [];
80
+ }
81
+ return [buildClass(ctx, { ...dissectedClass, base: replacementBase })];
82
+ });
83
+ const { unknownClasses } = getUnknownClasses(async(ctx), possibleFixes);
84
+ lintClasses(ctx, literal, className => {
85
+ const dissectedClass = dissectedClasses[className];
86
+ if (!dissectedClass) {
87
+ return;
88
+ }
89
+ const replacementBase = getReplacementBase(dissectedClass.base);
90
+ if (!replacementBase) {
91
+ return;
92
+ }
93
+ const fix = buildClass(ctx, { ...dissectedClass, base: replacementBase });
94
+ if (unknownClasses.includes(fix)) {
95
+ return;
96
+ }
97
+ return {
98
+ data: {
99
+ className,
100
+ fix
101
+ },
102
+ fix,
103
+ id: "replaceable",
104
+ warnings
105
+ };
106
+ });
107
+ }
108
+ }
109
+ function getReplacementBase(base) {
110
+ for (const [pattern, replacement] of mappings) {
111
+ const match = base.match(pattern);
112
+ if (!match) {
113
+ continue;
114
+ }
115
+ return replacePlaceholders(replacement, match);
116
+ }
117
+ }
118
+ //# sourceMappingURL=enforce-logical-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enforce-logical-properties.js","sourceRoot":"","sources":["../../src/rules/enforce-logical-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AACnH,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAMtF,MAAM,CAAC,MAAM,wBAAwB,GAAG,UAAU,CAAC;IACjD,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,WAAW;IACrB,WAAW,EAAE,sEAAsE;IACnF,IAAI,EAAE,gHAAgH;IACtH,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,KAAK;IAElB,QAAQ,EAAE;QACR,WAAW,EAAE,sFAAsF;KACpG;IAED,UAAU,EAAE,GAAG,CAAC,EAAE;QAChB,yBAAyB,CAAC,GAAG,CAAC,CAAC;QAC/B,uBAAuB,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC;CAC7D,CAAC,CAAC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