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; diff --git a/test/samples/typescript-indentation/.eslintrc.js b/test/samples/typescript-indentation/.eslintrc.js new file mode 100644 index 0000000..a790a92 --- /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', + }, +}; 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 @@ + + +
{foo}
diff --git a/test/samples/typescript-indentation/expected.json b/test/samples/typescript-indentation/expected.json new file mode 100644 index 0000000..374119a --- /dev/null +++ b/test/samples/typescript-indentation/expected.json @@ -0,0 +1,31 @@ +[ + { + "ruleId": "semi", + "line": 2, + "column": 9, + "fix": { + "range": [27, 27], + "text": ";" + } + }, + { + "ruleId": "@typescript-eslint/indent", + "line": 3, + "column": 2, + "endLine": 3, + "endColumn": 3, + "fix": { + "range": [29, 30], + "text": "" + } + }, + { + "ruleId": "semi", + "line": 3, + "column": 10, + "fix": { + "range": [37, 37], + "text": ";" + } + } +] diff --git a/test/samples/typescript-template-quotes/.eslintrc.js b/test/samples/typescript-template-quotes/.eslintrc.js new file mode 100644 index 0000000..2960738 --- /dev/null +++ b/test/samples/typescript-template-quotes/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + parser: '@typescript-eslint/parser', + plugins: [ + '@typescript-eslint', + ], + rules: { + quotes: 'off', + '@typescript-eslint/quotes': ['error', 'single'] + }, +}; diff --git a/test/samples/typescript-template-quotes/Input.svelte b/test/samples/typescript-template-quotes/Input.svelte new file mode 100644 index 0000000..ac70805 --- /dev/null +++ b/test/samples/typescript-template-quotes/Input.svelte @@ -0,0 +1,4 @@ +{'foo'} +{"bar"} +
+
diff --git a/test/samples/typescript-template-quotes/expected.json b/test/samples/typescript-template-quotes/expected.json new file mode 100644 index 0000000..3c413ea --- /dev/null +++ b/test/samples/typescript-template-quotes/expected.json @@ -0,0 +1,24 @@ +[ + { + "ruleId": "@typescript-eslint/quotes", + "line": 2, + "column": 2, + "endLine": 2, + "endColumn": 7, + "fix": { + "range": [9, 14], + "text": "'bar'" + } + }, + { + "ruleId": "@typescript-eslint/quotes", + "line": 3, + "column": 13, + "endLine": 3, + "endColumn": 19, + "fix": { + "range": [28, 34], + "text": "'baz1'" + } + } +]