rlaffers / eslint-plugin-xstate

ESLint plugin to check for common mistakes and enforce good practices when using XState.
MIT License
48 stars 4 forks source link

Statechart property ordering rule? #19

Open tivac opened 11 months ago

tivac commented 11 months ago

no-invalid-state-props and no-invalid-transition-props do a good job of ensuring only valid keys are used, but it'd be cool to have a new stylistic rule that could enforce a user-configurable order for keys in a machine/state/transition/etc.

rlaffers commented 11 months ago

That is actually a good idea. This may be a bit involved however, as the autofix for this would need to overwrite large chunks of code. It is not a simple case of find and replace. I will look into how feasible this is.

tivac commented 10 months ago

if you're worried about the safety/correctness of the fixes it's always possible to have them be suggestions instead for a while. I wish ESLint fixers could choose to operate just on the AST so swapping Property nodes around like this would be easy & safe.