From 1b51b19eadb25c8afbb95089c2fe1ef8d2bb69c4 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 9 Aug 2021 10:32:17 +0200 Subject: [PATCH] Refactor code-style --- lib/index.js | 3 ++- lib/options.js | 7 ++----- package.json | 2 +- test/fixtures/example/cli.js | 2 +- test/fixtures/plugins/cli.js | 2 +- test/fixtures/settings/cli.js | 2 +- test/fixtures/uncaught-errors/cli.js | 2 +- test/index.js | 5 +++-- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/lib/index.js b/lib/index.js index 84d7315..a2e4fbc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,7 +5,8 @@ * @typedef {import('./options.js').Options} Options */ -import stream from 'stream' +import process from 'node:process' +import stream from 'node:stream' import chalk from 'chalk' import chokidar from 'chokidar' import {engine} from 'unified-engine' diff --git a/lib/options.js b/lib/options.js index bee2f0d..b745b71 100644 --- a/lib/options.js +++ b/lib/options.js @@ -193,9 +193,7 @@ function reporter(value) { /** * @returns {[string, Record|undefined]} */ - (value) => { - return [value[0], value[1] ? parseConfig(value[1], {}) : undefined] - } + (value) => [value[0], value[1] ? parseConfig(value[1], {}) : undefined] ) return all[all.length - 1] || [] @@ -351,8 +349,7 @@ function normalize(value) { */ function flatten(values) { // @ts-expect-error: TS is wrong. - // eslint-disable-next-line prefer-spread - return [].concat.apply([], values) + return values.flat() } /** diff --git a/package.json b/package.json index 33825cb..29e19cb 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "typescript": "^4.0.0", "unified": "^10.0.0", "vfile-reporter-json": "^3.0.0", - "xo": "^0.39.0" + "xo": "^0.44.0" }, "scripts": { "build": "rimraf \"lib/**/*.d.ts\" \"test/**/*.d.ts\" && tsc && type-coverage", diff --git a/test/fixtures/example/cli.js b/test/fixtures/example/cli.js index c74af3e..78cedb6 100755 --- a/test/fixtures/example/cli.js +++ b/test/fixtures/example/cli.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -import path from 'path' +import path from 'node:path' import {args} from '../../../index.js' import {processor} from '../processor.js' import {config} from '../config.js' diff --git a/test/fixtures/plugins/cli.js b/test/fixtures/plugins/cli.js index 26f24d8..f9bad43 100755 --- a/test/fixtures/plugins/cli.js +++ b/test/fixtures/plugins/cli.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -import path from 'path' +import path from 'node:path' import {args} from '../../../index.js' import {processor} from '../processor.js' import {config} from '../config.js' diff --git a/test/fixtures/settings/cli.js b/test/fixtures/settings/cli.js index 53253b3..302f541 100755 --- a/test/fixtures/settings/cli.js +++ b/test/fixtures/settings/cli.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -import path from 'path' +import path from 'node:path' import {args} from '../../../index.js' import {processor} from '../processor.js' import {config} from '../config.js' diff --git a/test/fixtures/uncaught-errors/cli.js b/test/fixtures/uncaught-errors/cli.js index 6d65edd..4c17c4c 100755 --- a/test/fixtures/uncaught-errors/cli.js +++ b/test/fixtures/uncaught-errors/cli.js @@ -1,5 +1,5 @@ #!/usr/bin/env node -import path from 'path' +import path from 'node:path' import {args} from '../../../index.js' import {processor} from '../processor.js' import {config} from '../config.js' diff --git a/test/index.js b/test/index.js index f56ac62..8d640d9 100644 --- a/test/index.js +++ b/test/index.js @@ -1,5 +1,6 @@ -import fs from 'fs' -import path from 'path' +import fs from 'node:fs' +import path from 'node:path' +import process from 'node:process' import execa from 'execa' import {bail} from 'bail' import test from 'tape'