Skip to content

Commit 1b51b19

Browse files
committedAug 9, 2021
Refactor code-style
1 parent 3c76949 commit 1b51b19

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed
 

‎lib/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* @typedef {import('./options.js').Options} Options
66
*/
77

8-
import stream from 'stream'
8+
import process from 'node:process'
9+
import stream from 'node:stream'
910
import chalk from 'chalk'
1011
import chokidar from 'chokidar'
1112
import {engine} from 'unified-engine'

‎lib/options.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ function reporter(value) {
193193
/**
194194
* @returns {[string, Record<string, unknown>|undefined]}
195195
*/
196-
(value) => {
197-
return [value[0], value[1] ? parseConfig(value[1], {}) : undefined]
198-
}
196+
(value) => [value[0], value[1] ? parseConfig(value[1], {}) : undefined]
199197
)
200198

201199
return all[all.length - 1] || []
@@ -351,8 +349,7 @@ function normalize(value) {
351349
*/
352350
function flatten(values) {
353351
// @ts-expect-error: TS is wrong.
354-
// eslint-disable-next-line prefer-spread
355-
return [].concat.apply([], values)
352+
return values.flat()
356353
}
357354

358355
/**

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"typescript": "^4.0.0",
5959
"unified": "^10.0.0",
6060
"vfile-reporter-json": "^3.0.0",
61-
"xo": "^0.39.0"
61+
"xo": "^0.44.0"
6262
},
6363
"scripts": {
6464
"build": "rimraf \"lib/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage",

‎test/fixtures/example/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import path from 'path'
2+
import path from 'node:path'
33
import {args} from '../../../index.js'
44
import {processor} from '../processor.js'
55
import {config} from '../config.js'

‎test/fixtures/plugins/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import path from 'path'
2+
import path from 'node:path'
33
import {args} from '../../../index.js'
44
import {processor} from '../processor.js'
55
import {config} from '../config.js'

‎test/fixtures/settings/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import path from 'path'
2+
import path from 'node:path'
33
import {args} from '../../../index.js'
44
import {processor} from '../processor.js'
55
import {config} from '../config.js'

‎test/fixtures/uncaught-errors/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
import path from 'path'
2+
import path from 'node:path'
33
import {args} from '../../../index.js'
44
import {processor} from '../processor.js'
55
import {config} from '../config.js'

‎test/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import fs from 'fs'
2-
import path from 'path'
1+
import fs from 'node:fs'
2+
import path from 'node:path'
3+
import process from 'node:process'
34
import execa from 'execa'
45
import {bail} from 'bail'
56
import test from 'tape'

0 commit comments

Comments
 (0)
Please sign in to comment.