Skip to content

Commit

Permalink
Add subcomponents to allow list
Browse files Browse the repository at this point in the history
  • Loading branch information
colebemis committed Mar 22, 2023
1 parent 8c30e0b commit 6aa1d90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rules/__tests__/no-system-props.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ ruleTester.run('no-system-props', rule, {
`import {ProgressBar} from '@primer/react'; <ProgressBar bg="howdy" />`,
`import {Button} from '@primer/react'; <Button {...someExpression()} />`,
`import {Button} from '@primer/react'; <Button variant="large" />`,
`import {Button} from '@primer/react'; <Button size="large" />`
`import {Button} from '@primer/react'; <Button size="large" />`,
`import {ActionMenu} from '@primer/react'; <ActionMenu.Overlay width="large" />`
],
invalid: [
{
Expand Down
11 changes: 11 additions & 0 deletions src/rules/no-system-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,29 @@ const utilityComponents = new Set(['Box', 'Text'])

// Components for which we allow a set of prop names
const excludedComponentProps = new Map([
['ActionMenu.Overlay', new Set(['width', 'height', 'maxHeight', 'position', 'top', 'right', 'bottom', 'left'])],
['Autocomplete.Overlay', new Set(['width', 'height', 'maxHeight', 'position', 'top', 'right', 'bottom', 'left'])],
['AnchoredOverlay', new Set(['width', 'height'])],
['Avatar', new Set(['size'])],
['AvatarToken', new Set(['size'])],
['CircleOcticon', new Set(['size'])],
['Dialog', new Set(['width', 'height'])],
['IssueLabelToken', new Set(['size'])],
['Overlay', new Set(['width', 'height', 'maxHeight', 'position', 'top', 'right', 'bottom', 'left'])],
['ProgressBar', new Set(['bg'])],
['Spinner', new Set(['size'])],
['SplitPageLayout.Header', new Set(['padding'])],
['SplitPageLayout.Footer', new Set(['padding'])],
['SplitPageLayout.Pane', new Set(['padding', 'position', 'width'])],
['SplitPageLayout.Content', new Set(['padding', 'width'])],
['StyledOcticon', new Set(['size'])],
['PointerBox', new Set(['bg'])],
['Token', new Set(['size'])],
['PageLayout', new Set(['padding'])],
['PageLayout.Header', new Set(['padding'])],
['PageLayout.Footer', new Set(['padding'])],
['PageLayout.Pane', new Set(['padding', 'position', 'width'])],
['PageLayout.Content', new Set(['padding', 'width'])],
['ProgressBar', new Set(['bg'])],
['PointerBox', new Set(['bg'])]
])
Expand Down

0 comments on commit 6aa1d90

Please sign in to comment.