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'],