88const RuleTester = require ( "eslint" ) . RuleTester
99const rule = require ( "../../../lib/rules/arrow-parens" )
1010
11- ; ( new RuleTester ( { parserOptions : { ecmaVersion : 2015 } } ) ) . run ( "arrow-parens" , rule , {
11+ ; ( new RuleTester ( { parserOptions : { ecmaVersion : 2015 } } ) ) . run ( "arrow-parens" , rule , {
1212 valid : [
1313 "var foo = (x) => x;" ,
1414 "var foo = (x => x);" ,
@@ -21,71 +21,71 @@ const rule = require("../../../lib/rules/arrow-parens")
2121 "foo(x => x, (x) => x);" ,
2222 "foo(\n (x) => x,\n (x) => x\n);" ,
2323
24- { code : "var foo = async (x) => x;" , parserOptions : { ecmaVersion : 2017 } } ,
25- { code : "var foo = async (x => x);" , parserOptions : { ecmaVersion : 2017 } } ,
26- { code : "foo(async () => 0);" , parserOptions : { ecmaVersion : 2017 } } ,
27- { code : "foo(async (x, y) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
28- { code : "foo(async (x = 0) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
29- { code : "foo(async ([x]) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
30- { code : "foo(async ({x}) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
31- { code : "foo(x => x, async (x) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
32- { code : "foo(\n async (x) => x,\n async (x) => x\n);" , parserOptions : { ecmaVersion : 2017 } } ,
24+ { code : "var foo = async (x) => x;" , parserOptions : { ecmaVersion : 2017 } } ,
25+ { code : "var foo = async (x => x);" , parserOptions : { ecmaVersion : 2017 } } ,
26+ { code : "foo(async () => 0);" , parserOptions : { ecmaVersion : 2017 } } ,
27+ { code : "foo(async (x, y) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
28+ { code : "foo(async (x = 0) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
29+ { code : "foo(async ([x]) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
30+ { code : "foo(async ({x}) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
31+ { code : "foo(x => x, async (x) => x);" , parserOptions : { ecmaVersion : 2017 } } ,
32+ { code : "foo(\n async (x) => x,\n async (x) => x\n);" , parserOptions : { ecmaVersion : 2017 } } ,
3333 ] ,
3434 invalid : [
3535 {
3636 code : "var foo = x => x;" ,
3737 output : "var foo = (x) => x;" ,
3838 errors : [
39- { column : 11 , message : "Expected to enclose this argument with parentheses." } ,
39+ { column : 11 , message : "Expected to enclose this argument with parentheses." } ,
4040 ] ,
4141 } ,
4242 {
4343 code : "foo(x => x, x => x);" ,
4444 output : "foo(x => x, (x) => x);" ,
4545 errors : [
46- { column : 13 , message : "Expected to enclose this argument with parentheses." } ,
46+ { column : 13 , message : "Expected to enclose this argument with parentheses." } ,
4747 ] ,
4848 } ,
4949 {
5050 code : "foo(\n x => x,\n x => x\n);" ,
5151 output : "foo(\n (x) => x,\n (x) => x\n);" ,
5252 errors : [
53- { line : 2 , message : "Expected to enclose this argument with parentheses." } ,
54- { line : 3 , message : "Expected to enclose this argument with parentheses." } ,
53+ { line : 2 , message : "Expected to enclose this argument with parentheses." } ,
54+ { line : 3 , message : "Expected to enclose this argument with parentheses." } ,
5555 ] ,
5656 } ,
5757 {
5858 code : "foo((x) => x);" ,
5959 output : "foo(x => x);" ,
6060 errors : [
61- { message : "Unexpected parentheses enclosing this argument." } ,
61+ { message : "Unexpected parentheses enclosing this argument." } ,
6262 ] ,
6363 } ,
6464
6565 {
6666 code : "var foo = async x => x;" ,
6767 output : "var foo = async (x) => x;" ,
68- parserOptions : { ecmaVersion : 2017 } ,
68+ parserOptions : { ecmaVersion : 2017 } ,
6969 errors : [
70- { column : 11 , message : "Expected to enclose this argument with parentheses." } ,
70+ { column : 11 , message : "Expected to enclose this argument with parentheses." } ,
7171 ] ,
7272 } ,
7373 {
7474 code : "foo(async x => x, async x => x);" ,
7575 output : "foo(async (x) => x, async (x) => x);" ,
76- parserOptions : { ecmaVersion : 2017 } ,
76+ parserOptions : { ecmaVersion : 2017 } ,
7777 errors : [
78- { column : 5 , message : "Expected to enclose this argument with parentheses." } ,
79- { column : 19 , message : "Expected to enclose this argument with parentheses." } ,
78+ { column : 5 , message : "Expected to enclose this argument with parentheses." } ,
79+ { column : 19 , message : "Expected to enclose this argument with parentheses." } ,
8080 ] ,
8181 } ,
8282 {
8383 code : "foo(\n async x => x,\n async x => x\n);" ,
8484 output : "foo(\n async (x) => x,\n async (x) => x\n);" ,
85- parserOptions : { ecmaVersion : 2017 } ,
85+ parserOptions : { ecmaVersion : 2017 } ,
8686 errors : [
87- { line : 2 , message : "Expected to enclose this argument with parentheses." } ,
88- { line : 3 , message : "Expected to enclose this argument with parentheses." } ,
87+ { line : 2 , message : "Expected to enclose this argument with parentheses." } ,
88+ { line : 3 , message : "Expected to enclose this argument with parentheses." } ,
8989 ] ,
9090 } ,
9191 ] ,
0 commit comments