From 24022a1d3cb812b7d15f98e90590b2afcd77d627 Mon Sep 17 00:00:00 2001 From: jason lim <50891910+Sxxov@users.noreply.github.com> Date: Tue, 16 Mar 2021 15:39:23 +0800 Subject: [PATCH 1/3] Consider @typescript/eslint's rules for invalid message --- src/postprocess.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/postprocess.js b/src/postprocess.js index 875806f..77f63e9 100644 --- a/src/postprocess.js +++ b/src/postprocess.js @@ -92,12 +92,14 @@ const get_identifier = str => (str && str.match(/^[^\s!"#%&\\'()*+,\-./:;<=>?@[\ const is_valid_message = (block, message, translation) => { switch (message.ruleId) { case 'eol-last': return false; + case '@typescript-eslint/indent': case 'indent': return !translation.options.template; case 'linebreak-style': return message.line !== translation.end; case 'no-labels': return get_identifier(get_referenced_string(block, message)) !== '$'; 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-unused-labels': return get_referenced_string(block, message) !== '$'; + case '@typescript-eslint/quotes': case 'quotes': return !translation.options.in_quoted_attribute; } return true; From 28fc32e387fd889a1a1fcbce8f270eeb4d6a91f5 Mon Sep 17 00:00:00 2001 From: jason lim <50891910+Sxxov@users.noreply.github.com> Date: Tue, 16 Mar 2021 16:57:22 +0800 Subject: [PATCH 2/3] Add tests for @typescript-eslint/indent, quotes --- .../typescript-indentation/.eslintrc.js | 11 +++++++ .../typescript-indentation/Input.svelte | 6 ++++ .../typescript-indentation/expected.json | 31 +++++++++++++++++++ .../typescript-template-quotes/.eslintrc.js | 10 ++++++ .../typescript-template-quotes/Input.svelte | 4 +++ .../typescript-template-quotes/expected.json | 24 ++++++++++++++ 6 files changed, 86 insertions(+) create mode 100644 test/samples/typescript-indentation/.eslintrc.js create mode 100644 test/samples/typescript-indentation/Input.svelte create mode 100644 test/samples/typescript-indentation/expected.json create mode 100644 test/samples/typescript-template-quotes/.eslintrc.js create mode 100644 test/samples/typescript-template-quotes/Input.svelte create mode 100644 test/samples/typescript-template-quotes/expected.json diff --git a/test/samples/typescript-indentation/.eslintrc.js b/test/samples/typescript-indentation/.eslintrc.js new file mode 100644 index 0000000..b46af0a --- /dev/null +++ b/test/samples/typescript-indentation/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + parser: '@typescript-eslint/parser', + plugins: [ + '@typescript-eslint', + ], + rules: { + indent: 'off', + '@typescript-eslint/indent': ['error', 'tab'], + semi: 'error', + }, +}; \ No newline at end of file diff --git a/test/samples/typescript-indentation/Input.svelte b/test/samples/typescript-indentation/Input.svelte new file mode 100644 index 0000000..e58dedb --- /dev/null +++ b/test/samples/typescript-indentation/Input.svelte @@ -0,0 +1,6 @@ + + +