Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
- Add test case

- Add check length for this case
  • Loading branch information
raidenmiro committed May 13, 2023
1 parent 787f2d4 commit aa88db5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ ruleTester.run(
"effector/enforce-store-naming-convention-prefix.ts.test",
rule,
{
valid: ["correct-store-naming.ts"].map(readExampleForTheRule),
valid: ["correct-store-naming.ts", "correct-issue-139.ts"].map(
readExampleForTheRule
),

invalid: [
// Errors
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createStore } from "effector";

const $ = createStore(0);
2 changes: 1 addition & 1 deletion utils/naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function isStoreNameValid({ name, context }) {
const storeNameConvention = getStoreNameConvention(context);

// validate edge case
if (name?.startsWith("$") && name?.endsWith("$")) {
if (name?.length > 1 && name?.startsWith("$") && name?.endsWith("$")) {
return false;
}

Expand Down

0 comments on commit aa88db5

Please sign in to comment.