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

state-names forgets to also rename the event targets #9

Closed binary64 closed 1 year ago

binary64 commented 2 years ago

My machine:

createMachine({
    initial: 'I am off',
    states: {
      'I am off': {
        on: {
          EVENT_1: {
            target: 'I am on',
          },
          EVENT_2: {
            target: 'I am on',
          },
        },
      },
      'I am on': {},
    },
    id: '(machine)',
  })

xstate/state-names highlights the 2 state name above, and autofixes them to iAmOff/iAmOn, but not the target: 'I am on', part.

Resulting in a bad machine:

Invalid transition definition for state node '(machine).iAmOff':
Child state 'I am on' does not exist on '(machine)'
rlaffers commented 2 years ago

Thank you for your report. This should be fixable easily.

rlaffers commented 1 year ago

:tada: This issue has been resolved in version 1.0.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: