eslint-plugin-effector 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-effector",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Enforcing best practices for Effector",
5
5
  "keywords": [
6
6
  "eslint",
@@ -124,5 +124,5 @@ function getAssignedVariable(node) {
124
124
  }
125
125
 
126
126
  function getStoreName(node) {
127
- return node.name ?? node.id.name;
127
+ return node?.name ?? node?.id?.name;
128
128
  }
@@ -1,16 +1,20 @@
1
1
  function hasType({ node, possibleTypes, context, from }) {
2
- const checker = context.parserServices.program.getTypeChecker();
3
- const originalNode = context.parserServices.esTreeNodeToTSNodeMap.get(node);
4
- const type = checker.getTypeAtLocation(
5
- originalNode?.initializer ?? originalNode
6
- );
2
+ try {
3
+ const checker = context.parserServices.program.getTypeChecker();
4
+ const originalNode = context.parserServices.esTreeNodeToTSNodeMap.get(node);
5
+ const type = checker.getTypeAtLocation(
6
+ originalNode?.initializer ?? originalNode
7
+ );
7
8
 
8
- const symbol = type?.symbol ?? type?.aliasSymbol;
9
+ const symbol = type?.symbol ?? type?.aliasSymbol;
9
10
 
10
- return (
11
- possibleTypes.includes(symbol?.escapedName) &&
12
- Boolean(symbol?.parent?.escapedName?.includes(from))
13
- );
11
+ return (
12
+ possibleTypes.includes(symbol?.escapedName) &&
13
+ Boolean(symbol?.parent?.escapedName?.includes(from))
14
+ );
15
+ } catch (e) {
16
+ return false;
17
+ }
14
18
  }
15
19
 
16
20
  const nodeTypeIs = {