From cef9e499cda7da5e3bc7a185a6a8731094e6b649 Mon Sep 17 00:00:00 2001 From: Jeremy Gayed <244704+tizmagik@users.noreply.github.com> Date: Fri, 2 Jun 2023 11:17:09 -0400 Subject: [PATCH] Enable @typescript-eslint/consistent-type-imports This is a valuable rule to make it clear when a token being imported is used strictly for the type system vs a value at runtime. https://typescript-eslint.io/rules/consistent-type-imports/ The rule is auto-fixable --- .changeset/fluffy-spoons-admire.md | 5 +++++ packages/eslint-plugin/lib/config/typescript.js | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/fluffy-spoons-admire.md diff --git a/.changeset/fluffy-spoons-admire.md b/.changeset/fluffy-spoons-admire.md new file mode 100644 index 00000000..ef802c68 --- /dev/null +++ b/.changeset/fluffy-spoons-admire.md @@ -0,0 +1,5 @@ +--- +'@shopify/eslint-plugin': minor +--- + +Enable @typescript-eslint/consistent-type-imports to error diff --git a/packages/eslint-plugin/lib/config/typescript.js b/packages/eslint-plugin/lib/config/typescript.js index 69caf947..4c5f4aaa 100644 --- a/packages/eslint-plugin/lib/config/typescript.js +++ b/packages/eslint-plugin/lib/config/typescript.js @@ -187,6 +187,8 @@ module.exports = { '@typescript-eslint/ban-ts-comment': 'error', // Enforce consistent brace style for blocks '@typescript-eslint/brace-style': 'error', + // Enforce consistent type imports when importing a token as strictly a type vs as a runtime value + '@typescript-eslint/consistent-type-imports': 'error', // Enforces consistent usage of type assertions. '@typescript-eslint/consistent-type-assertions': [ 'error',