eslint-plugin-react
eslint-plugin-react copied to clipboard
`jsx-sort-props`: minimum number of props
Similar to how ESLint's sort-keys has a configuration option of minKeys, it would be nice to have a minProps option.
Why, exactly?
Ah sorry, should have added context. Two reasons:
- for components with only a couple props, like say 2, the ordering isn't too important and the rule might be more annoying than helpful to the devs.
- devs may want the option to order "semantically" for reasonable number of props, for example:
<MyButton
type="submit"
color="blue"
variant="solid"
onBlur={onBlur}
onClick={onClick}
/>
while if a component has like 10+ props, then I think it should definitely be ordered.
It seems (1) was the motivation for the analogue sort-keys being added to ESLint (see convo here).
I guess it's fine, altho I'm not sure it's a good thing to be tacitly encouraging reduced enforcement.