Skip to content

Commit 28156ba

Browse files
author
Thomas Grainger
committed
configure ES2017 for no-useless-rest-spread
1 parent 415af48 commit 28156ba

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

tests/lib/rules/no-useless-rest-spread.js

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const rule = require("../../../lib/rules/no-useless-rest-spread")
1717

1818
const ruleTester = new RuleTester({
1919
parserOptions: {
20-
ecmaVersion: 2015,
20+
ecmaVersion: 2017,
2121
ecmaFeatures: { experimentalObjectRestSpread: true },
2222
},
2323
})
@@ -46,18 +46,16 @@ ruleTester.run("no-useless-rest-spread", rule, {
4646
output: "foo(...a, x, y, x)",
4747
errors: ["Unexpected a spread operator."],
4848
},
49-
// Espree threw a syntax error.
50-
// {
51-
// code: "let [a, ...[b, c, ...d]] = obj",
52-
// output: "let [a, b, c, ...d] = obj",
53-
// errors: ["Unexpected a rest operator."],
54-
// },
55-
// Espree threw a syntax error.
56-
// {
57-
// code: "function foo(a, ...[b, c, ...d]) {}",
58-
// output: "function foo(a, b, c, ...d) {}",
59-
// errors: ["Unexpected a rest operator."],
60-
// },
49+
{
50+
code: "let [a, ...[b, c, ...d]] = obj",
51+
output: "let [a, b, c, ...d] = obj",
52+
errors: ["Unexpected a rest operator."],
53+
},
54+
{
55+
code: "function foo(a, ...[b, c, ...d]) {}",
56+
output: "function foo(a, b, c, ...d) {}",
57+
errors: ["Unexpected a rest operator."],
58+
},
6159
{
6260
code: "let obj = {...{x, y, x}, ...b}",
6361
output: "let obj = {x, y, x, ...b}",
@@ -81,18 +79,16 @@ ruleTester.run("no-useless-rest-spread", rule, {
8179
output: "foo(...a, x, y, x)",
8280
errors: ["Unexpected a spread operator."],
8381
},
84-
// Espree threw a syntax error.
85-
// {
86-
// code: "let [a, ...[b, c, ]] = obj",
87-
// output: "let [a, b, c] = obj",
88-
// errors: ["Unexpected a rest operator."],
89-
// },
90-
// Espree threw a syntax error.
91-
// {
92-
// code: "function foo(a, ...[b, c, ]) {}",
93-
// output: "function foo(a, b, c) {}",
94-
// errors: ["Unexpected a rest operator."],
95-
// },
82+
{
83+
code: "let [a, ...[b, c, ]] = obj",
84+
output: "let [a, b, c] = obj",
85+
errors: ["Unexpected a rest operator."],
86+
},
87+
{
88+
code: "function foo(a, ...[b, c, ]) {}",
89+
output: "function foo(a, b, c) {}",
90+
errors: ["Unexpected a rest operator."],
91+
},
9692
{
9793
code: "let obj = {...{x, y, x, }, ...b}",
9894
output: "let obj = {x, y, x, ...b}",
@@ -116,18 +112,16 @@ ruleTester.run("no-useless-rest-spread", rule, {
116112
output: "foo(...a)",
117113
errors: ["Unexpected a spread operator."],
118114
},
119-
// Espree threw a syntax error.
120-
// {
121-
// code: "let [a, ...[]] = obj",
122-
// output: "let [a] = obj",
123-
// errors: ["Unexpected a rest operator."],
124-
// },
125-
// Espree threw a syntax error.
126-
// {
127-
// code: "function foo(a, ...[b, c, ]) {}",
128-
// output: "function foo(a, b, c) {}",
129-
// errors: ["Unexpected a rest operator."],
130-
// },
115+
{
116+
code: "let [a, ...[]] = obj",
117+
output: "let [a] = obj",
118+
errors: ["Unexpected a rest operator."],
119+
},
120+
{
121+
code: "function foo(a, ...[b, c, ]) {}",
122+
output: "function foo(a, b, c) {}",
123+
errors: ["Unexpected a rest operator."],
124+
},
131125
{
132126
code: "let obj = {...{}, ...b}",
133127
output: "let obj = { ...b}",

0 commit comments

Comments
 (0)