Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d27fae

Browse files
authored
[fix] allow $$Props, $$Slots, $$Events usage (#158)
Fixes #136
1 parent 17b848d commit 0d27fae

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

src/postprocess.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ const is_valid_message = (block, message, translation) => {
9999
case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement' || get_identifier(get_referenced_string(block, message)) !== '$';
100100
case 'no-self-assign': return !state.var_names.has(get_identifier(get_referenced_string(block, message)));
101101
case 'no-undef': return get_referenced_string(block, message) !== '$$Generic';
102+
case '@typescript-eslint/no-unused-vars':
103+
case 'no-unused-vars': return !['$$Props', '$$Slots', '$$Events'].includes(get_referenced_string(block, message));
102104
case 'no-unused-labels': return get_referenced_string(block, message) !== '$';
103105
case '@typescript-eslint/quotes':
104106
case 'quotes': return !translation.options.in_quoted_attribute;
File renamed without changes.

test/samples/typescript-generics/Input.svelte renamed to test/samples/typescript-special-types/Input.svelte

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
<script lang='ts'>
22
type T = $$Generic;
33
type U = $$Generic<string>;
4+
5+
interface $$Slots {
6+
default: {
7+
foo: string;
8+
}
9+
}
10+
11+
type $$Props = {
12+
items: T;
13+
message: U;
14+
}
15+
16+
interface $$Events {
17+
click: string;
18+
}
19+
420
export let items: T[];
521
export let message: U;
622
</script>
File renamed without changes.

0 commit comments

Comments
 (0)