@blumintinc/eslint-plugin-blumint 1.20.142 → 1.20.143

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/lib/index.js CHANGED
@@ -223,7 +223,7 @@ function noFrontendImportsFromFunctionsPatterns(pattern) {
223
223
  module.exports = {
224
224
  meta: {
225
225
  name: '@blumintinc/eslint-plugin-blumint',
226
- version: '1.20.142',
226
+ version: '1.20.143',
227
227
  },
228
228
  parseOptions: {
229
229
  ecmaVersion: 2020,
@@ -146,20 +146,37 @@ const DEFAULT_MUI_COMPONENTS = new Set([
146
146
  'Toolbar',
147
147
  ]);
148
148
  /**
149
- * Components whose public prop API defines `color` as a closed semantic enum
150
- * (a palette / variant selector like `'primary' | 'secondary' | 'error' | …`),
151
- * not a CSS-forwarded system style prop. On these, `color` feeds
152
- * `ownerState.color`, selecting theme variants and MUI's internal
153
- * `.Mui*-color*` class selectors moving it into `sx` both drops the variant
154
- * selection and produces an invalid CSS `color` value. So `color` here is a
155
- * first-class component prop, never a deprecated system prop.
149
+ * Props a component declares as its own first-class API, keyed by the
150
+ * (component, prop) pair. Each name below collides with a system prop, but the
151
+ * component *consumes* it feeding `ownerState`, selecting a theme value and
152
+ * MUI's internal `.Mui*-*` class selectors instead of forwarding it as CSS.
153
+ * The system-prop reading is therefore wrong for the pair whatever value is
154
+ * written, and moving the prop into `sx` emits a declaration whose value is not
155
+ * a CSS value for that property: the browser drops it, so the fix type-checks
156
+ * (`SxProps` accepts `string | number`), lints clean, and silently loses the
157
+ * styling.
158
+ *
159
+ * The keying has to be per pair, not per prop name: the same name is a genuine
160
+ * system prop elsewhere (`color` on `Typography`, `maxWidth` on `Box`), so
161
+ * exempting the bare name would blind the rule on every other component.
156
162
  */
157
- const COMPONENT_COLOR_IS_SEMANTIC = new Set([
158
- 'Button',
159
- 'IconButton',
160
- 'Chip',
161
- 'Badge',
163
+ const COMPONENT_OWN_PROPS = new Map([
164
+ // `color` is a closed palette/variant selector (`'primary' | 'error' | …`)
165
+ // on these — never a CSS color (#1273). On `AppBar` it picks the *background*
166
+ // shade, so the system-prop reading also targets the wrong CSS property.
167
+ ['Button', new Set(['color'])],
168
+ ['IconButton', new Set(['color'])],
169
+ ['Chip', new Set(['color'])],
170
+ ['Badge', new Set(['color'])],
171
+ ['AppBar', new Set(['color'])],
172
+ // `maxWidth` is a breakpoint KEY (`'xs' | … | 'xl' | false`) that selects a
173
+ // width from `theme.breakpoints.values` and drives the `maxWidth*` class
174
+ // (#1966). As CSS, `max-width: xl` is invalid and the element unbounds.
175
+ ['Container', new Set(['maxWidth'])],
176
+ ['Dialog', new Set(['maxWidth'])],
162
177
  ]);
178
+ /** True when `propName` belongs to `componentName`'s own prop API. */
179
+ const componentOwnsProp = (componentName, propName) => COMPONENT_OWN_PROPS.get(componentName)?.has(propName) === true;
163
180
  /**
164
181
  * Props that must never be moved to `sx` because they are genuine component
165
182
  * API props, not MUI system styling shorthands. `direction` and `spacing` are
@@ -782,10 +799,10 @@ exports.preferSxPropOverSystemProps = (0, createRule_1.createRule)({
782
799
  return false;
783
800
  }
784
801
  function isSystemProp(name, componentName) {
785
- // `color` is a semantic enum prop (not a CSS system prop) on components
786
- // like Button/IconButton/Chip/Badge exempt it there so the autofix
787
- // never rewrites a variant selector into an invalid CSS color.
788
- if (name === 'color' && COMPONENT_COLOR_IS_SEMANTIC.has(componentName)) {
802
+ // A prop the component owns is never the system prop of the same name, so
803
+ // the autofix must not rewrite it into a CSS declaration the browser
804
+ // discards.
805
+ if (componentOwnsProp(componentName, name)) {
789
806
  return false;
790
807
  }
791
808
  return MUI_SYSTEM_PROPS.has(name) && !isAllowedProp(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blumintinc/eslint-plugin-blumint",
3
- "version": "1.20.142",
3
+ "version": "1.20.143",
4
4
  "description": "Custom eslint rules for use within BluMint",
5
5
  "author": {
6
6
  "name": "Brodie McGuire",
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "version": "1.20.143",
4
+ "date": "2026-08-12T07:48:25.970Z",
5
+ "rules": [
6
+ {
7
+ "name": "prefer-sx-prop-over-system-props",
8
+ "changeType": "fix",
9
+ "issues": [
10
+ 1966
11
+ ],
12
+ "summary": "key the exemption on (component, prop) (closes #1966)"
13
+ }
14
+ ]
15
+ },
2
16
  {
3
17
  "version": "1.20.142",
4
18
  "date": "2026-08-12T07:04:58.677Z",