From bdcbe31b982cf014ba5fa272fb2ec9d0d2331f5b Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Fri, 26 Feb 2021 08:24:07 +0100 Subject: [PATCH] =?UTF-8?q?style:=20=F0=9F=8E=A8=20fixed=20some=20linting?= =?UTF-8?q?=20issues?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.js | 2 +- src/parser.ts | 3 +-- src/spawn.ts | 4 ++-- src/terminal.ts | 4 ++-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 29333656..b5cd729c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,7 +11,6 @@ module.exports = { "plugin:import/warnings", "plugin:import/typescript", "prettier", - "prettier/@typescript-eslint", "plugin:unicorn/recommended", "plugin:promise/recommended", "plugin:chai-expect/recommended", @@ -44,6 +43,7 @@ module.exports = { yoda: "error", "prefer-spread": "error", "prettier/prettier": "warn", + "unicorn/no-array-for-each": "off", "unicorn/prevent-abbreviations": "off", "unicorn/explicit-length-check": "off", "unicorn/no-array-reduce": "off", diff --git a/src/parser.ts b/src/parser.ts index df90532b..8e930a89 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -129,8 +129,7 @@ export class CommandParser { // Fix incorrect handling of ops for (const op of this.ops) { if (rawPart !== op && rawPart.endsWith(op)) { - args.push(rawPart.slice(0, -op.length)) - args.push(op) + args.push(rawPart.slice(0, -op.length), op) return } } diff --git a/src/spawn.ts b/src/spawn.ts index 9a101151..8f216d30 100644 --- a/src/spawn.ts +++ b/src/spawn.ts @@ -2,7 +2,7 @@ import chalk from "chalk" import { ChildProcess } from "child_process" import { onProcessExit } from "./process" import { spawn } from "cross-spawn" -import npmPath = require("npm-run-path") +import npmPath from "npm-run-path" export class Spawner { static children = new Map() @@ -73,7 +73,7 @@ export class Spawner { reject(this.onError(err)) }) child.on("close", (code) => { - this.exitCode = code + this.exitCode = code || 0 if (this.buffer.length) this.onLine(`${this.buffer}\n`) this.buffer = "" Spawner.children.delete(child.pid) diff --git a/src/terminal.ts b/src/terminal.ts index 846b2189..47b143da 100644 --- a/src/terminal.ts +++ b/src/terminal.ts @@ -7,11 +7,11 @@ import readline from "readline" // eslint-disable-next-line import/default import ansiLength from "string-width" -export function showCursor(stream = process.stderr) { +export function showCursor(stream: NodeJS.WriteStream = process.stderr) { stream.isTTY && stream.write("\u001B[?25h") } -export function hideCursor(stream = process.stderr) { +export function hideCursor(stream: NodeJS.WriteStream = process.stderr) { if (!stream.isTTY) return ;(["SIGTERM", "SIGINT"] as const).forEach((event) => process.once(event, () => showCursor(stream))