From 62569391b09893ecfa9ea2e34a713ea96a1ccba9 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 3 Jan 2022 14:31:38 +0100 Subject: [PATCH 1/3] add failing test --- .../.eslintrc.js | 0 .../Input.svelte | 16 ++++++++++++++++ .../expected.json | 0 3 files changed, 16 insertions(+) rename test/samples/{typescript-generics => typescript-special-types}/.eslintrc.js (100%) rename test/samples/{typescript-generics => typescript-special-types}/Input.svelte (57%) rename test/samples/{typescript-generics => typescript-special-types}/expected.json (100%) diff --git a/test/samples/typescript-generics/.eslintrc.js b/test/samples/typescript-special-types/.eslintrc.js similarity index 100% rename from test/samples/typescript-generics/.eslintrc.js rename to test/samples/typescript-special-types/.eslintrc.js diff --git a/test/samples/typescript-generics/Input.svelte b/test/samples/typescript-special-types/Input.svelte similarity index 57% rename from test/samples/typescript-generics/Input.svelte rename to test/samples/typescript-special-types/Input.svelte index e120bfb..6c757de 100644 --- a/test/samples/typescript-generics/Input.svelte +++ b/test/samples/typescript-special-types/Input.svelte @@ -1,6 +1,22 @@ diff --git a/test/samples/typescript-generics/expected.json b/test/samples/typescript-special-types/expected.json similarity index 100% rename from test/samples/typescript-generics/expected.json rename to test/samples/typescript-special-types/expected.json From dda245865b1077724a8269f0ff05a951e01adc44 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 3 Jan 2022 14:37:51 +0100 Subject: [PATCH 2/3] fix --- src/postprocess.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/postprocess.js b/src/postprocess.js index e1a9d60..27a7a5a 100644 --- a/src/postprocess.js +++ b/src/postprocess.js @@ -99,6 +99,7 @@ const is_valid_message = (block, message, translation) => { case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement' || get_identifier(get_referenced_string(block, message)) !== '$'; case 'no-self-assign': return !state.var_names.has(get_identifier(get_referenced_string(block, message))); case 'no-undef': return get_referenced_string(block, message) !== '$$Generic'; + case 'no-unused-vars': return ['$$Props', '$$Slots', '$$Events'].includes(get_referenced_string(block, message)); case 'no-unused-labels': return get_referenced_string(block, message) !== '$'; case '@typescript-eslint/quotes': case 'quotes': return !translation.options.in_quoted_attribute; From f34be4bd40dad5f1c4282f72e9c3c1e26e8531ca Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 3 Jan 2022 15:29:59 +0100 Subject: [PATCH 3/3] fix --- src/postprocess.js | 3 ++- test/samples/typescript-special-types/Input.svelte | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/postprocess.js b/src/postprocess.js index 27a7a5a..0a4c885 100644 --- a/src/postprocess.js +++ b/src/postprocess.js @@ -99,7 +99,8 @@ const is_valid_message = (block, message, translation) => { case 'no-restricted-syntax': return message.nodeType !== 'LabeledStatement' || get_identifier(get_referenced_string(block, message)) !== '$'; case 'no-self-assign': return !state.var_names.has(get_identifier(get_referenced_string(block, message))); case 'no-undef': return get_referenced_string(block, message) !== '$$Generic'; - case 'no-unused-vars': return ['$$Props', '$$Slots', '$$Events'].includes(get_referenced_string(block, message)); + case '@typescript-eslint/no-unused-vars': + case 'no-unused-vars': return !['$$Props', '$$Slots', '$$Events'].includes(get_referenced_string(block, message)); case 'no-unused-labels': return get_referenced_string(block, message) !== '$'; case '@typescript-eslint/quotes': case 'quotes': return !translation.options.in_quoted_attribute; diff --git a/test/samples/typescript-special-types/Input.svelte b/test/samples/typescript-special-types/Input.svelte index 6c757de..f439e60 100644 --- a/test/samples/typescript-special-types/Input.svelte +++ b/test/samples/typescript-special-types/Input.svelte @@ -2,7 +2,7 @@ type T = $$Generic; type U = $$Generic; - interfacce $$Slots { + interface $$Slots { default: { foo: string; }