-
Notifications
You must be signed in to change notification settings - Fork 1
/
ExportNamedDeclaration.js
115 lines (110 loc) · 1.96 KB
/
ExportNamedDeclaration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* @param {import("eslint").RuleTester.ValidTestCase[]} valid
* @param {import("eslint").RuleTester.InvalidTestCase[]} invalid
*/
exports.module = (valid, invalid) => {
valid.push(
{
code: `
export { a, b as c, d } from 'module'
export { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
`,
options: [ { maxLength: 30 } ],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
}
},
{
code: `
var a, b, c
export { a, b, c };
`,
options: [ { semicolon: true } ],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
}
}
)
invalid.push(
{
code: `
export { a, b as c, d } from 'module'
export { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
`,
errors: [
{
messageId: "exports",
type: "ExportNamedDeclaration",
line: 3,
column: 4
},
{
messageId: "exports",
type: "ExportNamedDeclaration",
line: 4,
column: 7
}
],
options: [
{ maxLength: 10, semicolon: true }
],
output: `
export { a, b as c, d } from 'module';
export {
fff,
ggg,
hhh,
iii,
jjj,
kkk,
lll
} from 'module/2';
`,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
}
},
{
code: `
export { a, b as c, d } from 'module' ;
export { fff, ggg, hhh, iii, jjj, kkk, lll } from 'module/2'
`,
errors: [
{
messageId: "exports",
type: "ExportNamedDeclaration",
line: 3,
column: 4
},
{
messageId: "exports",
type: "ExportNamedDeclaration",
line: 4,
column: 7
}
],
options: [
{ indent: " ", maxLength: 10 }
],
output: `
export { a, b as c, d } from 'module'
export {
fff,
ggg,
hhh,
iii,
jjj,
kkk,
lll
} from 'module/2'
`,
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
}
}
)
}