From a3adedfa65a6c39a84f826ebaf5ade1c49293f6d Mon Sep 17 00:00:00 2001 From: Richard Laffers Date: Fri, 4 Aug 2023 11:01:24 +0200 Subject: [PATCH] fix(no-invalid-state-props): allow the `exit` prop on the root state node fix #17 --- lib/rules/no-invalid-state-props.js | 1 + tests/lib/rules/no-invalid-state-props.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rules/no-invalid-state-props.js b/lib/rules/no-invalid-state-props.js index 8704052..c24e61b 100644 --- a/lib/rules/no-invalid-state-props.js +++ b/lib/rules/no-invalid-state-props.js @@ -38,6 +38,7 @@ const validRootProperties = [ 'context', 'description', 'entry', + 'exit', 'history', // only when type=history 'id', 'initial', diff --git a/tests/lib/rules/no-invalid-state-props.js b/tests/lib/rules/no-invalid-state-props.js index fe82e0f..3991f90 100644 --- a/tests/lib/rules/no-invalid-state-props.js +++ b/tests/lib/rules/no-invalid-state-props.js @@ -16,6 +16,8 @@ const tests = { events: {}, }, tsTypes: {}, + entry: 'log', + exit: 'log', states: { idle: { type: 'parallel', @@ -111,7 +113,6 @@ const tests = { { code: ` createMachine({ - exit: 'someAction', onDone: 'idle', states: { idle: {}, @@ -119,7 +120,6 @@ const tests = { }) `, errors: [ - { messageId: 'invalidRootStateProperty', data: { propName: 'exit' } }, { messageId: 'invalidRootStateProperty', data: { propName: 'onDone' } }, ], },