Skip to content

Commit

Permalink
fix(no-invalid-state-props): allow the exit prop on the root state …
Browse files Browse the repository at this point in the history
…node

fix #17
  • Loading branch information
rlaffers committed Aug 4, 2023
1 parent 93a6d43 commit a3adedf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/rules/no-invalid-state-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const validRootProperties = [
'context',
'description',
'entry',
'exit',
'history', // only when type=history
'id',
'initial',
Expand Down
4 changes: 2 additions & 2 deletions tests/lib/rules/no-invalid-state-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const tests = {
events: {},
},
tsTypes: {},
entry: 'log',
exit: 'log',
states: {
idle: {
type: 'parallel',
Expand Down Expand Up @@ -111,15 +113,13 @@ const tests = {
{
code: `
createMachine({
exit: 'someAction',
onDone: 'idle',
states: {
idle: {},
},
})
`,
errors: [
{ messageId: 'invalidRootStateProperty', data: { propName: 'exit' } },
{ messageId: 'invalidRootStateProperty', data: { propName: 'onDone' } },
],
},
Expand Down

0 comments on commit a3adedf

Please sign in to comment.