|
|
@@ -46,6 +46,8 @@ ruleTester.run("function-call-argument-newline", rule, { |
|
|
options: ["always"], |
|
|
parserOptions: { ecmaVersion: 6 } |
|
|
}, |
|
|
{ code: "fn({\n\ta: 1\n},\n\tb,\n\tc)", options: ["always"] }, |
|
|
{ code: "fn(`\n`,\n\ta)", options: ["always"], parserOptions: { ecmaVersion: 6 } }, |
|
|
|
|
|
/* "never" */ |
|
|
{ code: "fn(a, b)", options: ["never"] }, |
|
|
@@ -59,10 +61,16 @@ ruleTester.run("function-call-argument-newline", rule, { |
|
|
options: ["never"], |
|
|
parserOptions: { ecmaVersion: 6 } |
|
|
}, |
|
|
{ code: "fn({\n\ta: 1\n}, b)", options: ["never"] }, |
|
|
{ code: "fn(`\n`, a)", options: ["never"], parserOptions: { ecmaVersion: 6 } }, |
|
|
|
|
|
/* "consistent" */ |
|
|
{ code: "fn(a, b, c)", options: ["consistent"] }, |
|
|
{ code: "fn(a,\n\tb,\n\tc)", options: ["consistent"] } |
|
|
{ code: "fn(a,\n\tb,\n\tc)", options: ["consistent"] }, |
|
|
{ code: "fn({\n\ta: 1\n}, b, c)", options: ["consistent"] }, |
|
|
{ code: "fn({\n\ta: 1\n},\n\tb,\n\tc)", options: ["consistent"] }, |
|
|
{ code: "fn(`\n`, b, c)", options: ["consistent"], parserOptions: { ecmaVersion: 6 } }, |
|
|
{ code: "fn(`\n`,\n\tb,\n\tc)", options: ["consistent"], parserOptions: { ecmaVersion: 6 } } |
|
|
], |
|
|
invalid: [ |
|
|
|
|
|
@@ -202,6 +210,35 @@ ruleTester.run("function-call-argument-newline", rule, { |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn({\n\ta: 1\n}, b)", |
|
|
output: "fn({\n\ta: 1\n},\nb)", |
|
|
options: ["always"], |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "missingLineBreak", |
|
|
line: 3, |
|
|
column: 3, |
|
|
endLine: 3, |
|
|
endColumn: 4 |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn(`\n`, b)", |
|
|
output: "fn(`\n`,\nb)", |
|
|
options: ["always"], |
|
|
parserOptions: { ecmaVersion: 6 }, |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "missingLineBreak", |
|
|
line: 2, |
|
|
column: 3, |
|
|
endLine: 2, |
|
|
endColumn: 4 |
|
|
} |
|
|
] |
|
|
}, |
|
|
|
|
|
/* "never" */ |
|
|
{ |
|
|
@@ -324,6 +361,35 @@ ruleTester.run("function-call-argument-newline", rule, { |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn({\n\ta: 1\n},\nb)", |
|
|
output: "fn({\n\ta: 1\n}, b)", |
|
|
options: ["never"], |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "unexpectedLineBreak", |
|
|
line: 3, |
|
|
column: 3, |
|
|
endLine: 4, |
|
|
endColumn: 1 |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn(`\n`,\nb)", |
|
|
output: "fn(`\n`, b)", |
|
|
options: ["never"], |
|
|
parserOptions: { ecmaVersion: 6 }, |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "unexpectedLineBreak", |
|
|
line: 2, |
|
|
column: 3, |
|
|
endLine: 3, |
|
|
endColumn: 1 |
|
|
} |
|
|
] |
|
|
}, |
|
|
|
|
|
/* "consistent" */ |
|
|
{ |
|
|
@@ -381,6 +447,64 @@ ruleTester.run("function-call-argument-newline", rule, { |
|
|
endColumn: 19 |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn({\n\ta: 1\n},\nb, c)", |
|
|
output: "fn({\n\ta: 1\n},\nb,\nc)", |
|
|
options: ["consistent"], |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "missingLineBreak", |
|
|
line: 4, |
|
|
column: 3, |
|
|
endLine: 4, |
|
|
endColumn: 4 |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn({\n\ta: 1\n}, b,\nc)", |
|
|
output: "fn({\n\ta: 1\n}, b, c)", |
|
|
options: ["consistent"], |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "unexpectedLineBreak", |
|
|
line: 3, |
|
|
column: 6, |
|
|
endLine: 4, |
|
|
endColumn: 1 |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn(`\n`,\nb, c)", |
|
|
output: "fn(`\n`,\nb,\nc)", |
|
|
options: ["consistent"], |
|
|
parserOptions: { ecmaVersion: 6 }, |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "missingLineBreak", |
|
|
line: 3, |
|
|
column: 3, |
|
|
endLine: 3, |
|
|
endColumn: 4 |
|
|
} |
|
|
] |
|
|
}, |
|
|
{ |
|
|
code: "fn(`\n`, b,\nc)", |
|
|
output: "fn(`\n`, b, c)", |
|
|
options: ["consistent"], |
|
|
parserOptions: { ecmaVersion: 6 }, |
|
|
errors: [ |
|
|
{ |
|
|
messageId: "unexpectedLineBreak", |
|
|
line: 2, |
|
|
column: 6, |
|
|
endLine: 3, |
|
|
endColumn: 1 |
|
|
} |
|
|
] |
|
|
} |
|
|
] |
|
|
}); |