eslint-plugin-effector 0.9.0 → 0.9.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.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Enforcing best practices for Effector",
5
5
  "keywords": [
6
6
  "eslint",
@@ -76,19 +76,22 @@ module.exports = {
76
76
  // Store creation with method
77
77
  const STORE_CREATION_METHODS = ["createStore", "restore", "combine"];
78
78
  for (const method of STORE_CREATION_METHODS) {
79
- const localMethod = importedFromEffector.get(method);
79
+ const localMethod = importedFromEffector.get(method);
80
80
  if (!localMethod) {
81
81
  continue;
82
82
  }
83
-
83
+
84
84
  const isEffectorStoreCreation = node.callee.name === localMethod;
85
85
  if (!isEffectorStoreCreation) {
86
86
  continue;
87
87
  }
88
88
 
89
- const parentNode = traverseParentByType(node, "VariableDeclarator", ["Program"]);
89
+ const parentNode = traverseParentByType(node, "VariableDeclarator", [
90
+ "Program",
91
+ ]);
90
92
 
91
- const resultSavedInVariable = parentNode.type === "VariableDeclarator";
93
+ const resultSavedInVariable =
94
+ parentNode?.type === "VariableDeclarator";
92
95
  if (!resultSavedInVariable) {
93
96
  continue;
94
97
  }
@@ -116,7 +119,8 @@ module.exports = {
116
119
  return;
117
120
  }
118
121
 
119
- const resultSavedInVariable = node.parent.type === "VariableDeclarator";
122
+ const resultSavedInVariable =
123
+ node.parent.type === "VariableDeclarator";
120
124
 
121
125
  if (!resultSavedInVariable) {
122
126
  return;
@@ -141,10 +145,12 @@ module.exports = {
141
145
  if (
142
146
  STORE_IN_DOMAIN_CREATION_METHODS.includes(node.callee?.property?.name)
143
147
  ) {
148
+ const parentNode = traverseParentByType(node, "VariableDeclarator", [
149
+ "Program",
150
+ ]);
144
151
 
145
- const parentNode = traverseParentByType(node, "VariableDeclarator", ["Program"]);
146
-
147
- const resultSavedInVariable = parentNode.type === "VariableDeclarator";
152
+ const resultSavedInVariable =
153
+ parentNode.type === "VariableDeclarator";
148
154
  if (!resultSavedInVariable) {
149
155
  return;
150
156
  }