Skip to content

Commit e77e712

Browse files
committed
Fix no-duplicate-on error messages during development in IDEA
1 parent 0ce703d commit e77e712

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createEvent, createStore } from "effector";
2+
3+
const $store = createStore(1);
4+
5+
// Yeah, it's incorrect TS code, but it isn't this plugin's business
6+
$store.on();

rules/no-duplicate-on/no-duplicate-on.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ module.exports = {
101101
};
102102

103103
function normalizePossibleArrayNode(node) {
104+
if (!node) {
105+
return [];
106+
}
107+
104108
if (node.type === "ArrayExpression") {
105109
return node.elements;
106110
}

rules/no-duplicate-on/no-duplicate-on.ts.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ruleTester.run("effector/no-duplicate-on.ts.test", rule, {
2525
"correct.ts",
2626
"correct-with-scopes.ts",
2727
"correct-with-nesting.ts",
28+
"correct-with-empty-on.ts",
2829
].map(readExampleForTheRule),
2930
invalid: ["incorrect-with-invalid-naming.ts"]
3031
.map(readExampleForTheRule)

0 commit comments

Comments
 (0)