From be4a0b3719c51fc769cc31e685a2f769570f91a1 Mon Sep 17 00:00:00 2001 From: meowtec Date: Mon, 8 Mar 2021 19:50:37 +0800 Subject: [PATCH 1/2] should ignore `@typescript-eslint/indent` in template --- src/postprocess.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/postprocess.js b/src/postprocess.js index 875806f..6d7bfeb 100644 --- a/src/postprocess.js +++ b/src/postprocess.js @@ -92,6 +92,7 @@ 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)) !== '$'; From 0734776e8e5142ac76d8f465178260129e5a8a3e Mon Sep 17 00:00:00 2001 From: meowtec Date: Mon, 8 Mar 2021 20:44:37 +0800 Subject: [PATCH 2/2] add test case for using `@typescript-eslint/indent` --- test/samples/typescript-indentation/.eslintrc.js | 12 ++++++++++++ test/samples/typescript-indentation/Input.svelte | 6 ++++++ test/samples/typescript-indentation/expected.json | 8 ++++++++ 3 files changed, 26 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 diff --git a/test/samples/typescript-indentation/.eslintrc.js b/test/samples/typescript-indentation/.eslintrc.js new file mode 100644 index 0000000..e20b129 --- /dev/null +++ b/test/samples/typescript-indentation/.eslintrc.js @@ -0,0 +1,12 @@ +module.exports = { + parser: '@typescript-eslint/parser', + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + plugins: ['@typescript-eslint'], + settings: { + 'svelte3/typescript': require('typescript'), + }, + rules: { + indent: 0, + '@typescript-eslint/indent': ['error', 'tab'], + }, +}; diff --git a/test/samples/typescript-indentation/Input.svelte b/test/samples/typescript-indentation/Input.svelte new file mode 100644 index 0000000..13ac40e --- /dev/null +++ b/test/samples/typescript-indentation/Input.svelte @@ -0,0 +1,6 @@ + + +
{b}
diff --git a/test/samples/typescript-indentation/expected.json b/test/samples/typescript-indentation/expected.json new file mode 100644 index 0000000..a251ccd --- /dev/null +++ b/test/samples/typescript-indentation/expected.json @@ -0,0 +1,8 @@ +[ + { + "line": 3, + "column": 2, + "endLine": 3, + "endColumn": 3 + } +] \ No newline at end of file