Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-xstate

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-xstate - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

1

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

@@ -41,2 +41,3 @@ 'use strict'

'entry',
'exit',
'history', // only when type=history

@@ -43,0 +44,0 @@ 'id',

@@ -7,12 +7,23 @@ 'use strict'

function isWithinAtomicStateNode(node) {
function isWithinCompoundStateNode(node) {
const stateNode = node.parent
const type = getTypeProperty(stateNode)
return (
!isWithinInvoke(node) &&
((type != null && type.value.value === 'atomic') ||
(type == null && !hasProperty('initial', stateNode)))
hasProperty('initial', stateNode) ||
(type != null && type.value.value === 'compound')
)
}
function isWithinParallelStateNode(node) {
const stateNode = node.parent
const type = getTypeProperty(stateNode)
return type != null && type.value.value === 'parallel'
}
function isWithinAtomicStateNode(node) {
const stateNode = node.parent
const type = getTypeProperty(stateNode)
return type != null && type.value.value === 'atomic'
}
function isWithinHistoryStateNode(node) {

@@ -48,2 +59,4 @@ const stateNode = node.parent

'Final state nodes cannot have an "onDone" transition. The "onDone" transition has effect only in compound/parallel state nodes or in service invocations.',
onDoneUsedIncorrectly:
'The "onDone" transition cannot be used here. The "onDone" transition has effect only in compound/parallel state nodes or in service invocations.',
},

@@ -56,2 +69,11 @@ },

function (node) {
if (isWithinInvoke(node)) {
return
}
if (isWithinCompoundStateNode(node)) {
return
}
if (isWithinParallelStateNode(node)) {
return
}
if (isWithinAtomicStateNode(node)) {

@@ -76,3 +98,8 @@ context.report({

})
return
}
context.report({
node,
messageId: 'onDoneUsedIncorrectly',
})
},

@@ -79,0 +106,0 @@ }

@@ -108,3 +108,15 @@ const { allPass, complement } = require('./combinators')

const parentProp = property.parent.parent
return parentProp.type === 'Property' && parentProp.key.name === 'invoke'
if (
parentProp &&
parentProp.type === 'Property' &&
parentProp.key.name === 'invoke'
) {
return true
}
return (
parentProp.type === 'ArrayExpression' &&
parentProp.parent &&
parentProp.parent.type === 'Property' &&
parentProp.parent.key.name === 'invoke'
)
}

@@ -111,0 +123,0 @@

2

package.json
{
"name": "eslint-plugin-xstate",
"version": "1.1.1",
"version": "1.1.2",
"description": "ESLint rules for XState",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc