-
Notifications
You must be signed in to change notification settings - Fork 0
/
opening-newline.js
40 lines (38 loc) · 1.06 KB
/
opening-newline.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
"use strict";
var rule = require('../').rules['opening-newline']
var RuleTester = require('eslint').RuleTester
var ruleTester = new RuleTester()
ruleTester.run('opening-newline', rule, {
valid: [
'call(\targ)',
'call(arg)',
'call(\n\targ1,\n\targ2)',
'call()',
'call("\\\nasdasd\\\nasdasd\\\n")',
'obj\n\t.method()',
'obj\n\t.method(\na,\nb)',
'obj\n\t.method(\ta)'
],
invalid: [
{
code: 'call(\n\targ,\n\targ2)',
options: [3],
errors: [ { message: 'Newline after opening brace is not allowed for function calls with 3 or less arguments!' } ]
},
{
code: 'call(\n)',
options: [3],
errors: [ { message: 'Newline after opening brace is not allowed for function calls with 3 or less arguments!' } ]
},
{
code: 'obj.call(\n)',
options: [3],
errors: [ { message: 'Newline after opening brace is not allowed for function calls with 3 or less arguments!' } ]
},
{
code: 'obj.call(\na)',
options: [2],
errors: [ { message: 'Newline after opening brace is not allowed for function calls with 2 or less arguments!' } ]
}
]
})