diff --git a/.changeset/gorgeous-games-confess.md b/.changeset/gorgeous-games-confess.md new file mode 100644 index 00000000..f9023bbb --- /dev/null +++ b/.changeset/gorgeous-games-confess.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-primer-react': minor +--- + +Added a no-system-props rule diff --git a/docs/rules/no-system-props.md b/docs/rules/no-system-props.md new file mode 100644 index 00000000..75e361db --- /dev/null +++ b/docs/rules/no-system-props.md @@ -0,0 +1,40 @@ +# Disallow use of styled-system props (no-system-colors) + +🔧 The `--fix` option on the [ESLint CLI](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule. + +[Styled-system](https://styled-system.com/table) props are deprecated in Primer components (excluding utility components). + +## Rule details + +This rule disallows the use of any styled-system prop on Primer components, as the `sx` prop is now the prefered way to apply additional styling. + +\*The two non-deprecated utility components (`Box` and `Text`) are allowed to use system props. + +👎 Examples of **incorrect** code for this rule: + +```jsx +/* eslint primer-react/no-system-props: "error" */ +import {Button} from '@primer/components' + +