@@ -16,13 +16,12 @@ const cases = [
16
16
'switch (foo) {case bar: {/* */}}' ,
17
17
'switch (foo) {default: {/* */}}' ,
18
18
'try {/* */} catch(foo){}' ,
19
- 'try {} catch(foo ){/* */}' ,
19
+ 'try {} catch(bar ){/* */}' ,
20
20
'try {} catch(foo){} finally {/* */}' ,
21
21
'do {/* */} while (foo)' ,
22
22
'while (foo){/* */}' ,
23
23
'foo = () => {/* */}' ,
24
24
'foo = function (){/* */}' ,
25
- 'function foo(){/* */}' ,
26
25
'foo = {/* */}' ,
27
26
'class Foo {bar() {/* */}}' ,
28
27
'foo = class {bar() {/* */}}' ,
@@ -49,11 +48,11 @@ test({
49
48
] . flatMap ( body => allCases . map ( code => code . replace ( SPACES_PLACEHOLDER , body ) ) ) ,
50
49
// Not empty
51
50
...cases . map ( code => code . replace ( SPACES_PLACEHOLDER , 'unicorn' ) ) ,
52
- ...classBodyCases . map ( code => code . replace ( SPACES_PLACEHOLDER , 'bar () {}' ) ) ,
51
+ ...classBodyCases . map ( code => code . replace ( SPACES_PLACEHOLDER , 'baz () {}' ) ) ,
53
52
// `with`
54
53
{
55
54
code : 'with (foo) {}' ,
56
- parserOptions : { ecmaVersion : 5 , sourceType : 'script' } ,
55
+ languageOptions : { ecmaVersion : 5 , sourceType : 'script' } ,
57
56
} ,
58
57
// We don't check these cases
59
58
...ignoredCases . map ( code => code . replace ( SPACES_PLACEHOLDER , ' ' ) ) ,
75
74
code : 'with (foo) { }' ,
76
75
output : 'with (foo) {}' ,
77
76
errors : 1 ,
78
- parserOptions : { ecmaVersion : 5 , sourceType : 'script' } ,
77
+ languageOptions : { ecmaVersion : 5 , sourceType : 'script' } ,
79
78
} ,
80
79
] ,
81
80
} ) ;
@@ -94,9 +93,11 @@ test.snapshot({
94
93
} ) ;
95
94
96
95
const enableBabelPlugins = plugins => ( {
97
- babelOptions : {
98
- parserOpts : {
99
- plugins,
96
+ parserOptions : {
97
+ babelOptions : {
98
+ parserOpts : {
99
+ plugins,
100
+ } ,
100
101
} ,
101
102
} ,
102
103
} ) ;
@@ -110,19 +111,19 @@ test.babel({
110
111
};
111
112
` ,
112
113
output : 'const foo = do {};' ,
113
- parserOptions : enableBabelPlugin ( 'doExpressions' ) ,
114
+ languageOptions : enableBabelPlugin ( 'doExpressions' ) ,
114
115
errors : 1 ,
115
116
} ,
116
117
{
117
118
code : 'const record = #{ };' ,
118
119
output : 'const record = #{};' ,
119
- parserOptions : enableBabelPlugin ( [ 'recordAndTuple' , { syntaxType : 'hash' } ] ) ,
120
+ languageOptions : enableBabelPlugin ( [ 'recordAndTuple' , { syntaxType : 'hash' } ] ) ,
120
121
errors : 1 ,
121
122
} ,
122
123
{
123
124
code : 'const record = {| |};' ,
124
125
output : 'const record = {||};' ,
125
- parserOptions : enableBabelPlugin ( [ 'recordAndTuple' , { syntaxType : 'bar' } ] ) ,
126
+ languageOptions : enableBabelPlugin ( [ 'recordAndTuple' , { syntaxType : 'bar' } ] ) ,
126
127
errors : 1 ,
127
128
} ,
128
129
{
@@ -137,14 +138,14 @@ test.babel({
137
138
static {}
138
139
}
139
140
` ,
140
- parserOptions : enableBabelPlugin ( 'classStaticBlock' ) ,
141
+ languageOptions : enableBabelPlugin ( 'classStaticBlock' ) ,
141
142
errors : 1 ,
142
143
} ,
143
144
// ESLint can't parse this now
144
145
// {
145
146
// code: 'const foo = module { };',
146
147
// output: 'const foo = module {};',
147
- // parserOptions : enableBabelPlugin('moduleBlocks'),
148
+ // languageOptions : enableBabelPlugin('moduleBlocks'),
148
149
// errors: 1
149
150
// },
150
151
{
@@ -153,7 +154,7 @@ test.babel({
153
154
};
154
155
` ,
155
156
output : 'const foo = async do {};' ,
156
- parserOptions : enableBabelPlugins ( [ 'doExpressions' , 'asyncDoExpressions' ] ) ,
157
+ languageOptions : enableBabelPlugins ( [ 'doExpressions' , 'asyncDoExpressions' ] ) ,
157
158
errors : 1 ,
158
159
} ,
159
160
] ,
0 commit comments