@allxsmith/eslint-plugin-bestax 1.1.9 → 1.2.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.
- package/README.md +13 -7
- package/dist/generated/metadata.d.ts.map +1 -1
- package/dist/generated/metadata.js +6 -0
- package/dist/lib/values.d.ts +36 -6
- package/dist/lib/values.d.ts.map +1 -1
- package/dist/lib/values.js +64 -9
- package/dist/rules/valid-helper-value.d.ts +6 -5
- package/dist/rules/valid-helper-value.d.ts.map +1 -1
- package/dist/rules/valid-helper-value.js +39 -11
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -150,17 +150,23 @@ One family is outside its reach, knowingly: component-specific `color` props
|
|
|
150
150
|
have their own unions, so `<Button color="ghost">` is correct and reporting it
|
|
151
151
|
would be worse than reporting nothing.
|
|
152
152
|
|
|
153
|
-
`radius` on `Theme`
|
|
154
|
-
|
|
155
|
-
rule reports it with a message that says
|
|
156
|
-
it is a near miss of
|
|
153
|
+
`radius` and `columnGap` on `Theme` are the helpers, as everywhere else, but a
|
|
154
|
+
string outside their values still sets `--bulma-radius` or `--bulma-column-gap`
|
|
155
|
+
there through a deprecated route. The rule reports it with a message that says
|
|
156
|
+
so and points at `bulmaVars`, unless it is a near miss of one of the values,
|
|
157
|
+
which gets the usual suggestion:
|
|
157
158
|
|
|
158
159
|
```jsx
|
|
159
|
-
<Theme radius="6px" />
|
|
160
|
-
<Theme radius="radiusles" />
|
|
161
|
-
<Theme bulmaVars={{ '--bulma-radius': '6px' }} />
|
|
160
|
+
<Theme radius="6px" /> // ✗ deprecated → bulmaVars
|
|
161
|
+
<Theme radius="radiusles" /> // ✗ Did you mean `radiusless`?
|
|
162
|
+
<Theme bulmaVars={{ '--bulma-radius': '6px' }} /> // ✓
|
|
163
|
+
<Theme columnGap="1rem" /> // ✗ deprecated → bulmaVars
|
|
164
|
+
<Theme bulmaVars={{ '--bulma-column-gap': '1rem' }} /> // ✓
|
|
162
165
|
```
|
|
163
166
|
|
|
167
|
+
The gap props take their steps as numbers as well, so `<Box gap={2} />` is
|
|
168
|
+
accepted where `<Box m={2} />` is reported.
|
|
169
|
+
|
|
164
170
|
### no-deprecated-props
|
|
165
171
|
|
|
166
172
|
```jsx
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/generated/metadata.ts"],"names":[],"mappings":"AAIA,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CACrC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/generated/metadata.ts"],"names":[],"mappings":"AAIA,uEAAuE;AACvE,MAAM,WAAW,WAAW;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CACrC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAuItD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAUtD,CAAC;AAEF,mDAAmD;AACnD,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,mBAAmB,CAwGzE,CAAC"}
|
|
@@ -89,6 +89,12 @@ export const DEPRECATED_PROPS = {
|
|
|
89
89
|
note: 'Use `variant` and `features` instead.',
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
|
+
'Popover.Close': {
|
|
93
|
+
isFullWidth: {
|
|
94
|
+
replacement: 'isFullwidth',
|
|
95
|
+
note: 'Use `isFullwidth` instead — `isFullwidth` wins if both are set.',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
92
98
|
Select: {
|
|
93
99
|
isFullWidth: {
|
|
94
100
|
replacement: 'isFullwidth',
|
package/dist/lib/values.d.ts
CHANGED
|
@@ -46,20 +46,33 @@
|
|
|
46
46
|
* riding along.
|
|
47
47
|
*/
|
|
48
48
|
export declare const HELPER_VALUES: ReadonlyMap<string, readonly string[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Props that take their steps as numbers as well as strings, so `gap={2}`
|
|
51
|
+
* renders `is-gap-2` where `m={2}` renders nothing.
|
|
52
|
+
*
|
|
53
|
+
* The gap props are the case: `Grid` took its gaps as numbers before they
|
|
54
|
+
* were shared helper props, and every gap prop still does. A number is
|
|
55
|
+
* judged against the tuple read as strings, so `gap={1.5}` is accepted and
|
|
56
|
+
* `gap={9}` is not. On `Columns` the tuple is its own whole steps, from
|
|
57
|
+
* ELEMENT_VALUES, so `<Columns gap={1.5} />` is reported.
|
|
58
|
+
*/
|
|
59
|
+
export declare const NUMERIC_STEPS: ReadonlySet<string>;
|
|
49
60
|
/**
|
|
50
61
|
* Props whose only value REMOVES the thing the prop names, and what to call
|
|
51
62
|
* that thing in a message.
|
|
52
63
|
*
|
|
53
|
-
* `
|
|
54
|
-
*
|
|
55
|
-
* `shadowless
|
|
56
|
-
*
|
|
57
|
-
* the opposite of what they meant, on an element whose shadow is on by
|
|
64
|
+
* `shadow` reads like a switch for "give this a shadow", and its one value
|
|
65
|
+
* does the reverse: `shadowless`. The generic shorthand remedy, "give it a
|
|
66
|
+
* value: `shadowless`", therefore tells an author who wrote `<Box shadow />`
|
|
67
|
+
* to do the opposite of what they meant, on an element whose shadow is on by
|
|
58
68
|
* default. The report is right either way; only the remedy needed separating.
|
|
59
69
|
*
|
|
70
|
+
* `radius` left this map when it took Bulma's radius sizes, so `<Box radius />`
|
|
71
|
+
* now gets the ordinary remedy, whose list includes values that add one.
|
|
72
|
+
*
|
|
60
73
|
* The rule pairs this with a `valid.length === 1` check rather than trusting
|
|
61
74
|
* it alone, so "its only value" cannot become false by a value being added to
|
|
62
|
-
*
|
|
75
|
+
* a prop's tuple.
|
|
63
76
|
*/
|
|
64
77
|
export declare const REMOVES_ONLY: ReadonlyMap<string, string>;
|
|
65
78
|
/**
|
|
@@ -81,6 +94,11 @@ export declare const REMOVES_ONLY: ReadonlyMap<string, string>;
|
|
|
81
94
|
* Only a string takes that route. A number or `true` goes to the helper on
|
|
82
95
|
* `Theme` as well, so the ordinary messages about those stay true.
|
|
83
96
|
*
|
|
97
|
+
* `columnGap` is the same story one release later: `--bulma-column-gap` minted
|
|
98
|
+
* it as a variable prop, untyped but working, until the gap helpers became
|
|
99
|
+
* shared helper props. A string that is not a gap step still sets the
|
|
100
|
+
* variable on `Theme`, so `<Theme columnGap="1rem" />` gets the same report.
|
|
101
|
+
*
|
|
84
102
|
* `--bulma-shadow` would have collided the same way and was kept out of
|
|
85
103
|
* Theme's variable map from the start, so `shadow` needs no entry.
|
|
86
104
|
*
|
|
@@ -92,6 +110,18 @@ export declare const REMOVES_ONLY: ReadonlyMap<string, string>;
|
|
|
92
110
|
* falsify becomes a fiction.
|
|
93
111
|
*/
|
|
94
112
|
export declare const DEPRECATED_VARIABLE_ROUTE: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
113
|
+
/**
|
|
114
|
+
* Props an element declares itself with narrower values than the helper prop
|
|
115
|
+
* of the same name. Keyed by element, then by prop, to the values the element
|
|
116
|
+
* renders, and read before `HELPER_VALUES`.
|
|
117
|
+
*
|
|
118
|
+
* `Columns` declares its own `gap`, the columns gutter, which renders
|
|
119
|
+
* `is-<n>` and comes in whole steps only. Judged against `validGaps`, a half
|
|
120
|
+
* step there passed although it renders nothing, and a report listed the
|
|
121
|
+
* half steps as valid. The whole steps are read off the library's tuple
|
|
122
|
+
* rather than copied.
|
|
123
|
+
*/
|
|
124
|
+
export declare const ELEMENT_VALUES: ReadonlyMap<string, ReadonlyMap<string, readonly string[]>>;
|
|
95
125
|
/** Props that emit a class only when a flex `display` is also set. */
|
|
96
126
|
export declare const FLEX_CONTAINER_PROPS: readonly string[];
|
|
97
127
|
/** Every `display*` prop name, in declaration order. */
|
package/dist/lib/values.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/lib/values.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/lib/values.ts"],"names":[],"mappings":"AAgGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CA6C/D,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAI5C,CAAC;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAEnD,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CACjD,MAAM,EACN,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAS3B,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,WAAW,CACtC,MAAM,EACN,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAMtC,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAMjD,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAG1C,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAA4B,CAAC"}
|
package/dist/lib/values.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* does not. See eslint-plugin/CLAUDE.md, which also records why the dependency
|
|
14
14
|
* is a runtime one and must stay that way.
|
|
15
15
|
*/
|
|
16
|
-
import { validAlignContents, validAlignItems, validAlignSelfs, validAlignments, validColorShades, validColors, validCursors, validDisplays, validFlexDirections, validFlexGrowShrink, validFlexWraps, validFloats, validFontFamilies, validInteractions, validJustifyContents, validOverflows, validRadii, validResponsives, validSchemeColors, validShadows, validSizes, validTextSizes, validTextTransforms, validTextWeights, validViewports, validVisibilities, } from '@allxsmith/bestax-bulma/constants';
|
|
16
|
+
import { validAlignContents, validAlignItems, validAlignSelfs, validAlignments, validAspectRatios, validAxisOverflows, validColorShades, validColors, validCursors, validDisplays, validFlexDirections, validFlexGrowShrink, validFlexWraps, validFloats, validFontFamilies, validGaps, validInteractions, validJustifyContents, validOverflows, validPositions, validRadii, validResponsives, validSchemeColors, validShadows, validSizes, validTextSizes, validTextTransforms, validTextWeights, validViewports, validVisibilities, } from '@allxsmith/bestax-bulma/constants';
|
|
17
17
|
const SPACING_PROPS = [
|
|
18
18
|
'm',
|
|
19
19
|
'mt',
|
|
@@ -122,11 +122,20 @@ export const HELPER_VALUES = new Map([
|
|
|
122
122
|
['viewport', validViewports],
|
|
123
123
|
['float', validFloats],
|
|
124
124
|
['overflow', validOverflows],
|
|
125
|
+
['overflowX', validAxisOverflows],
|
|
126
|
+
['overflowY', validAxisOverflows],
|
|
125
127
|
['interaction', validInteractions],
|
|
126
128
|
['cursor', validCursors],
|
|
127
129
|
['radius', validRadii],
|
|
128
130
|
['shadow', validShadows],
|
|
129
131
|
['responsive', validResponsives],
|
|
132
|
+
['pos', validPositions],
|
|
133
|
+
['aspectRatio', validAspectRatios],
|
|
134
|
+
// `gapless` is a boolean and stays out, like the other switches. The steps
|
|
135
|
+
// are also accepted as numbers; see NUMERIC_STEPS.
|
|
136
|
+
['gap', validGaps],
|
|
137
|
+
['columnGap', validGaps],
|
|
138
|
+
['rowGap', validGaps],
|
|
130
139
|
['colorShade', validColorShades],
|
|
131
140
|
['backgroundColorShade', validColorShades],
|
|
132
141
|
// The colour props take the tuple plus the two CSS-wide keywords that
|
|
@@ -138,23 +147,39 @@ export const HELPER_VALUES = new Map([
|
|
|
138
147
|
[...validColors, ...validSchemeColors, 'inherit', 'current'],
|
|
139
148
|
],
|
|
140
149
|
]);
|
|
150
|
+
/**
|
|
151
|
+
* Props that take their steps as numbers as well as strings, so `gap={2}`
|
|
152
|
+
* renders `is-gap-2` where `m={2}` renders nothing.
|
|
153
|
+
*
|
|
154
|
+
* The gap props are the case: `Grid` took its gaps as numbers before they
|
|
155
|
+
* were shared helper props, and every gap prop still does. A number is
|
|
156
|
+
* judged against the tuple read as strings, so `gap={1.5}` is accepted and
|
|
157
|
+
* `gap={9}` is not. On `Columns` the tuple is its own whole steps, from
|
|
158
|
+
* ELEMENT_VALUES, so `<Columns gap={1.5} />` is reported.
|
|
159
|
+
*/
|
|
160
|
+
export const NUMERIC_STEPS = new Set([
|
|
161
|
+
'gap',
|
|
162
|
+
'columnGap',
|
|
163
|
+
'rowGap',
|
|
164
|
+
]);
|
|
141
165
|
/**
|
|
142
166
|
* Props whose only value REMOVES the thing the prop names, and what to call
|
|
143
167
|
* that thing in a message.
|
|
144
168
|
*
|
|
145
|
-
* `
|
|
146
|
-
*
|
|
147
|
-
* `shadowless
|
|
148
|
-
*
|
|
149
|
-
* the opposite of what they meant, on an element whose shadow is on by
|
|
169
|
+
* `shadow` reads like a switch for "give this a shadow", and its one value
|
|
170
|
+
* does the reverse: `shadowless`. The generic shorthand remedy, "give it a
|
|
171
|
+
* value: `shadowless`", therefore tells an author who wrote `<Box shadow />`
|
|
172
|
+
* to do the opposite of what they meant, on an element whose shadow is on by
|
|
150
173
|
* default. The report is right either way; only the remedy needed separating.
|
|
151
174
|
*
|
|
175
|
+
* `radius` left this map when it took Bulma's radius sizes, so `<Box radius />`
|
|
176
|
+
* now gets the ordinary remedy, whose list includes values that add one.
|
|
177
|
+
*
|
|
152
178
|
* The rule pairs this with a `valid.length === 1` check rather than trusting
|
|
153
179
|
* it alone, so "its only value" cannot become false by a value being added to
|
|
154
|
-
*
|
|
180
|
+
* a prop's tuple.
|
|
155
181
|
*/
|
|
156
182
|
export const REMOVES_ONLY = new Map([
|
|
157
|
-
['radius', 'border radius'],
|
|
158
183
|
['shadow', 'shadow'],
|
|
159
184
|
]);
|
|
160
185
|
/**
|
|
@@ -176,6 +201,11 @@ export const REMOVES_ONLY = new Map([
|
|
|
176
201
|
* Only a string takes that route. A number or `true` goes to the helper on
|
|
177
202
|
* `Theme` as well, so the ordinary messages about those stay true.
|
|
178
203
|
*
|
|
204
|
+
* `columnGap` is the same story one release later: `--bulma-column-gap` minted
|
|
205
|
+
* it as a variable prop, untyped but working, until the gap helpers became
|
|
206
|
+
* shared helper props. A string that is not a gap step still sets the
|
|
207
|
+
* variable on `Theme`, so `<Theme columnGap="1rem" />` gets the same report.
|
|
208
|
+
*
|
|
179
209
|
* `--bulma-shadow` would have collided the same way and was kept out of
|
|
180
210
|
* Theme's variable map from the start, so `shadow` needs no entry.
|
|
181
211
|
*
|
|
@@ -186,7 +216,32 @@ export const REMOVES_ONLY = new Map([
|
|
|
186
216
|
* in check-conformance.mjs, and for the same reason: a declaration no test can
|
|
187
217
|
* falsify becomes a fiction.
|
|
188
218
|
*/
|
|
189
|
-
export const DEPRECATED_VARIABLE_ROUTE = new Map([
|
|
219
|
+
export const DEPRECATED_VARIABLE_ROUTE = new Map([
|
|
220
|
+
[
|
|
221
|
+
'Theme',
|
|
222
|
+
new Map([
|
|
223
|
+
['radius', '--bulma-radius'],
|
|
224
|
+
['columnGap', '--bulma-column-gap'],
|
|
225
|
+
]),
|
|
226
|
+
],
|
|
227
|
+
]);
|
|
228
|
+
/**
|
|
229
|
+
* Props an element declares itself with narrower values than the helper prop
|
|
230
|
+
* of the same name. Keyed by element, then by prop, to the values the element
|
|
231
|
+
* renders, and read before `HELPER_VALUES`.
|
|
232
|
+
*
|
|
233
|
+
* `Columns` declares its own `gap`, the columns gutter, which renders
|
|
234
|
+
* `is-<n>` and comes in whole steps only. Judged against `validGaps`, a half
|
|
235
|
+
* step there passed although it renders nothing, and a report listed the
|
|
236
|
+
* half steps as valid. The whole steps are read off the library's tuple
|
|
237
|
+
* rather than copied.
|
|
238
|
+
*/
|
|
239
|
+
export const ELEMENT_VALUES = new Map([
|
|
240
|
+
[
|
|
241
|
+
'Columns',
|
|
242
|
+
new Map([['gap', validGaps.filter(step => !step.includes('.'))]]),
|
|
243
|
+
],
|
|
244
|
+
]);
|
|
190
245
|
/** Props that emit a class only when a flex `display` is also set. */
|
|
191
246
|
export const FLEX_CONTAINER_PROPS = [
|
|
192
247
|
'flexDirection',
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
* It is deliberately not a substitute for typechecking, and the overlap on
|
|
26
26
|
* `.tsx` is expected rather than a defect.
|
|
27
27
|
*
|
|
28
|
-
* The table is keyed by prop rather than by element. The
|
|
29
|
-
* particular element the rule needs
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* The table is keyed by prop rather than by element. The facts about a
|
|
29
|
+
* particular element the rule needs are `ELEMENT_VALUES`, for a prop an
|
|
30
|
+
* element declares with narrower values (`Columns`' whole-step `gap`), and
|
|
31
|
+
* `DEPRECATED_VARIABLE_ROUTE`: on `Theme`, a `radius` or `columnGap` string
|
|
32
|
+
* outside the tuple still sets a variable through a deprecated route, so that
|
|
33
|
+
* report says so rather than claiming nothing renders. A near miss of a valid value still gets the suggestion
|
|
33
34
|
* there, because it is most likely that value mistyped, and pointing it at
|
|
34
35
|
* `bulmaVars` would only move the typo.
|
|
35
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valid-helper-value.d.ts","sourceRoot":"","sources":["../../src/rules/valid-helper-value.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"valid-helper-value.d.ts","sourceRoot":"","sources":["../../src/rules/valid-helper-value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAyDnC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,UA4IhB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEPRECATED_VARIABLE_ROUTE, HELPER_VALUES, REMOVES_ONLY, } from '../lib/values.js';
|
|
1
|
+
import { DEPRECATED_VARIABLE_ROUTE, ELEMENT_VALUES, HELPER_VALUES, NUMERIC_STEPS, REMOVES_ONLY, } from '../lib/values.js';
|
|
2
2
|
import { isTrueValue, literalValue, numericValue, elementOf, valuesThatRender, withImports, } from '../lib/elements.js';
|
|
3
3
|
/**
|
|
4
4
|
* Closest valid values by a cheap edit-distance, for the message.
|
|
@@ -6,10 +6,17 @@ import { isTrueValue, literalValue, numericValue, elementOf, valuesThatRender, w
|
|
|
6
6
|
* Short values are not suggested for: every entry of a numeric scale is one
|
|
7
7
|
* edit from `"8"`, so `textSize="8"` would be answered with "did you mean 1
|
|
8
8
|
* or 2 or 3", where the full list of valid values is what actually helps.
|
|
9
|
+
*
|
|
10
|
+
* Nor is a number with a unit. `"8px"` is a CSS length, not a mistyped step,
|
|
11
|
+
* and it is two edits from the bare digit `8`, so the gap props answered it
|
|
12
|
+
* with "did you mean `8`?", a 4rem gap, where on Theme the `bulmaVars` remedy
|
|
13
|
+
* was the true one.
|
|
9
14
|
*/
|
|
10
15
|
function suggest(value, valid) {
|
|
11
16
|
if (value.length < 3)
|
|
12
17
|
return [];
|
|
18
|
+
if (/^[\d.]+[a-z%]+$/i.test(value))
|
|
19
|
+
return [];
|
|
13
20
|
const distance = (a, b) => {
|
|
14
21
|
const d = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
|
|
15
22
|
for (let i = 0; i <= a.length; i++)
|
|
@@ -39,11 +46,12 @@ const rule = {
|
|
|
39
46
|
},
|
|
40
47
|
schema: [],
|
|
41
48
|
messages: {
|
|
42
|
-
invalid: '`{{prop}}="{{value}}"` is not a value {{prop}} accepts, so
|
|
43
|
-
invalidWithSuggestion: '`{{prop}}="{{value}}"` is not a value {{prop}} accepts, so
|
|
44
|
-
numeric: '`{{prop}}={{{value}}}` is a number, and {{prop}} is matched against strings, so
|
|
49
|
+
invalid: '`{{prop}}="{{value}}"` is not a value {{prop}} accepts, so nothing renders. Valid values: {{valid}}.',
|
|
50
|
+
invalidWithSuggestion: '`{{prop}}="{{value}}"` is not a value {{prop}} accepts, so nothing renders. Did you mean {{suggestions}}?',
|
|
51
|
+
numeric: '`{{prop}}={{{value}}}` is a number, and {{prop}} is matched against strings, so nothing renders. Write `{{prop}}="{{value}}"`.',
|
|
45
52
|
numericInvalid: '`{{prop}}={{{value}}}` is a number, and {{prop}} is matched against strings. `"{{value}}"` is not a value it accepts either. Valid values: {{valid}}.',
|
|
46
|
-
|
|
53
|
+
numericStepInvalid: '`{{prop}}={{{value}}}` is not a step {{prop}} accepts, so nothing renders. Valid values: {{valid}}.',
|
|
54
|
+
shorthand: '`{{prop}}` is `true` here, and {{prop}} is matched against strings, so nothing renders. Give it a value: {{valid}}.',
|
|
47
55
|
shorthandRemoves: '`{{prop}}` is `true` here, and {{prop}} is matched against strings, so nothing renders. It is also not a switch: its only value {{valid}} REMOVES the {{thing}}. Omit `{{prop}}` to keep the {{thing}}, or write `{{prop}}="{{only}}"` to remove it.',
|
|
48
56
|
deprecatedVariable: "`{{prop}}=\"{{value}}\"` is not a value {{prop}} accepts, so on {{element}} it sets `{{cssVar}}` instead, through a deprecated route. If a {{prop}} of `{{value}}` is what you meant, write `bulmaVars={{ '{{cssVar}}': '{{value}}' }}`. Valid values: {{valid}}.",
|
|
49
57
|
deprecatedVariableWithSuggestion: '`{{prop}}="{{value}}"` is not a value {{prop}} accepts, so on {{element}} it sets `{{cssVar}}` instead, through a deprecated route. Did you mean {{suggestions}}?',
|
|
@@ -59,21 +67,24 @@ const rule = {
|
|
|
59
67
|
if (element === null)
|
|
60
68
|
return;
|
|
61
69
|
// Props whose out-of-tuple strings still set a variable on this
|
|
62
|
-
// element. `Theme`'s `radius`
|
|
70
|
+
// element. `Theme`'s `radius` and `columnGap` are the cases; see
|
|
63
71
|
// DEPRECATED_VARIABLE_ROUTE.
|
|
64
72
|
const routes = DEPRECATED_VARIABLE_ROUTE.get(element);
|
|
73
|
+
// Props this element declares with its own, narrower values; see
|
|
74
|
+
// ELEMENT_VALUES.
|
|
75
|
+
const own = ELEMENT_VALUES.get(element);
|
|
65
76
|
for (const attr of valuesThatRender(opening)) {
|
|
66
77
|
const prop = attr.name.name;
|
|
67
|
-
const valid = HELPER_VALUES.get(prop);
|
|
78
|
+
const valid = own?.get(prop) ?? HELPER_VALUES.get(prop);
|
|
68
79
|
if (!valid)
|
|
69
80
|
continue;
|
|
70
81
|
// `true`, bare or explicit, matches no tuple of strings. Same
|
|
71
82
|
// argument as the numeric case, one type further out.
|
|
72
83
|
if (isTrueValue(attr)) {
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
84
|
+
// A prop in REMOVES_ONLY is where a shorthand is most natural and
|
|
85
|
+
// most wrong, because its one value removes rather than adds. The
|
|
86
|
+
// length check is what keeps "its only value" true rather than
|
|
87
|
+
// trusting the table to stay a single value.
|
|
77
88
|
const thing = REMOVES_ONLY.get(prop);
|
|
78
89
|
const removes = thing !== undefined && valid.length === 1;
|
|
79
90
|
context.report({
|
|
@@ -93,6 +104,23 @@ const rule = {
|
|
|
93
104
|
// quotes, not the value.
|
|
94
105
|
const numeric = numericValue(attr);
|
|
95
106
|
if (numeric !== null) {
|
|
107
|
+
// A prop that takes its steps as numbers renders a valid one, so
|
|
108
|
+
// only a number that is not a step is worth a report, and the
|
|
109
|
+
// quotes are not the fix.
|
|
110
|
+
if (NUMERIC_STEPS.has(prop)) {
|
|
111
|
+
if (!valid.includes(String(numeric))) {
|
|
112
|
+
context.report({
|
|
113
|
+
node: attr,
|
|
114
|
+
messageId: 'numericStepInvalid',
|
|
115
|
+
data: {
|
|
116
|
+
prop,
|
|
117
|
+
value: String(numeric),
|
|
118
|
+
valid: valid.map(v => `\`${v}\``).join(', '),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
96
124
|
context.report({
|
|
97
125
|
node: attr,
|
|
98
126
|
messageId: valid.includes(String(numeric))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allxsmith/eslint-plugin-bestax",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "ESLint rules for @allxsmith/bestax-bulma — catches helper-prop values the library silently drops, deprecated props, and the color-as-surface mistake",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"url": "https://github.com/allxsmith/bestax/issues"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@allxsmith/bestax-bulma": "^5.
|
|
44
|
+
"@allxsmith/bestax-bulma": "^5.26.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"eslint": "^10.0.0"
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"clean": "rimraf dist",
|
|
73
73
|
"release": "npx semantic-release"
|
|
74
74
|
},
|
|
75
|
-
"readme": "# @allxsmith/eslint-plugin-bestax\n\n[](https://www.npmjs.com/package/@allxsmith/eslint-plugin-bestax)\n[](https://www.npmjs.com/package/@allxsmith/eslint-plugin-bestax)\n[](https://www.npmjs.com/package/@allxsmith/eslint-plugin-bestax#provenance)\n[](https://opensource.org/licenses/MIT)\n[](https://socket.dev/npm/package/@allxsmith/eslint-plugin-bestax/overview)\n[](https://scorecard.dev/viewer/?uri=github.com/allxsmith/bestax)\n[](https://www.bestpractices.dev/projects/14361)\n[](https://github.com/allxsmith/bestax/blob/main/SECURITY.md)\n\nESLint rules for [`@allxsmith/bestax-bulma`](https://www.npmjs.com/package/@allxsmith/bestax-bulma).\n\nEvery rule here reports code that does not do what it looks like it does. The\nlibrary's helper props validate by membership and emit nothing for a value they\ndo not recognise, with no throw and no warning, so `textColor=\"blue\"` renders\nnothing and says nothing.\n\n**Scope, up front:** the helper props are typed as literal unions, so if you\nwrite bestax in `.tsx` and run `tsc`, it already catches a wrong literal. This\nplugin is for the places that check does not reach: JavaScript and JSX\nprojects, and lint stages that run before or instead of typechecking. The deprecation and flex rules are additive everywhere, since\nno type error marks a deprecated prop or a flex prop that emits nothing.\n\n## Requirements\n\nESLint 10, using [flat config](https://eslint.org/docs/latest/use/configure/configuration-files).\nThe plugin is ESM-only, which does not rule out a CommonJS config. An\n`eslint.config.cjs` can `require()` it on a Node that supports `require(esm)`,\nand `configs.recommended` reads straight off the result with no interop hop,\nbecause `rules` and `configs` are named exports alongside the default. On a\nNode without that support it throws `ERR_REQUIRE_ESM`, and an `import` from\n`eslint.config.mjs` works either way.\n\n## Setup\n\n```bash\nnpm install --save-dev @allxsmith/eslint-plugin-bestax\n```\n\n### TypeScript\n\nThe preset sets no `parser`, so a TypeScript parser has to come from a config\nobject of your own. Put it first; the preset after:\n\n```js\n// eslint.config.js\nimport bestax from '@allxsmith/eslint-plugin-bestax';\nimport parser from '@typescript-eslint/parser';\n\nexport default [\n { files: ['**/*.{ts,tsx}'], languageOptions: { parser } },\n bestax.configs.recommended,\n];\n```\n\nAny TypeScript setup that sets a parser works the same way, `typescript-eslint`\nincluded, precisely because the preset does not set one of its own.\n\nThe parser is a requirement, not a nicety. The preset matches `.tsx` because\nthat is where a TypeScript project's JSX lives, and with no parser supplied it\nhands that file to the default one, which stops at the first type annotation:\n`Parsing error: The keyword 'interface' is reserved`.\n\n### JavaScript and JSX\n\nIf the project contains no `.tsx` at all, the preset alone is enough:\n\n```js\n// eslint.config.js\nimport bestax from '@allxsmith/eslint-plugin-bestax';\n\nexport default [bestax.configs.recommended];\n```\n\nAdd one `.tsx` file later and you need the parser block above. The failure is\nloud rather than silent, which is the intended trade: leaving `.tsx` out of the\npreset's own `files` would mean a TypeScript project got no rules on any `.tsx`\nfile and no indication why.\n\n### Picking rules yourself\n\n`files` is load-bearing: a flat config object without it inherits ESLint's\ndefault `**/*.{js,mjs,cjs}` set, so leaving it out silently lints none of your\nJSX.\n\n```js\nimport bestax from '@allxsmith/eslint-plugin-bestax';\n\nexport default [\n {\n files: ['**/*.{jsx,tsx}'],\n plugins: { '@allxsmith/bestax': bestax },\n languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },\n rules: {\n '@allxsmith/bestax/valid-helper-value': 'error',\n '@allxsmith/bestax/no-deprecated-props': 'warn',\n },\n },\n];\n```\n\n## Rules\n\nIn `recommended` — each reports code that does not do what it says:\n\n| Rule | Fixable | What it catches |\n| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `valid-helper-value` | — | Helper values the library silently drops: `textAlign=\"center\"` (it is `centered`), `textSize=\"8\"`, `mt=\"1rem\"` |\n| `no-deprecated-props` | partly | Props the library deprecated: `isFullWidth`, `gapSize*`, `icon`. Fixes only the renames that cannot change what renders |\n| `no-inert-flex-props` | — | `justifyContent` and friends without a flex `display`, which emit nothing |\n\nOpt-in — these report code that works, and buy explicitness instead:\n\n| Rule | Fixable | What it asks for |\n| -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |\n| `no-color-as-surface` | yes | `textColor` instead of the `color` alias, where `color` cannot mean a surface |\n| `no-bulma-component-class` | — | The bestax component instead of a plain element styled with its Bulma class (`<button className=\"button\">`) |\n\nThe rules that judge bestax elements resolve them through the import and\nthrough scope, so neither your own `<Box>` nor a local shadowing the imported\none is linted against Bulma's rules, and each skips a value it cannot read as a\nliteral. `no-bulma-component-class` reads plain HTML elements instead, and\nleaves components, custom elements and anything inside `<svg>` alone.\n\nA spread is handled by what it can change: `no-color-as-surface` and\n`no-inert-flex-props` go silent, since a spread may carry the prop that makes\nthe code correct; `no-deprecated-props` reports but offers no fix; and\n`valid-helper-value` judges only the values that actually render, so a spread\nBEFORE the attribute leaves it reporting and a spread after it does not: JSX is\nlast-wins throughout, spreads included. `no-bulma-component-class` reports\neither way, since the class is written right there. No autofix changes what the\ncode renders.\n\n### valid-helper-value\n\n```jsx\n<Box textAlign=\"center\" /> // ✗ not a value textAlign accepts. Did you mean `centered`?\n<Box textAlign=\"centered\" /> // ✓\n```\n\nThe valid values come from the library's own exported tuples at lint time, by\nway of its `/constants` subpath, rather than from a list copied into this\npackage. The version those tuples come from is the copy of\n`@allxsmith/bestax-bulma` this plugin resolves, which in an ordinary deduped\ninstall is the same one your app uses; across a major bump it may not be, so\nkeep the two in step.\n\nOne family is outside its reach, knowingly: component-specific `color` props\nhave their own unions, so `<Button color=\"ghost\">` is correct and reporting it\nwould be worse than reporting nothing.\n\n`radius` on `Theme` is the helper, as everywhere else, but a string outside\nits values still sets `--bulma-radius` there through a deprecated route. The\nrule reports it with a message that says so and points at `bulmaVars`, unless\nit is a near miss of `radiusless`, which gets the usual suggestion:\n\n```jsx\n<Theme radius=\"6px\" /> // ✗ deprecated → bulmaVars\n<Theme radius=\"radiusles\" /> // ✗ Did you mean `radiusless`?\n<Theme bulmaVars={{ '--bulma-radius': '6px' }} /> // ✓\n```\n\n### no-deprecated-props\n\n```jsx\n<Button isFullWidth /> // ✗ deprecated → fixes to isFullwidth\n<Tabs color=\"info\" /> // ✗ no .tabs.is-<color> CSS exists; no fix offered\n```\n\nThe table is generated from the library's own TSDoc, so a rename lands here\nwith the library rather than after someone notices.\n\n### no-color-as-surface\n\nOff by default. `color` on the content elements is a documented alias for\n`textColor`, so this rule is about saying which you meant, not about broken\ncode.\n\n```jsx\n<Box color=\"primary\" /> // ✗ ambiguous → fixes to textColor\n<Box bgColor=\"primary\" /> // ✓ a coloured surface\n<Button color=\"primary\" /> // ✓ Button really has an is-primary variant\n\n// ✓ silent: the background is explicit, so `color` is plainly the text half\n<Box bgColor=\"info\" color=\"primary\" />\n```\n\n### no-bulma-component-class\n\nOff by default. It reports a plain element styled with a Bulma class that\nbestax has a component for, and names the component. Turn it on in an app that\nhas moved onto bestax, with `bestax-migrate bulma-classes` or by hand, to keep\nraw Bulma markup from coming back.\n\n```jsx\n<button className=\"button is-primary\" /> // ✗ bestax renders .button as Button\n<div className=\"dropdown\" /> // ✗ bestax has Dropdown, converted by hand\n<div className=\"has-text-centered mt-4\" /> // ✓ helper classes are left alone\n<p className=\"help\" /> // ✓ bestax renders .help inside its form controls\n```\n\nIt reads the classes a `className` spells out, including the strings in a\nternary, a template, or a call to `clsx`, `classnames` or `tailwind-merge`\n(however the file imports or requires it), and reports one class per element:\nthe one the codemod would decide by. A function your app defines, a `cn` in `lib/utils`\nincluded, is one it cannot see into, so it reads nothing there. It only reports. Whether an element converts\ndepends on its tag, attributes and children, and `bestax-migrate bulma-classes`\nis the one place that judges that.\n\n### no-inert-flex-props\n\n```jsx\n<Box justifyContent=\"center\" /> // ✗ emits nothing\n<Box display=\"flex\" justifyContent=\"center\" /> // ✓\n<Box flexGrow=\"1\" /> // ✓ child props always apply\n```\n\n## Links\n\n- [Documentation](https://bestax.io/docs/guides/getting-started/eslint-plugin)\n- [Component library](https://www.npmjs.com/package/@allxsmith/bestax-bulma)\n- [Repository](https://github.com/allxsmith/bestax)\n\n## License\n\nMIT\n"
|
|
75
|
+
"readme": "# @allxsmith/eslint-plugin-bestax\n\n[](https://www.npmjs.com/package/@allxsmith/eslint-plugin-bestax)\n[](https://www.npmjs.com/package/@allxsmith/eslint-plugin-bestax)\n[](https://www.npmjs.com/package/@allxsmith/eslint-plugin-bestax#provenance)\n[](https://opensource.org/licenses/MIT)\n[](https://socket.dev/npm/package/@allxsmith/eslint-plugin-bestax/overview)\n[](https://scorecard.dev/viewer/?uri=github.com/allxsmith/bestax)\n[](https://www.bestpractices.dev/projects/14361)\n[](https://github.com/allxsmith/bestax/blob/main/SECURITY.md)\n\nESLint rules for [`@allxsmith/bestax-bulma`](https://www.npmjs.com/package/@allxsmith/bestax-bulma).\n\nEvery rule here reports code that does not do what it looks like it does. The\nlibrary's helper props validate by membership and emit nothing for a value they\ndo not recognise, with no throw and no warning, so `textColor=\"blue\"` renders\nnothing and says nothing.\n\n**Scope, up front:** the helper props are typed as literal unions, so if you\nwrite bestax in `.tsx` and run `tsc`, it already catches a wrong literal. This\nplugin is for the places that check does not reach: JavaScript and JSX\nprojects, and lint stages that run before or instead of typechecking. The deprecation and flex rules are additive everywhere, since\nno type error marks a deprecated prop or a flex prop that emits nothing.\n\n## Requirements\n\nESLint 10, using [flat config](https://eslint.org/docs/latest/use/configure/configuration-files).\nThe plugin is ESM-only, which does not rule out a CommonJS config. An\n`eslint.config.cjs` can `require()` it on a Node that supports `require(esm)`,\nand `configs.recommended` reads straight off the result with no interop hop,\nbecause `rules` and `configs` are named exports alongside the default. On a\nNode without that support it throws `ERR_REQUIRE_ESM`, and an `import` from\n`eslint.config.mjs` works either way.\n\n## Setup\n\n```bash\nnpm install --save-dev @allxsmith/eslint-plugin-bestax\n```\n\n### TypeScript\n\nThe preset sets no `parser`, so a TypeScript parser has to come from a config\nobject of your own. Put it first; the preset after:\n\n```js\n// eslint.config.js\nimport bestax from '@allxsmith/eslint-plugin-bestax';\nimport parser from '@typescript-eslint/parser';\n\nexport default [\n { files: ['**/*.{ts,tsx}'], languageOptions: { parser } },\n bestax.configs.recommended,\n];\n```\n\nAny TypeScript setup that sets a parser works the same way, `typescript-eslint`\nincluded, precisely because the preset does not set one of its own.\n\nThe parser is a requirement, not a nicety. The preset matches `.tsx` because\nthat is where a TypeScript project's JSX lives, and with no parser supplied it\nhands that file to the default one, which stops at the first type annotation:\n`Parsing error: The keyword 'interface' is reserved`.\n\n### JavaScript and JSX\n\nIf the project contains no `.tsx` at all, the preset alone is enough:\n\n```js\n// eslint.config.js\nimport bestax from '@allxsmith/eslint-plugin-bestax';\n\nexport default [bestax.configs.recommended];\n```\n\nAdd one `.tsx` file later and you need the parser block above. The failure is\nloud rather than silent, which is the intended trade: leaving `.tsx` out of the\npreset's own `files` would mean a TypeScript project got no rules on any `.tsx`\nfile and no indication why.\n\n### Picking rules yourself\n\n`files` is load-bearing: a flat config object without it inherits ESLint's\ndefault `**/*.{js,mjs,cjs}` set, so leaving it out silently lints none of your\nJSX.\n\n```js\nimport bestax from '@allxsmith/eslint-plugin-bestax';\n\nexport default [\n {\n files: ['**/*.{jsx,tsx}'],\n plugins: { '@allxsmith/bestax': bestax },\n languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },\n rules: {\n '@allxsmith/bestax/valid-helper-value': 'error',\n '@allxsmith/bestax/no-deprecated-props': 'warn',\n },\n },\n];\n```\n\n## Rules\n\nIn `recommended` — each reports code that does not do what it says:\n\n| Rule | Fixable | What it catches |\n| --------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |\n| `valid-helper-value` | — | Helper values the library silently drops: `textAlign=\"center\"` (it is `centered`), `textSize=\"8\"`, `mt=\"1rem\"` |\n| `no-deprecated-props` | partly | Props the library deprecated: `isFullWidth`, `gapSize*`, `icon`. Fixes only the renames that cannot change what renders |\n| `no-inert-flex-props` | — | `justifyContent` and friends without a flex `display`, which emit nothing |\n\nOpt-in — these report code that works, and buy explicitness instead:\n\n| Rule | Fixable | What it asks for |\n| -------------------------- | ------- | ----------------------------------------------------------------------------------------------------------- |\n| `no-color-as-surface` | yes | `textColor` instead of the `color` alias, where `color` cannot mean a surface |\n| `no-bulma-component-class` | — | The bestax component instead of a plain element styled with its Bulma class (`<button className=\"button\">`) |\n\nThe rules that judge bestax elements resolve them through the import and\nthrough scope, so neither your own `<Box>` nor a local shadowing the imported\none is linted against Bulma's rules, and each skips a value it cannot read as a\nliteral. `no-bulma-component-class` reads plain HTML elements instead, and\nleaves components, custom elements and anything inside `<svg>` alone.\n\nA spread is handled by what it can change: `no-color-as-surface` and\n`no-inert-flex-props` go silent, since a spread may carry the prop that makes\nthe code correct; `no-deprecated-props` reports but offers no fix; and\n`valid-helper-value` judges only the values that actually render, so a spread\nBEFORE the attribute leaves it reporting and a spread after it does not: JSX is\nlast-wins throughout, spreads included. `no-bulma-component-class` reports\neither way, since the class is written right there. No autofix changes what the\ncode renders.\n\n### valid-helper-value\n\n```jsx\n<Box textAlign=\"center\" /> // ✗ not a value textAlign accepts. Did you mean `centered`?\n<Box textAlign=\"centered\" /> // ✓\n```\n\nThe valid values come from the library's own exported tuples at lint time, by\nway of its `/constants` subpath, rather than from a list copied into this\npackage. The version those tuples come from is the copy of\n`@allxsmith/bestax-bulma` this plugin resolves, which in an ordinary deduped\ninstall is the same one your app uses; across a major bump it may not be, so\nkeep the two in step.\n\nOne family is outside its reach, knowingly: component-specific `color` props\nhave their own unions, so `<Button color=\"ghost\">` is correct and reporting it\nwould be worse than reporting nothing.\n\n`radius` and `columnGap` on `Theme` are the helpers, as everywhere else, but a\nstring outside their values still sets `--bulma-radius` or `--bulma-column-gap`\nthere through a deprecated route. The rule reports it with a message that says\nso and points at `bulmaVars`, unless it is a near miss of one of the values,\nwhich gets the usual suggestion:\n\n```jsx\n<Theme radius=\"6px\" /> // ✗ deprecated → bulmaVars\n<Theme radius=\"radiusles\" /> // ✗ Did you mean `radiusless`?\n<Theme bulmaVars={{ '--bulma-radius': '6px' }} /> // ✓\n<Theme columnGap=\"1rem\" /> // ✗ deprecated → bulmaVars\n<Theme bulmaVars={{ '--bulma-column-gap': '1rem' }} /> // ✓\n```\n\nThe gap props take their steps as numbers as well, so `<Box gap={2} />` is\naccepted where `<Box m={2} />` is reported.\n\n### no-deprecated-props\n\n```jsx\n<Button isFullWidth /> // ✗ deprecated → fixes to isFullwidth\n<Tabs color=\"info\" /> // ✗ no .tabs.is-<color> CSS exists; no fix offered\n```\n\nThe table is generated from the library's own TSDoc, so a rename lands here\nwith the library rather than after someone notices.\n\n### no-color-as-surface\n\nOff by default. `color` on the content elements is a documented alias for\n`textColor`, so this rule is about saying which you meant, not about broken\ncode.\n\n```jsx\n<Box color=\"primary\" /> // ✗ ambiguous → fixes to textColor\n<Box bgColor=\"primary\" /> // ✓ a coloured surface\n<Button color=\"primary\" /> // ✓ Button really has an is-primary variant\n\n// ✓ silent: the background is explicit, so `color` is plainly the text half\n<Box bgColor=\"info\" color=\"primary\" />\n```\n\n### no-bulma-component-class\n\nOff by default. It reports a plain element styled with a Bulma class that\nbestax has a component for, and names the component. Turn it on in an app that\nhas moved onto bestax, with `bestax-migrate bulma-classes` or by hand, to keep\nraw Bulma markup from coming back.\n\n```jsx\n<button className=\"button is-primary\" /> // ✗ bestax renders .button as Button\n<div className=\"dropdown\" /> // ✗ bestax has Dropdown, converted by hand\n<div className=\"has-text-centered mt-4\" /> // ✓ helper classes are left alone\n<p className=\"help\" /> // ✓ bestax renders .help inside its form controls\n```\n\nIt reads the classes a `className` spells out, including the strings in a\nternary, a template, or a call to `clsx`, `classnames` or `tailwind-merge`\n(however the file imports or requires it), and reports one class per element:\nthe one the codemod would decide by. A function your app defines, a `cn` in `lib/utils`\nincluded, is one it cannot see into, so it reads nothing there. It only reports. Whether an element converts\ndepends on its tag, attributes and children, and `bestax-migrate bulma-classes`\nis the one place that judges that.\n\n### no-inert-flex-props\n\n```jsx\n<Box justifyContent=\"center\" /> // ✗ emits nothing\n<Box display=\"flex\" justifyContent=\"center\" /> // ✓\n<Box flexGrow=\"1\" /> // ✓ child props always apply\n```\n\n## Links\n\n- [Documentation](https://bestax.io/docs/guides/getting-started/eslint-plugin)\n- [Component library](https://www.npmjs.com/package/@allxsmith/bestax-bulma)\n- [Repository](https://github.com/allxsmith/bestax)\n\n## License\n\nMIT\n"
|
|
76
76
|
}
|