diff --git a/README.md b/README.md index 3328abc..16e52c6 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Custom ESLint rules used internally at Meitner - [no-mixed-exports](#no-mixed-exports) - [no-use-prefix-for-non-hook](#no-use-prefix-for-non-hook) - [no-react-namespace](#no-react-namespace) +- [no-literal-jsx-style-prop-values](#no-literal-jsx-style-prop-values) ### no-inline-function-parameter-type-annotation @@ -125,3 +126,31 @@ type Props = { export default React.memo(MyComponent); ``` + +### no-literal-jsx-style-prop-values + +Styles should be written in real CSS and applied to elements with `className`, this means less JS code, faster build time, faster load time, better UX and better DX + +Often styles will need to be changed based on various conditions, most of the time we can just apply different classNames, but sometimes we need to set styles to dynamic JS values + +This rule forbids using literal values in the JSX style prop. + +Examples of valid code + +```ts +
+ +
+ +
+``` + +Examples of invalid code + +```ts +
+ +
+ +
+```