Skip to content

chore: update svelte-eslint-parser to v1.0.0-next.13 #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/red-jokes-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'eslint-plugin-svelte': patch
---

chore: update `svelte-eslint-parser` to `v1.0.0-next.12`
2 changes: 1 addition & 1 deletion packages/eslint-plugin-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"postcss-load-config": "^3.1.4",
"postcss-safe-parser": "^7.0.0",
"semver": "^7.6.3",
"svelte-eslint-parser": "^1.0.0-next.10"
"svelte-eslint-parser": "^1.0.0-next.13"
},
"devDependencies": {
"@babel/core": "^7.26.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
description:
'disallow to use of the store itself as an operand. Need to use $ prefix or get function.',
category: 'Possible Errors',
// TODO Switch to recommended in the major version.

Check warning on line 13 in packages/eslint-plugin-svelte/src/rules/require-store-reactive-access.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'todo' comment: 'TODO Switch to recommended in the major...'
// recommended: true,
recommended: false
},
Expand Down Expand Up @@ -76,10 +76,19 @@
if (node.key.name.name !== 'this' && canAcceptStoreAttributeElement(node.parent.parent)) {
return;
}
// Check for <input bind:value={store} />
verifyExpression(node.expression, {
disableFix: node.shorthand
});
// Check for <input bind:value={ () => {}, (v) => {} } />
if (node.expression?.type === 'SvelteFunctionBindingsExpression') {
for (const expr of node.expression.expressions) {
verifyExpression(expr, {
disableFix: node.shorthand
});
}
} else {
// Check for <input bind:value={store} />
verifyExpression(node.expression, {
disableFix: node.shorthand
});
}
} else if (node.kind === 'Class') {
// Check for <div class:foo={store} />
verifyExpression(node.expression, {
Expand Down
12 changes: 12 additions & 0 deletions packages/eslint-plugin-svelte/src/types-for-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,12 @@ export type ASTNodeListener = {
'SvelteHTMLComment:exit'?: (node: AST.SvelteHTMLComment & ASTNodeWithParent) => void;
SvelteReactiveStatement?: (node: AST.SvelteReactiveStatement & ASTNodeWithParent) => void;
'SvelteReactiveStatement:exit'?: (node: AST.SvelteReactiveStatement & ASTNodeWithParent) => void;
SvelteFunctionBindingsExpression?: (
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
) => void;
'SvelteFunctionBindingsExpression:exit'?: (
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
) => void;
};

export type ESNodeListener = {
Expand Down Expand Up @@ -950,4 +956,10 @@ export type SvelteNodeListener = {
'SvelteText:exit'?: (node: AST.SvelteText & ASTNodeWithParent) => void;
SvelteHTMLComment?: (node: AST.SvelteHTMLComment & ASTNodeWithParent) => void;
'SvelteHTMLComment:exit'?: (node: AST.SvelteHTMLComment & ASTNodeWithParent) => void;
SvelteFunctionBindingsExpression?: (
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
) => void;
'SvelteFunctionBindingsExpression:exit'?: (
node: AST.SvelteFunctionBindingsExpression & ASTNodeWithParent
) => void;
};
Loading