Skip to content

Commit 1bed311

Browse files
authored
chore: update svelte-eslint-parser to v1.0.0-next.13 (#1026)
1 parent 35d80a5 commit 1bed311

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

.changeset/red-jokes-tickle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-plugin-svelte': patch
3+
---
4+
5+
chore: update `svelte-eslint-parser` to `v1.0.0-next.12`

packages/eslint-plugin-svelte/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"postcss-load-config": "^3.1.4",
6666
"postcss-safe-parser": "^7.0.0",
6767
"semver": "^7.6.3",
68-
"svelte-eslint-parser": "^1.0.0-next.10"
68+
"svelte-eslint-parser": "^1.0.0-next.13"
6969
},
7070
"devDependencies": {
7171
"@babel/core": "^7.26.0",

packages/eslint-plugin-svelte/src/rules/require-store-reactive-access.ts

+13-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,19 @@ export default createRule('require-store-reactive-access', {
7676
if (node.key.name.name !== 'this' && canAcceptStoreAttributeElement(node.parent.parent)) {
7777
return;
7878
}
79-
// Check for <input bind:value={store} />
80-
verifyExpression(node.expression, {
81-
disableFix: node.shorthand
82-
});
79+
// Check for <input bind:value={ () => {}, (v) => {} } />
80+
if (node.expression?.type === 'SvelteFunctionBindingsExpression') {
81+
for (const expr of node.expression.expressions) {
82+
verifyExpression(expr, {
83+
disableFix: node.shorthand
84+
});
85+
}
86+
} else {
87+
// Check for <input bind:value={store} />
88+
verifyExpression(node.expression, {
89+
disableFix: node.shorthand
90+
});
91+
}
8392
} else if (node.kind === 'Class') {
8493
// Check for <div class:foo={store} />
8594
verifyExpression(node.expression, {

packages/eslint-plugin-svelte/src/types-for-node.ts

+12
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,12 @@ export type ASTNodeListener = {
495495
'SvelteHTMLComment:exit'?: (node: AST.SvelteHTMLComment & ASTNodeWithParent) => void;
496496
SvelteReactiveStatement?: (node: AST.SvelteReactiveStatement & ASTNodeWithParent) => void;
497497
'SvelteReactiveStatement:exit'?: (node: AST.SvelteReactiveStatement & ASTNodeWithParent) => void;
498+
SvelteFunctionBindingsExpression?: (
499+
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
500+
) => void;
501+
'SvelteFunctionBindingsExpression:exit'?: (
502+
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
503+
) => void;
498504
};
499505

500506
export type ESNodeListener = {
@@ -950,4 +956,10 @@ export type SvelteNodeListener = {
950956
'SvelteText:exit'?: (node: AST.SvelteText & ASTNodeWithParent) => void;
951957
SvelteHTMLComment?: (node: AST.SvelteHTMLComment & ASTNodeWithParent) => void;
952958
'SvelteHTMLComment:exit'?: (node: AST.SvelteHTMLComment & ASTNodeWithParent) => void;
959+
SvelteFunctionBindingsExpression?: (
960+
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
961+
) => void;
962+
'SvelteFunctionBindingsExpression:exit'?: (
963+
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
964+
) => void;
953965
};

0 commit comments

Comments
 (0)