From 9f2b743f054890e65ba8e763fb5ef85737f70688 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 4 Sep 2022 18:50:46 +0930 Subject: [PATCH] cleanup tests a little --- .../rules/consistent-type-specifier-style.js | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/tests/src/rules/consistent-type-specifier-style.js b/tests/src/rules/consistent-type-specifier-style.js index 0ee437ead4..ea8be93dbe 100644 --- a/tests/src/rules/consistent-type-specifier-style.js +++ b/tests/src/rules/consistent-type-specifier-style.js @@ -6,106 +6,100 @@ const rule = require('rules/consistent-type-specifier-style'); const COMMON_TESTS = { valid: [ // - // always valid + // prefer-top-level // - // prefer-inline test({ code: "import Foo from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import type Foo from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import { Foo } from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import { Foo as Bar } from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import * as Foo from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import {} from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), test({ code: "import type {} from 'Foo';", - options: ['prefer-inline'], + options: ['prefer-top-level'], }), - // prefer-top-level test({ - code: "import Foo from 'Foo';", + code: "import type { Foo } from 'Foo';", options: ['prefer-top-level'], }), test({ - code: "import type Foo from 'Foo';", + code: "import type { Foo as Bar } from 'Foo';", options: ['prefer-top-level'], }), test({ - code: "import { Foo } from 'Foo';", + code: "import type { Foo, Bar, Baz, Bam } from 'Foo';", options: ['prefer-top-level'], }), + + // + // prefer-inline + // + test({ + code: "import Foo from 'Foo';", + options: ['prefer-inline'], + }), + test({ + code: "import type Foo from 'Foo';", + options: ['prefer-inline'], + }), + test({ + code: "import { Foo } from 'Foo';", + options: ['prefer-inline'], + }), test({ code: "import { Foo as Bar } from 'Foo';", - options: ['prefer-top-level'], + options: ['prefer-inline'], }), test({ code: "import * as Foo from 'Foo';", - options: ['prefer-top-level'], + options: ['prefer-inline'], }), test({ code: "import 'Foo';", - options: ['prefer-top-level'], + options: ['prefer-inline'], }), test({ code: "import {} from 'Foo';", - options: ['prefer-top-level'], + options: ['prefer-inline'], }), test({ code: "import type {} from 'Foo';", - options: ['prefer-top-level'], + options: ['prefer-inline'], }), - - // - // prefer-inline - // - { + test({ code: "import { type Foo } from 'Foo';", options: ['prefer-inline'], - }, - { + }), + test({ code: "import { type Foo as Bar } from 'Foo';", options: ['prefer-inline'], - }, - { + }), + test({ code: "import { type Foo, type Bar, Baz, Bam } from 'Foo';", options: ['prefer-inline'], - }, - - // - // prefer-top-level - // - { - code: "import type { Foo } from 'Foo';", - options: ['prefer-top-level'], - }, - { - code: "import type { Foo as Bar } from 'Foo';", - options: ['prefer-top-level'], - }, - { - code: "import type { Foo, Bar, Baz, Bam } from 'Foo';", - options: ['prefer-top-level'], - }, + }), ], invalid: [ // @@ -214,6 +208,10 @@ const FLOW_ONLY = { // // prefer-top-level // + { + code: "import typeof Foo from 'Foo';", + options: ['prefer-top-level'], + }, { code: "import typeof { Foo, Bar, Baz, Bam } from 'Foo';", options: ['prefer-top-level'], @@ -222,6 +220,10 @@ const FLOW_ONLY = { // // prefer-inline // + { + code: "import typeof Foo from 'Foo';", + options: ['prefer-inline'], + }, { code: "import { typeof Foo } from 'Foo';", options: ['prefer-inline'],