Skip to content

Commit 96a66f9

Browse files
committed
refactor: prefer templates over array join
1 parent 7255074 commit 96a66f9

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

__tests__/no-new-statics.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ ruleTester.run('no-new-statics', rule, {
5353
errors: [{ message: "Avoid calling 'new' on 'Promise.withResolvers()'" }],
5454
},
5555
{
56-
code: [
57-
'function foo() {',
58-
' var a = getA()',
59-
' return new Promise.resolve(a)',
60-
'}',
61-
].join('\n'),
62-
output: [
63-
'function foo() {',
64-
' var a = getA()',
65-
' return Promise.resolve(a)',
66-
'}',
67-
].join('\n'),
56+
code: `
57+
function foo() {
58+
var a = getA()
59+
return new Promise.resolve(a)
60+
}
61+
`,
62+
output: `
63+
function foo() {
64+
var a = getA()
65+
return Promise.resolve(a)
66+
}
67+
`,
6868
errors: [{ message: "Avoid calling 'new' on 'Promise.resolve()'" }],
6969
},
7070
],

__tests__/valid-params.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ ruleTester.run('valid-params', rule, {
7878
},
7979

8080
// integration test
81-
[
82-
'Promise.all([',
83-
' Promise.resolve(1),',
84-
' Promise.resolve(2),',
85-
' Promise.reject(Error()),',
86-
'])',
87-
' .then(console.log)',
88-
' .catch(console.error)',
89-
' .finally(console.log)',
90-
].join('\n'),
81+
`
82+
Promise.all([
83+
Promise.resolve(1),
84+
Promise.resolve(2),
85+
Promise.reject(Error()),
86+
])
87+
.then(console.log)
88+
.catch(console.error)
89+
.finally(console.log)
90+
`,
9191
],
9292
invalid: [
9393
// invalid Promise.resolve()

0 commit comments

Comments
 (0)