Skip to content

Commit c3643d5

Browse files
committed
refactor
1 parent 86c7cba commit c3643d5

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

packages/eslint-plugin-svelte/src/rules/prefer-destructured-store-props.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,12 @@ import type { SuggestionReportDescriptor } from '../types.js';
66
import { createRule } from '../utils/index.js';
77
import { findAttribute, isExpressionIdentifier, findVariable } from '../utils/ast-utils.js';
88
import { getSvelteContext } from '../utils/svelte-context.js';
9+
import { SVELTE_RUNES } from '../shared/runes.js';
910

1011
type StoreMemberExpression = TSESTree.MemberExpression & {
1112
object: TSESTree.Identifier & { name: string };
1213
};
1314

14-
/**
15-
* Svelte 5 runes that start with `$` but are not stores.
16-
* These should be excluded from the prefer-destructured-store-props rule.
17-
*/
18-
const SVELTE_RUNES = new Set([
19-
'$state',
20-
'$derived',
21-
'$effect',
22-
'$props',
23-
'$bindable',
24-
'$inspect',
25-
'$host'
26-
]);
27-
2815
export default createRule('prefer-destructured-store-props', {
2916
meta: {
3017
docs: {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const SVELTE_RUNES = new Set([
2+
'$state',
3+
'$derived',
4+
'$effect',
5+
'$props',
6+
'$bindable',
7+
'$inspect',
8+
'$host'
9+
]);

0 commit comments

Comments
 (0)