Skip to content

Commit a3adedf

Browse files
committed
fix(no-invalid-state-props): allow the exit prop on the root state node
fix #17
1 parent 93a6d43 commit a3adedf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/rules/no-invalid-state-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const validRootProperties = [
3838
'context',
3939
'description',
4040
'entry',
41+
'exit',
4142
'history', // only when type=history
4243
'id',
4344
'initial',

tests/lib/rules/no-invalid-state-props.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const tests = {
1616
events: {},
1717
},
1818
tsTypes: {},
19+
entry: 'log',
20+
exit: 'log',
1921
states: {
2022
idle: {
2123
type: 'parallel',
@@ -111,15 +113,13 @@ const tests = {
111113
{
112114
code: `
113115
createMachine({
114-
exit: 'someAction',
115116
onDone: 'idle',
116117
states: {
117118
idle: {},
118119
},
119120
})
120121
`,
121122
errors: [
122-
{ messageId: 'invalidRootStateProperty', data: { propName: 'exit' } },
123123
{ messageId: 'invalidRootStateProperty', data: { propName: 'onDone' } },
124124
],
125125
},

0 commit comments

Comments
 (0)