@borela-tech/eslint-config 2.2.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +308 -19
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +3589 -811
- package/dist/index.mjs.map +1 -1
- package/jest.config.ts +19 -0
- package/package.json +17 -8
- package/vite.config.ts +41 -0
- package/bin/build +0 -9
- package/bin/lint +0 -14
- package/bin/publish +0 -12
- package/bin/test +0 -12
- package/bin/typecheck +0 -8
- package/dist/index.d.mts +0 -7
- package/src/index.ts +0 -149
- package/src/lib/ReExportDeclaration.ts +0 -5
- package/src/lib/ReplacementRange.ts +0 -4
- package/src/lib/compare.ts +0 -3
- package/src/rules/__tests__/dedent/countLeadingSpaces.ts +0 -4
- package/src/rules/__tests__/dedent/findMinIndent.ts +0 -7
- package/src/rules/__tests__/dedent/index.ts +0 -17
- package/src/rules/__tests__/dedent/interpolate.ts +0 -11
- package/src/rules/__tests__/dedent/removeEmptyPrefix.ts +0 -6
- package/src/rules/__tests__/dedent/removeEmptySuffix.ts +0 -6
- package/src/rules/__tests__/dedent/removeIndent.ts +0 -3
- package/src/rules/__tests__/importsAndReExportsAtTop.test.ts +0 -88
- package/src/rules/__tests__/individualImports.test.ts +0 -44
- package/src/rules/__tests__/individualReExports.test.ts +0 -64
- package/src/rules/__tests__/multilineUnionTypes.test.ts +0 -75
- package/src/rules/__tests__/singleLineImports.test.ts +0 -129
- package/src/rules/__tests__/singleLineReExports.test.ts +0 -100
- package/src/rules/__tests__/sortedImports.test.ts +0 -227
- package/src/rules/__tests__/sortedReExports.test.ts +0 -220
- package/src/rules/importsAndReExportsAtTop/CategorizedStatements.ts +0 -8
- package/src/rules/importsAndReExportsAtTop/StatementIndices.ts +0 -5
- package/src/rules/importsAndReExportsAtTop/categorizeStatements.ts +0 -28
- package/src/rules/importsAndReExportsAtTop/findStatementIndices.ts +0 -25
- package/src/rules/importsAndReExportsAtTop/generateSortedText.ts +0 -16
- package/src/rules/importsAndReExportsAtTop/getStatementType.ts +0 -17
- package/src/rules/importsAndReExportsAtTop/hasViolation.ts +0 -25
- package/src/rules/importsAndReExportsAtTop/index.ts +0 -45
- package/src/rules/importsAndReExportsAtTop/isImportDeclaration.ts +0 -7
- package/src/rules/importsAndReExportsAtTop/isReExport.ts +0 -12
- package/src/rules/importsAndReExportsAtTop/statementType.ts +0 -4
- package/src/rules/individualImports.ts +0 -38
- package/src/rules/individualReExports.ts +0 -51
- package/src/rules/multilineUnionTypes/createFix.ts +0 -13
- package/src/rules/multilineUnionTypes/index.ts +0 -52
- package/src/rules/multilineUnionTypes/isMultiline.ts +0 -6
- package/src/rules/singleLineImports/createFix.ts +0 -23
- package/src/rules/singleLineImports/formatAttributes.ts +0 -20
- package/src/rules/singleLineImports/formatNamed.ts +0 -9
- package/src/rules/singleLineImports/formatSpecifiers.ts +0 -32
- package/src/rules/singleLineImports/index.ts +0 -34
- package/src/rules/singleLineImports/isMultiline.ts +0 -6
- package/src/rules/singleLineReExports/createFix.ts +0 -29
- package/src/rules/singleLineReExports/index.ts +0 -48
- package/src/rules/singleLineReExports/isMultiline.ts +0 -6
- package/src/rules/sortedImports/CategorizedImport.ts +0 -8
- package/src/rules/sortedImports/ImportError.ts +0 -9
- package/src/rules/sortedImports/ImportGroup.ts +0 -6
- package/src/rules/sortedImports/ImportGroupOrder.ts +0 -9
- package/src/rules/sortedImports/areSpecifiersSorted.ts +0 -9
- package/src/rules/sortedImports/categorizeImport.ts +0 -23
- package/src/rules/sortedImports/categorizeImports.ts +0 -12
- package/src/rules/sortedImports/checkAlphabeticalSorting.ts +0 -23
- package/src/rules/sortedImports/checkGroupOrdering.ts +0 -21
- package/src/rules/sortedImports/checkSpecifiersSorting.ts +0 -21
- package/src/rules/sortedImports/createFix/buildSortedCode.ts +0 -23
- package/src/rules/sortedImports/createFix/findLastImportIndex.ts +0 -12
- package/src/rules/sortedImports/createFix/formatNamedImport.ts +0 -21
- package/src/rules/sortedImports/createFix/getReplacementRange.ts +0 -14
- package/src/rules/sortedImports/createFix/groupImportsByType.ts +0 -19
- package/src/rules/sortedImports/createFix/index.ts +0 -47
- package/src/rules/sortedImports/createFix/sortImportGroups.ts +0 -13
- package/src/rules/sortedImports/getImportGroups.ts +0 -23
- package/src/rules/sortedImports/getNamedSpecifiers.ts +0 -7
- package/src/rules/sortedImports/getSortKey.ts +0 -26
- package/src/rules/sortedImports/getSpecifierName.ts +0 -7
- package/src/rules/sortedImports/index.ts +0 -63
- package/src/rules/sortedImports/sortSpecifiersText.ts +0 -16
- package/src/rules/sortedReExports/CategorizedNamedReExport.ts +0 -6
- package/src/rules/sortedReExports/CategorizedReExport.ts +0 -26
- package/src/rules/sortedReExports/ReExportError.ts +0 -9
- package/src/rules/sortedReExports/ReExportGroup.ts +0 -5
- package/src/rules/sortedReExports/ReExportGroupOrder.ts +0 -8
- package/src/rules/sortedReExports/areSpecifiersSorted.ts +0 -9
- package/src/rules/sortedReExports/categorizeReExport.ts +0 -21
- package/src/rules/sortedReExports/categorizeReExports.ts +0 -14
- package/src/rules/sortedReExports/checkAlphabeticalSorting.ts +0 -25
- package/src/rules/sortedReExports/checkGroupOrdering.ts +0 -21
- package/src/rules/sortedReExports/checkSpecifiersSorting.ts +0 -23
- package/src/rules/sortedReExports/createFix/buildSortedCode.ts +0 -29
- package/src/rules/sortedReExports/createFix/findFirstExportIndex.ts +0 -11
- package/src/rules/sortedReExports/createFix/findLastExportIndex.ts +0 -12
- package/src/rules/sortedReExports/createFix/formatNamedReExport.ts +0 -21
- package/src/rules/sortedReExports/createFix/getReplacementRange.ts +0 -22
- package/src/rules/sortedReExports/createFix/groupReExportsByType.ts +0 -18
- package/src/rules/sortedReExports/createFix/index.ts +0 -47
- package/src/rules/sortedReExports/createFix/sortExportGroups.ts +0 -12
- package/src/rules/sortedReExports/getNamedSpecifiers.ts +0 -9
- package/src/rules/sortedReExports/getReExportGroups.ts +0 -33
- package/src/rules/sortedReExports/getSortKey.ts +0 -22
- package/src/rules/sortedReExports/getSpecifierName.ts +0 -7
- package/src/rules/sortedReExports/index.ts +0 -63
- package/src/rules/sortedReExports/isNamedReExport.ts +0 -6
- package/src/rules/sortedReExports/sortSpecifiersText.ts +0 -16
- package/tsdown.config.ts +0 -22
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import typescript from 'typescript-eslint'
|
|
2
|
-
import {dedent} from './dedent'
|
|
3
|
-
import {multilineUnionTypes} from '../multilineUnionTypes'
|
|
4
|
-
import {RuleTester} from 'eslint'
|
|
5
|
-
import type {Rule} from 'eslint'
|
|
6
|
-
|
|
7
|
-
const rule = multilineUnionTypes as unknown as Rule.RuleModule
|
|
8
|
-
const ruleTester = new RuleTester({
|
|
9
|
-
languageOptions: {
|
|
10
|
-
parser: typescript.parser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
ruleTester.run('multiline-union-types', rule, {
|
|
19
|
-
valid: [{
|
|
20
|
-
code: 'type A = B',
|
|
21
|
-
}, {
|
|
22
|
-
code: dedent`
|
|
23
|
-
type A =
|
|
24
|
-
| B
|
|
25
|
-
| C
|
|
26
|
-
`,
|
|
27
|
-
}, {
|
|
28
|
-
code: dedent`
|
|
29
|
-
export type A =
|
|
30
|
-
| B
|
|
31
|
-
| C
|
|
32
|
-
| D
|
|
33
|
-
`,
|
|
34
|
-
}],
|
|
35
|
-
invalid: [{
|
|
36
|
-
code: 'type A = B | C | D',
|
|
37
|
-
errors: [{messageId: 'singleLine'}],
|
|
38
|
-
output: dedent`
|
|
39
|
-
type A =
|
|
40
|
-
| B
|
|
41
|
-
| C
|
|
42
|
-
| D
|
|
43
|
-
`,
|
|
44
|
-
}, {
|
|
45
|
-
code: dedent`
|
|
46
|
-
type A = B |
|
|
47
|
-
C |
|
|
48
|
-
D
|
|
49
|
-
`,
|
|
50
|
-
errors: [{messageId: 'missingPipes'}],
|
|
51
|
-
output: dedent`
|
|
52
|
-
type A =
|
|
53
|
-
| B
|
|
54
|
-
| C
|
|
55
|
-
| D
|
|
56
|
-
`,
|
|
57
|
-
}, {
|
|
58
|
-
code: 'type A = string | number | boolean',
|
|
59
|
-
errors: [{messageId: 'singleLine'}],
|
|
60
|
-
output: dedent`
|
|
61
|
-
type A =
|
|
62
|
-
| string
|
|
63
|
-
| number
|
|
64
|
-
| boolean
|
|
65
|
-
`,
|
|
66
|
-
}, {
|
|
67
|
-
code: 'export type Foo = Bar | Baz',
|
|
68
|
-
errors: [{messageId: 'singleLine'}],
|
|
69
|
-
output: dedent`
|
|
70
|
-
export type Foo =
|
|
71
|
-
| Bar
|
|
72
|
-
| Baz
|
|
73
|
-
`,
|
|
74
|
-
}],
|
|
75
|
-
})
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import typescript from 'typescript-eslint'
|
|
2
|
-
import {dedent} from './dedent'
|
|
3
|
-
import {RuleTester} from 'eslint'
|
|
4
|
-
import {singleLineImports} from '../singleLineImports'
|
|
5
|
-
import type {Rule} from 'eslint'
|
|
6
|
-
|
|
7
|
-
const rule = singleLineImports as unknown as Rule.RuleModule
|
|
8
|
-
const ruleTester = new RuleTester({
|
|
9
|
-
languageOptions: {
|
|
10
|
-
parser: typescript.parser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
ruleTester.run('single-line-imports', rule, {
|
|
19
|
-
valid: [{
|
|
20
|
-
code: "import {foo} from 'bar'",
|
|
21
|
-
}, {
|
|
22
|
-
code: "import foo from 'bar'",
|
|
23
|
-
}, {
|
|
24
|
-
code: "import * as foo from 'bar'",
|
|
25
|
-
}, {
|
|
26
|
-
code: "import 'bar'",
|
|
27
|
-
}, {
|
|
28
|
-
code: "import type {Foo} from 'bar'",
|
|
29
|
-
}, {
|
|
30
|
-
code: "import foo, {bar} from 'baz'",
|
|
31
|
-
}, {
|
|
32
|
-
code: "import {a, b, c} from 'bar'",
|
|
33
|
-
}, {
|
|
34
|
-
code: "import {foo} from 'bar' with {type: 'json'}",
|
|
35
|
-
}, {
|
|
36
|
-
code: "import type {Foo} from 'bar' with {type: 'json'}",
|
|
37
|
-
}],
|
|
38
|
-
invalid: [{
|
|
39
|
-
code: dedent`
|
|
40
|
-
import {
|
|
41
|
-
foo,
|
|
42
|
-
} from 'bar'
|
|
43
|
-
`,
|
|
44
|
-
errors: [{messageId: 'multiline'}],
|
|
45
|
-
output: dedent`
|
|
46
|
-
import {foo} from 'bar'
|
|
47
|
-
`,
|
|
48
|
-
}, {
|
|
49
|
-
code: dedent`
|
|
50
|
-
import type {
|
|
51
|
-
Foo,
|
|
52
|
-
} from 'bar'
|
|
53
|
-
`,
|
|
54
|
-
errors: [{messageId: 'multiline'}],
|
|
55
|
-
output: dedent`
|
|
56
|
-
import type {Foo} from 'bar'
|
|
57
|
-
`,
|
|
58
|
-
}, {
|
|
59
|
-
code: dedent`
|
|
60
|
-
import {
|
|
61
|
-
a,
|
|
62
|
-
b,
|
|
63
|
-
c,
|
|
64
|
-
} from 'bar'
|
|
65
|
-
`,
|
|
66
|
-
errors: [{messageId: 'multiline'}],
|
|
67
|
-
output: dedent`
|
|
68
|
-
import {a, b, c} from 'bar'
|
|
69
|
-
`,
|
|
70
|
-
}, {
|
|
71
|
-
code: dedent`
|
|
72
|
-
import foo, {
|
|
73
|
-
bar,
|
|
74
|
-
} from 'baz'
|
|
75
|
-
`,
|
|
76
|
-
errors: [{messageId: 'multiline'}],
|
|
77
|
-
output: dedent`
|
|
78
|
-
import foo, {bar} from 'baz'
|
|
79
|
-
`,
|
|
80
|
-
}, {
|
|
81
|
-
code: dedent`
|
|
82
|
-
import
|
|
83
|
-
foo
|
|
84
|
-
from 'bar'
|
|
85
|
-
`,
|
|
86
|
-
errors: [{messageId: 'multiline'}],
|
|
87
|
-
output: dedent`
|
|
88
|
-
import foo from 'bar'
|
|
89
|
-
`,
|
|
90
|
-
}, {
|
|
91
|
-
code: dedent`
|
|
92
|
-
import * as foo
|
|
93
|
-
from 'bar'
|
|
94
|
-
`,
|
|
95
|
-
errors: [{messageId: 'multiline'}],
|
|
96
|
-
output: dedent`
|
|
97
|
-
import * as foo from 'bar'
|
|
98
|
-
`,
|
|
99
|
-
}, {
|
|
100
|
-
code: dedent`
|
|
101
|
-
import
|
|
102
|
-
'bar'
|
|
103
|
-
`,
|
|
104
|
-
errors: [{messageId: 'multiline'}],
|
|
105
|
-
output: dedent`
|
|
106
|
-
import 'bar'
|
|
107
|
-
`,
|
|
108
|
-
}, {
|
|
109
|
-
code: dedent`
|
|
110
|
-
import {
|
|
111
|
-
foo,
|
|
112
|
-
} from 'bar' with {type: 'json'}
|
|
113
|
-
`,
|
|
114
|
-
errors: [{messageId: 'multiline'}],
|
|
115
|
-
output: dedent`
|
|
116
|
-
import {foo} from 'bar' with {type: 'json'}
|
|
117
|
-
`,
|
|
118
|
-
}, {
|
|
119
|
-
code: dedent`
|
|
120
|
-
import type {
|
|
121
|
-
Foo,
|
|
122
|
-
} from 'bar' with {type: 'json'}
|
|
123
|
-
`,
|
|
124
|
-
errors: [{messageId: 'multiline'}],
|
|
125
|
-
output: dedent`
|
|
126
|
-
import type {Foo} from 'bar' with {type: 'json'}
|
|
127
|
-
`,
|
|
128
|
-
}],
|
|
129
|
-
})
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import typescript from 'typescript-eslint'
|
|
2
|
-
import {dedent} from './dedent'
|
|
3
|
-
import {RuleTester} from 'eslint'
|
|
4
|
-
import {singleLineReExports} from '../singleLineReExports'
|
|
5
|
-
import type {Rule} from 'eslint'
|
|
6
|
-
|
|
7
|
-
const rule = singleLineReExports as unknown as Rule.RuleModule
|
|
8
|
-
const ruleTester = new RuleTester({
|
|
9
|
-
languageOptions: {
|
|
10
|
-
parser: typescript.parser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
ruleTester.run('single-line-re-exports', rule, {
|
|
19
|
-
valid: [{
|
|
20
|
-
code: "export {foo} from 'bar'",
|
|
21
|
-
}, {
|
|
22
|
-
code: "export * from 'bar'",
|
|
23
|
-
}, {
|
|
24
|
-
code: "export * as foo from 'bar'",
|
|
25
|
-
}, {
|
|
26
|
-
code: "export type {Foo} from 'bar'",
|
|
27
|
-
}, {
|
|
28
|
-
code: "export {a, b, c} from 'bar'",
|
|
29
|
-
}, {
|
|
30
|
-
// Local export, not a re-export
|
|
31
|
-
code: dedent`
|
|
32
|
-
export {
|
|
33
|
-
foo,
|
|
34
|
-
}
|
|
35
|
-
`,
|
|
36
|
-
}, {
|
|
37
|
-
code: "export {foo} from 'bar' with {type: 'json'}",
|
|
38
|
-
}],
|
|
39
|
-
invalid: [{
|
|
40
|
-
code: dedent`
|
|
41
|
-
export {
|
|
42
|
-
foo,
|
|
43
|
-
} from 'bar'
|
|
44
|
-
`,
|
|
45
|
-
errors: [{messageId: 'multiline'}],
|
|
46
|
-
output: dedent`
|
|
47
|
-
export {foo} from 'bar'
|
|
48
|
-
`,
|
|
49
|
-
}, {
|
|
50
|
-
code: dedent`
|
|
51
|
-
export type {
|
|
52
|
-
Foo,
|
|
53
|
-
} from 'bar'
|
|
54
|
-
`,
|
|
55
|
-
errors: [{messageId: 'multiline'}],
|
|
56
|
-
output: dedent`
|
|
57
|
-
export type {Foo} from 'bar'
|
|
58
|
-
`,
|
|
59
|
-
}, {
|
|
60
|
-
code: dedent`
|
|
61
|
-
export {
|
|
62
|
-
a,
|
|
63
|
-
b,
|
|
64
|
-
c,
|
|
65
|
-
} from 'bar'
|
|
66
|
-
`,
|
|
67
|
-
errors: [{messageId: 'multiline'}],
|
|
68
|
-
output: dedent`
|
|
69
|
-
export {a, b, c} from 'bar'
|
|
70
|
-
`,
|
|
71
|
-
}, {
|
|
72
|
-
code: `
|
|
73
|
-
export {
|
|
74
|
-
foo,
|
|
75
|
-
} from 'bar' with {type: 'json'}
|
|
76
|
-
`,
|
|
77
|
-
errors: [{messageId: 'multiline'}],
|
|
78
|
-
output: `
|
|
79
|
-
export {foo} from 'bar' with {type: 'json'}
|
|
80
|
-
`,
|
|
81
|
-
}, {
|
|
82
|
-
code: dedent`
|
|
83
|
-
export *
|
|
84
|
-
from 'bar'
|
|
85
|
-
`,
|
|
86
|
-
errors: [{messageId: 'multiline'}],
|
|
87
|
-
output: dedent`
|
|
88
|
-
export * from 'bar'
|
|
89
|
-
`,
|
|
90
|
-
}, {
|
|
91
|
-
code: dedent`
|
|
92
|
-
export * as foo
|
|
93
|
-
from 'bar'
|
|
94
|
-
`,
|
|
95
|
-
errors: [{messageId: 'multiline'}],
|
|
96
|
-
output: dedent`
|
|
97
|
-
export * as foo from 'bar'
|
|
98
|
-
`,
|
|
99
|
-
}],
|
|
100
|
-
})
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import typescript from 'typescript-eslint'
|
|
2
|
-
import {dedent} from './dedent'
|
|
3
|
-
import {RuleTester} from 'eslint'
|
|
4
|
-
import {sortedImports} from '../sortedImports'
|
|
5
|
-
import type {Rule} from 'eslint'
|
|
6
|
-
|
|
7
|
-
const rule = sortedImports as unknown as Rule.RuleModule
|
|
8
|
-
const ruleTester = new RuleTester({
|
|
9
|
-
languageOptions: {
|
|
10
|
-
parser: typescript.parser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2020,
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
ruleTester.run('sorted-imports', rule, {
|
|
19
|
-
valid: [{
|
|
20
|
-
code: "import {foo} from 'bar'",
|
|
21
|
-
}, {
|
|
22
|
-
code: "import foo from 'bar'",
|
|
23
|
-
}, {
|
|
24
|
-
code: "import 'bar'",
|
|
25
|
-
}, {
|
|
26
|
-
code: "import type {Foo} from 'bar'",
|
|
27
|
-
}, {
|
|
28
|
-
code: "import * as fs from 'fs'",
|
|
29
|
-
}, {
|
|
30
|
-
code: dedent`
|
|
31
|
-
import 'aaa'
|
|
32
|
-
import 'bbb'
|
|
33
|
-
import * as fs from 'fs'
|
|
34
|
-
import * as path from 'path'
|
|
35
|
-
import bar from 'bbb'
|
|
36
|
-
import foo from 'aaa'
|
|
37
|
-
import {a} from 'aaa'
|
|
38
|
-
import {b} from 'bbb'
|
|
39
|
-
import type {X} from 'xxx'
|
|
40
|
-
import type {Y} from 'yyy'
|
|
41
|
-
`,
|
|
42
|
-
}, {
|
|
43
|
-
code: dedent`
|
|
44
|
-
import {a} from 'ccc'
|
|
45
|
-
import {b} from 'aaa'
|
|
46
|
-
import {c} from 'bbb'
|
|
47
|
-
`,
|
|
48
|
-
}, {
|
|
49
|
-
code: dedent`
|
|
50
|
-
import {a, b, c} from 'bar'
|
|
51
|
-
`,
|
|
52
|
-
}, {
|
|
53
|
-
code: '',
|
|
54
|
-
}, {
|
|
55
|
-
code: 'const x = 1',
|
|
56
|
-
}],
|
|
57
|
-
invalid: [{
|
|
58
|
-
code: dedent`
|
|
59
|
-
import {c, a, b} from 'bar'
|
|
60
|
-
`,
|
|
61
|
-
errors: [{messageId: 'sortedNames'}],
|
|
62
|
-
output: dedent`
|
|
63
|
-
import {a, b, c} from 'bar'
|
|
64
|
-
`,
|
|
65
|
-
}, {
|
|
66
|
-
code: dedent`
|
|
67
|
-
import {b} from 'b'
|
|
68
|
-
const x = 1
|
|
69
|
-
import {c} from 'c'
|
|
70
|
-
import {a} from 'a'
|
|
71
|
-
`,
|
|
72
|
-
errors: [{messageId: 'sortedImports'}, {messageId: 'sortedImports'}],
|
|
73
|
-
output: dedent`
|
|
74
|
-
import {b} from 'b'
|
|
75
|
-
const x = 1
|
|
76
|
-
import {a} from 'a'
|
|
77
|
-
import {c} from 'c'
|
|
78
|
-
`,
|
|
79
|
-
}, {
|
|
80
|
-
code: dedent`
|
|
81
|
-
import {b} from 'b'
|
|
82
|
-
import {a} from 'a'
|
|
83
|
-
const x = 1
|
|
84
|
-
import {d} from 'd'
|
|
85
|
-
import {c} from 'c'
|
|
86
|
-
const y = 2
|
|
87
|
-
import {f} from 'f'
|
|
88
|
-
import {e} from 'e'
|
|
89
|
-
`,
|
|
90
|
-
errors: [
|
|
91
|
-
{messageId: 'sortedImports'},
|
|
92
|
-
{messageId: 'sortedImports'},
|
|
93
|
-
{messageId: 'sortedImports'},
|
|
94
|
-
{messageId: 'sortedImports'},
|
|
95
|
-
{messageId: 'sortedImports'},
|
|
96
|
-
{messageId: 'sortedImports'},
|
|
97
|
-
],
|
|
98
|
-
output: dedent`
|
|
99
|
-
import {a} from 'a'
|
|
100
|
-
import {b} from 'b'
|
|
101
|
-
const x = 1
|
|
102
|
-
import {c} from 'c'
|
|
103
|
-
import {d} from 'd'
|
|
104
|
-
const y = 2
|
|
105
|
-
import {e} from 'e'
|
|
106
|
-
import {f} from 'f'
|
|
107
|
-
`,
|
|
108
|
-
}, {
|
|
109
|
-
code: dedent`
|
|
110
|
-
import {z, a} from 'bar'
|
|
111
|
-
`,
|
|
112
|
-
errors: [{messageId: 'sortedNames'}],
|
|
113
|
-
output: dedent`
|
|
114
|
-
import {a, z} from 'bar'
|
|
115
|
-
`,
|
|
116
|
-
}, {
|
|
117
|
-
code: dedent`
|
|
118
|
-
import foo from 'aaa'
|
|
119
|
-
import bar from 'bbb'
|
|
120
|
-
`,
|
|
121
|
-
errors: [{messageId: 'sortedImports'}, {messageId: 'sortedImports'}],
|
|
122
|
-
output: dedent`
|
|
123
|
-
import bar from 'bbb'
|
|
124
|
-
import foo from 'aaa'
|
|
125
|
-
`,
|
|
126
|
-
}, {
|
|
127
|
-
code: dedent`
|
|
128
|
-
import 'bbb'
|
|
129
|
-
import 'aaa'
|
|
130
|
-
`,
|
|
131
|
-
errors: [{messageId: 'sortedImports'}, {messageId: 'sortedImports'}],
|
|
132
|
-
output: dedent`
|
|
133
|
-
import 'aaa'
|
|
134
|
-
import 'bbb'
|
|
135
|
-
`,
|
|
136
|
-
}, {
|
|
137
|
-
code: dedent`
|
|
138
|
-
import foo from 'bar'
|
|
139
|
-
import 'baz'
|
|
140
|
-
`,
|
|
141
|
-
errors: [{messageId: 'wrongGroup'}],
|
|
142
|
-
output: dedent`
|
|
143
|
-
import 'baz'
|
|
144
|
-
import foo from 'bar'
|
|
145
|
-
`,
|
|
146
|
-
}, {
|
|
147
|
-
code: dedent`
|
|
148
|
-
import {a} from 'bar'
|
|
149
|
-
import foo from 'baz'
|
|
150
|
-
`,
|
|
151
|
-
errors: [{messageId: 'wrongGroup'}],
|
|
152
|
-
output: dedent`
|
|
153
|
-
import foo from 'baz'
|
|
154
|
-
import {a} from 'bar'
|
|
155
|
-
`,
|
|
156
|
-
}, {
|
|
157
|
-
code: dedent`
|
|
158
|
-
import {b, a} from 'bar'
|
|
159
|
-
import foo from 'baz'
|
|
160
|
-
`,
|
|
161
|
-
errors: [{messageId: 'sortedNames'}, {messageId: 'wrongGroup'}],
|
|
162
|
-
output: dedent`
|
|
163
|
-
import foo from 'baz'
|
|
164
|
-
import {a, b} from 'bar'
|
|
165
|
-
`,
|
|
166
|
-
}, {
|
|
167
|
-
code: dedent`
|
|
168
|
-
import type {Y} from 'yyy'
|
|
169
|
-
import type {X} from 'xxx'
|
|
170
|
-
`,
|
|
171
|
-
errors: [{messageId: 'sortedImports'}, {messageId: 'sortedImports'}],
|
|
172
|
-
output: dedent`
|
|
173
|
-
import type {X} from 'xxx'
|
|
174
|
-
import type {Y} from 'yyy'
|
|
175
|
-
`,
|
|
176
|
-
}, {
|
|
177
|
-
code: dedent`
|
|
178
|
-
import type {Foo} from 'bar'
|
|
179
|
-
import {baz} from 'qux'
|
|
180
|
-
`,
|
|
181
|
-
errors: [{messageId: 'wrongGroup'}],
|
|
182
|
-
output: dedent`
|
|
183
|
-
import {baz} from 'qux'
|
|
184
|
-
import type {Foo} from 'bar'
|
|
185
|
-
`,
|
|
186
|
-
}, {
|
|
187
|
-
code: dedent`
|
|
188
|
-
import {existsSync} from 'fs'
|
|
189
|
-
import {basename} from 'path'
|
|
190
|
-
`,
|
|
191
|
-
errors: [{messageId: 'sortedImports'}, {messageId: 'sortedImports'}],
|
|
192
|
-
output: dedent`
|
|
193
|
-
import {basename} from 'path'
|
|
194
|
-
import {existsSync} from 'fs'
|
|
195
|
-
`,
|
|
196
|
-
}, {
|
|
197
|
-
code: dedent`
|
|
198
|
-
import * as path from 'path'
|
|
199
|
-
import * as fs from 'fs'
|
|
200
|
-
`,
|
|
201
|
-
errors: [{messageId: 'sortedImports'}, {messageId: 'sortedImports'}],
|
|
202
|
-
output: dedent`
|
|
203
|
-
import * as fs from 'fs'
|
|
204
|
-
import * as path from 'path'
|
|
205
|
-
`,
|
|
206
|
-
}, {
|
|
207
|
-
code: dedent`
|
|
208
|
-
import {foo} from 'bar'
|
|
209
|
-
import * as fs from 'fs'
|
|
210
|
-
`,
|
|
211
|
-
errors: [{messageId: 'wrongGroup'}],
|
|
212
|
-
output: dedent`
|
|
213
|
-
import * as fs from 'fs'
|
|
214
|
-
import {foo} from 'bar'
|
|
215
|
-
`,
|
|
216
|
-
}, {
|
|
217
|
-
code: dedent`
|
|
218
|
-
import foo from 'bar'
|
|
219
|
-
import * as fs from 'fs'
|
|
220
|
-
`,
|
|
221
|
-
errors: [{messageId: 'wrongGroup'}],
|
|
222
|
-
output: dedent`
|
|
223
|
-
import * as fs from 'fs'
|
|
224
|
-
import foo from 'bar'
|
|
225
|
-
`,
|
|
226
|
-
}],
|
|
227
|
-
})
|