eslint-plugin-xstate
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -24,2 +24,17 @@ 'use strict' | ||
function isPureActionCall(node) { | ||
return node.type === 'CallExpression' && node.callee.name === 'pure' | ||
} | ||
function isWithinPureActionCreator(node) { | ||
let parent = node.parent | ||
while (parent) { | ||
if (isPureActionCall(parent)) { | ||
return true | ||
} | ||
parent = parent.parent | ||
} | ||
return false | ||
} | ||
module.exports = { | ||
@@ -47,3 +62,3 @@ meta: { | ||
) { | ||
if (isActionCreatorCall(node)) { | ||
if (isActionCreatorCall(node) && !isWithinPureActionCreator(node)) { | ||
context.report({ | ||
@@ -60,3 +75,3 @@ node, | ||
) { | ||
if (isActionCreatorCall(node)) { | ||
if (isActionCreatorCall(node) && !isWithinPureActionCreator(node)) { | ||
context.report({ | ||
@@ -73,3 +88,3 @@ node, | ||
) { | ||
if (isActionCreatorCall(node)) { | ||
if (isActionCreatorCall(node) && !isWithinPureActionCreator(node)) { | ||
context.report({ | ||
@@ -86,3 +101,3 @@ node, | ||
) { | ||
if (isActionCreatorCall(node)) { | ||
if (isActionCreatorCall(node) && !isWithinPureActionCreator(node)) { | ||
context.report({ | ||
@@ -89,0 +104,0 @@ node, |
{ | ||
"name": "eslint-plugin-xstate", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "ESLint rules for XState", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
36293
903