Skip to content

Commit

Permalink
Fix no-duplicate-on error messages during development in IDEA
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Feb 1, 2022
1 parent 0ce703d commit e77e712
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rules/no-duplicate-on/examples/correct-with-empty-on.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createEvent, createStore } from "effector";

const $store = createStore(1);

// Yeah, it's incorrect TS code, but it isn't this plugin's business
$store.on();
4 changes: 4 additions & 0 deletions rules/no-duplicate-on/no-duplicate-on.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ module.exports = {
};

function normalizePossibleArrayNode(node) {
if (!node) {
return [];
}

if (node.type === "ArrayExpression") {
return node.elements;
}
Expand Down
1 change: 1 addition & 0 deletions rules/no-duplicate-on/no-duplicate-on.ts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ ruleTester.run("effector/no-duplicate-on.ts.test", rule, {
"correct.ts",
"correct-with-scopes.ts",
"correct-with-nesting.ts",
"correct-with-empty-on.ts",
].map(readExampleForTheRule),
invalid: ["incorrect-with-invalid-naming.ts"]
.map(readExampleForTheRule)
Expand Down

0 comments on commit e77e712

Please sign in to comment.