@@ -2186,12 +2186,13 @@ context('TypeScript', function () {
2186
2186
{
2187
2187
code : `
2188
2188
import c from 'Bar';
2189
- import type { C } from 'Bar';
2190
2189
import b from 'bar';
2191
2190
import a from 'foo';
2192
- import type { A } from 'foo';
2193
2191
2194
2192
import index from './';
2193
+
2194
+ import type { C } from 'Bar';
2195
+ import type { A } from 'foo';
2195
2196
` ,
2196
2197
parser,
2197
2198
options : [
@@ -2208,12 +2209,13 @@ context('TypeScript', function () {
2208
2209
{
2209
2210
code : `
2210
2211
import a from 'foo';
2211
- import type { A } from 'foo';
2212
2212
import b from 'bar';
2213
2213
import c from 'Bar';
2214
- import type { C } from 'Bar';
2215
2214
2216
2215
import index from './';
2216
+
2217
+ import type { A } from 'foo';
2218
+ import type { C } from 'Bar';
2217
2219
` ,
2218
2220
parser,
2219
2221
options : [
@@ -2233,20 +2235,22 @@ context('TypeScript', function () {
2233
2235
code : `
2234
2236
import b from 'bar';
2235
2237
import c from 'Bar';
2236
- import type { C } from 'Bar';
2237
2238
import a from 'foo';
2238
- import type { A } from 'foo';
2239
2239
2240
2240
import index from './';
2241
+
2242
+ import type { A } from 'foo';
2243
+ import type { C } from 'Bar';
2241
2244
` ,
2242
2245
output : `
2243
2246
import c from 'Bar';
2244
- import type { C } from 'Bar';
2245
2247
import b from 'bar';
2246
2248
import a from 'foo';
2247
- import type { A } from 'foo';
2248
2249
2249
2250
import index from './';
2251
+
2252
+ import type { C } from 'Bar';
2253
+ import type { A } from 'foo';
2250
2254
` ,
2251
2255
parser,
2252
2256
options : [
@@ -2255,12 +2259,12 @@ context('TypeScript', function () {
2255
2259
alphabetize : { order : 'asc' } ,
2256
2260
} ,
2257
2261
] ,
2258
- errors : [
2259
- {
2260
- message : semver . satisfies ( eslintPkg . version , '< 3' )
2261
- ? '`bar` import should occur after import of `Bar`'
2262
- : / ( ` b a r ` i m p o r t s h o u l d o c c u r a f t e r i m p o r t o f ` B a r ` ) | ( ` B a r ` i m p o r t s h o u l d o c c u r b e f o r e i m p o r t o f ` b a r ` ) / ,
2263
- } ,
2262
+ errors : semver . satisfies ( eslintPkg . version , '< 3' ) ? [
2263
+ { message : '`Bar` import should occur before import of `bar`' } ,
2264
+ { message : '`Bar` import should occur before import of `foo`' } ,
2265
+ ] : [
2266
+ { message : / ( ` B a r ` i m p o r t s h o u l d o c c u r b e f o r e i m p o r t o f ` b a r ` ) | ( ` b a r ` i m p o r t s h o u l d o c c u r a f t e r i m p o r t o f ` B a r ` ) / } ,
2267
+ { message : / ( ` B a r ` i m p o r t s h o u l d o c c u r b e f o r e i m p o r t o f ` f o o ` ) | ( ` f o o ` i m p o r t s h o u l d o c c u r a f t e r i m p o r t o f ` B a r ` ) / } ,
2264
2268
] ,
2265
2269
} ,
2266
2270
parserConfig ,
@@ -2270,21 +2274,23 @@ context('TypeScript', function () {
2270
2274
{
2271
2275
code : `
2272
2276
import a from 'foo';
2273
- import type { A } from 'foo';
2274
2277
import c from 'Bar';
2275
- import type { C } from 'Bar';
2276
2278
import b from 'bar';
2277
2279
2278
2280
import index from './';
2281
+
2282
+ import type { C } from 'Bar';
2283
+ import type { A } from 'foo';
2279
2284
` ,
2280
2285
output : `
2281
2286
import a from 'foo';
2282
- import type { A } from 'foo';
2283
2287
import b from 'bar';
2284
2288
import c from 'Bar';
2285
- import type { C } from 'Bar';
2286
2289
2287
2290
import index from './';
2291
+
2292
+ import type { A } from 'foo';
2293
+ import type { C } from 'Bar';
2288
2294
` ,
2289
2295
parser,
2290
2296
options : [
@@ -2293,12 +2299,12 @@ context('TypeScript', function () {
2293
2299
alphabetize : { order : 'desc' } ,
2294
2300
} ,
2295
2301
] ,
2296
- errors : [
2297
- {
2298
- message : semver . satisfies ( eslintPkg . version , '< 3' )
2299
- ? '`bar` import should occur before import of `Bar`'
2300
- : / ( ` b a r ` i m p o r t s h o u l d o c c u r b e f o r e i m p o r t o f ` B a r ` ) | ( ` B a r ` i m p o r t s h o u l d o c c u r a f t e r i m p o r t o f ` b a r ` ) / ,
2301
- } ,
2302
+ errors : semver . satisfies ( eslintPkg . version , '< 3' ) ? [
2303
+ { message : '`bar` import should occur before import of `Bar`' } ,
2304
+ { message : '`foo` import should occur before import of `Bar`' } ,
2305
+ ] : [
2306
+ { message : / ( ` b a r ` i m p o r t s h o u l d o c c u r b e f o r e i m p o r t o f ` B a r ` ) | ( ` B a r ` i m p o r t s h o u l d o c c u r a f t e r i m p o r t o f ` b a r ` ) / } ,
2307
+ { message : / ( ` f o o ` i m p o r t s h o u l d o c c u r b e f o r e i m p o r t o f ` B a r ` ) | ( ` B a r ` i m p o r t s h o u l d o c c u r a f t e r i m p o r t o f ` f o o ` ) / } ,
2302
2308
] ,
2303
2309
} ,
2304
2310
parserConfig ,
0 commit comments