From ad2d9afad2bad7e6d724d23e1bd2b7d047e54a90 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 10 Jun 2022 08:59:12 -0700 Subject: [PATCH] add tests for mixed default/named imports --- .../rules/consistent-type-specifier-style.js | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/src/rules/consistent-type-specifier-style.js b/tests/src/rules/consistent-type-specifier-style.js index dc3d656332..e924e6669c 100644 --- a/tests/src/rules/consistent-type-specifier-style.js +++ b/tests/src/rules/consistent-type-specifier-style.js @@ -82,6 +82,24 @@ const COMMON_TESTS = { type: 'ImportSpecifier', }], }, + { + code: "import Foo, { type Bar } from 'Foo';", + output: "import Foo, { } from 'Foo';\nimport type {Bar} from 'Foo';", + options: ['prefer-top-level'], + errors: [{ + message: 'Prefer using a top-level type-only import instead of inline type specifiers.', + type: 'ImportSpecifier', + }], + }, + { + code: "import Foo, { type Bar, Baz } from 'Foo';", + output: "import Foo, { Baz } from 'Foo';\nimport type {Bar} from 'Foo';", + options: ['prefer-top-level'], + errors: [{ + message: 'Prefer using a top-level type-only import instead of inline type specifiers.', + type: 'ImportSpecifier', + }], + }, // // prefer-inline @@ -216,6 +234,24 @@ const FLOW_ONLY = { }, ], }, + { + code: "import Foo, { typeof Bar } from 'Foo';", + output: "import Foo, { } from 'Foo';\nimport typeof {Bar} from 'Foo';", + options: ['prefer-top-level'], + errors: [{ + message: 'Prefer using a top-level typeof-only import instead of inline typeof specifiers.', + type: 'ImportSpecifier', + }], + }, + { + code: "import Foo, { typeof Bar, Baz } from 'Foo';", + output: "import Foo, { Baz } from 'Foo';\nimport typeof {Bar} from 'Foo';", + options: ['prefer-top-level'], + errors: [{ + message: 'Prefer using a top-level typeof-only import instead of inline typeof specifiers.', + type: 'ImportSpecifier', + }], + }, // // prefer-inline