Skip to content

Commit

Permalink
Move to stricter lint rule
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Aug 17, 2024
1 parent e42dd71 commit 6cfbf62
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ module.exports = {
'FontSizePicker',
'NumberControl',
'RangeControl',
'TextControl',
'ToggleGroupControl',
].map( ( componentName ) => ( {
// Falsy `__next40pxDefaultSize` without a non-default `size` prop.
Expand All @@ -328,15 +329,13 @@ module.exports = {
' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
} ) ),
// Temporary rules until all existing components have the `__next40pxDefaultSize` prop.
...[ 'SelectControl', 'TextControl' ].map(
( componentName ) => ( {
// Not strict. Allows pre-existing __next40pxDefaultSize={ false } usage until they are all manually updated.
selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"])):not(:has(JSXAttribute[name.name="size"]))`,
message:
componentName +
' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
} )
),
...[ 'SelectControl' ].map( ( componentName ) => ( {
// Not strict. Allows pre-existing __next40pxDefaultSize={ false } usage until they are all manually updated.
selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__next40pxDefaultSize"])):not(:has(JSXAttribute[name.name="size"]))`,
message:
componentName +
' should have the `__next40pxDefaultSize` prop to opt-in to the new default size.',
} ) ),
],
},
},
Expand Down

0 comments on commit 6cfbf62

Please sign in to comment.