Repository: effector/eslint-plugin (js)

Issue:
False positive for `enforce-store-naming-convention` in `attach`
In the following cases, where a Store is _created_ in `attach` argument `source`, the rule `enforce-store-naming-convention` has a false positive. 

Minimal reproduction:

```ts
const testFx = attach({
  source: createStore(0),
  effect: createEffect()
})
```

<img width="920" alt="issue-1" src="https://github.com/effector/eslint-plugin/assets/29187880/7c34f58e-9d80-4ad1-b530-9d8bac645497">

---

Other examples:

```ts
import { attach, combine, createStore, createEffect } from "effector";

const combineFx = attach({
  source: {
    value: combine(),
  },
  effect: createEffect()
})

const createStoreFx = attach({
  source: {
    value: createStore(0),
  },
  effect: createEffect()
})
```

In all of these, a prefix/suffix is erroneously suggested.

---

A real-life example where this is _not_ an error - a `combine` is used to prepare data for the effect.

**Versions:**

ESLint: `8.51.0`
eslint-plugin-effector: `0.11.0` (latest)

Pull request:
Allow creating a `Store` in a property in `enforce-store-naming-convention`
This change allows the creation of new `Store`s in a property. As such, this change allows both for destructuring assignments and passing stores as an argument.

Closes #150, #158 

Patch:
diff --git a/rules/enforce-store-naming-convention/enforce-store-naming-convention.js b/rules/enforce-store-naming-convention/enforce-store-naming-convention.js
index 5c5b68b..8139939 100644
--- a/rules/enforce-store-naming-convention/enforce-store-naming-convention.js
+++ b/rules/enforce-store-naming-convention/enforce-store-naming-convention.js
@@ -94,7 +94,7 @@ module.exports = {
           }
 
           const parentNode = traverseParentByType(node, "VariableDeclarator", {
-            stopOnTypes: ["Program", "BlockStatement"],
+            stopOnTypes: ["Program", "BlockStatement", "Property"],
           });
 
           const resultSavedInVariable =
@@ -153,7 +153,7 @@ module.exports = {
           STORE_IN_DOMAIN_CREATION_METHODS.includes(node.callee?.property?.name)
         ) {
           const parentNode = traverseParentByType(node, "VariableDeclarator", {
-            stopOnTypes: ["Program", "BlockStatement"],
+            stopOnTypes: ["Program", "BlockStatement", "Property"],
           });
 
           const resultSavedInVariable =
diff --git a/rules/enforce-store-naming-convention/prefix/examples/correct-examples-issue-150.js b/rules/enforce-store-naming-convention/prefix/examples/correct-examples-issue-150.js
new file mode 100644
index 0000000..27578d3
--- /dev/null
+++ b/rules/enforce-store-naming-convention/prefix/examples/correct-examples-issue-150.js
@@ -0,0 +1,22 @@
+import { attach, combine, createStore, createEffect } from "effector";
+
+const testFx = attach({
+  source: createStore(0),
+  effect: createEffect(),
+});
+
+const combineFx = attach({
+  source: {
+    value: combine(),
+  },
+  effect: createEffect(),
+});
+
+const createStoreFx = attach({
+  source: {
+    value: createStore(0),
+  },
+  effect: createEffect(),
+});
+
+export { testFx, combineFx, createStoreFx };
diff --git a/rules/enforce-store-naming-convention/prefix/examples/correct-examples-issue-158.js b/rules/enforce-store-naming-convention/prefix/examples/correct-examples-issue-158.js
new file mode 100644
index 0000000..8db9eb4
--- /dev/null
+++ b/rules/enforce-store-naming-convention/prefix/examples/correct-examples-issue-158.js
@@ -0,0 +1,11 @@
+import { createStore } from "effector";
+
+const arrow = ({ store = createStore(0) }) => {
+  return { store };
+};
+
+function declaration({ store = createStore(1) }) {
+  return { store };
+}
+
+export { arrow, declaration };
diff --git a/rules/enforce-store-naming-convention/prefix/examples/correct-store-naming-property-domain.js b/rules/enforce-store-naming-convention/prefix/examples/correct-store-naming-property-domain.js
new file mode 100644
index 0000000..002d13d
--- /dev/null
+++ b/rules/enforce-store-naming-convention/prefix/examples/correct-store-naming-property-domain.js
@@ -0,0 +1,17 @@
+import { createDomain } from "effector";
+import { attach, createEffect } from "effector";
+
+const domain = createDomain();
+const effect = createEffect();
+
+const storeFx = attach({
+  source: domain.store(0),
+  effect,
+});
+
+const createStoreFx = attach({
+  source: domain.createStore(0),
+  effect,
+});
+
+export { storeFx, createDomain };


Test patch:
diff --git a/rules/enforce-store-naming-convention/prefix/enforce-store-naming-convention-prefix.test.js b/rules/enforce-store-naming-convention/prefix/enforce-store-naming-convention-prefix.test.js
index 3853fbc..cc0aeec 100644
--- a/rules/enforce-store-naming-convention/prefix/enforce-store-naming-convention-prefix.test.js
+++ b/rules/enforce-store-naming-convention/prefix/enforce-store-naming-convention-prefix.test.js
@@ -21,6 +21,9 @@ ruleTester.run("effector/enforce-store-naming-convention-prefix.test", rule, {
     "correct-examples-issue-23.js",
     "correct-examples-issue-128.js",
     "correct-examples-issue-136.js",
+    "correct-examples-issue-150.js",
+    "correct-examples-issue-158.js",
+    "correct-store-naming-property-domain.js",
     "correct-store-naming-with-handlers.js",
     "correct-store-naming-in-domain-with-handlers.js",
     "correct-factory.js",