From 43436adca1deef5da8108aa7a4be9eca7505c63f Mon Sep 17 00:00:00 2001 From: Joel Chen Date: Thu, 23 Apr 2020 10:08:31 -0700 Subject: [PATCH] fix: CI failing due to linting errors --- .../xarc-app-dev/lib/dev-admin/admin-server.js | 2 +- .../xarc-app-dev/lib/dev-admin/console-io.js | 1 - .../xarc-app-dev/lib/dev-admin/dev-hapi.js | 2 ++ .../xarc-app-dev/lib/dev-admin/log-parser.js | 8 +++++--- packages/xarc-app-dev/package.json | 18 +++++++++++++++--- .../test/spec/dev-admin/log-parser.spec.js | 2 +- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/xarc-app-dev/lib/dev-admin/admin-server.js b/packages/xarc-app-dev/lib/dev-admin/admin-server.js index 3100e55f1..778cd3d2d 100644 --- a/packages/xarc-app-dev/lib/dev-admin/admin-server.js +++ b/packages/xarc-app-dev/lib/dev-admin/admin-server.js @@ -503,7 +503,7 @@ ${instruction}` store.push(false); } - let str = data.toString(); + const str = data.toString(); if (!str.trim()) { store.push(""); logger.info(""); diff --git a/packages/xarc-app-dev/lib/dev-admin/console-io.js b/packages/xarc-app-dev/lib/dev-admin/console-io.js index 84a502a0f..223c21145 100644 --- a/packages/xarc-app-dev/lib/dev-admin/console-io.js +++ b/packages/xarc-app-dev/lib/dev-admin/console-io.js @@ -3,7 +3,6 @@ /* eslint-disable no-console, no-process-exit */ const readline = require("readline"); -const logUpdate = require("log-update"); const VisualLogger = require("visual-logger"); class ConsoleIO extends VisualLogger { diff --git a/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js b/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js index 5cb684467..dd9562a87 100644 --- a/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js +++ b/packages/xarc-app-dev/lib/dev-admin/dev-hapi.js @@ -97,6 +97,8 @@ function register(server, options, next) { console.error("webpack dev middleware error", err); reply(err); }); + + return undefined; } }); diff --git a/packages/xarc-app-dev/lib/dev-admin/log-parser.js b/packages/xarc-app-dev/lib/dev-admin/log-parser.js index da8c0ebef..26c93df0b 100644 --- a/packages/xarc-app-dev/lib/dev-admin/log-parser.js +++ b/packages/xarc-app-dev/lib/dev-admin/log-parser.js @@ -1,8 +1,8 @@ "use strict"; -const ck = require("chalker"); -const { Levels } = require("./log-reader"); +/* eslint-disable max-statements, complexity */ +const ck = require("chalker"); const FyiTag = ck`[fyi] `; const BunyanTag = ck`[app] `; @@ -33,7 +33,9 @@ function parse(str) { if (str[0] === "{" || str[0] === "[") { jsonData = JSON.parse(str); } - } catch {} + } catch { + // + } let message; let level; diff --git a/packages/xarc-app-dev/package.json b/packages/xarc-app-dev/package.json index 75cab80cf..5e02fd84d 100644 --- a/packages/xarc-app-dev/package.json +++ b/packages/xarc-app-dev/package.json @@ -90,16 +90,28 @@ "xsh": "^0.4.4" }, "devDependencies": { + "@types/chai": "^4.2.11", + "@types/mocha": "^7.0.2", + "@types/sinon": "^9.0.0", + "@types/sinon-chai": "^3.2.4", "@xarc/app": "../xarc-app", - "@xarc/module-dev": "^2.0.3", + "@xarc/module-dev": "^2.1.0", "babel-eslint": "^10.1.0", - "chai": "^4.0.0", + "chai": "^4.2.0", "electrode-archetype-opt-postcss": "../electrode-archetype-opt-postcss", "electrode-archetype-opt-sass": "../electrode-archetype-opt-sass", "electrode-archetype-opt-stylus": "../electrode-archetype-opt-stylus", + "eslint": "^6.8.0", + "eslint-config-walmart": "^2.2.1", + "eslint-plugin-filenames": "^1.1.0", + "eslint-plugin-jsdoc": "^21.0.0", + "mocha": "^7.1.0", "mock-require": "^3.0.3", + "nyc": "^15.0.0", "prettier": "^1.14.2", - "run-verify": "^1.2.1" + "run-verify": "^1.2.1", + "sinon": "^7.2.6", + "sinon-chai": "^3.3.0" }, "engines": { "node": ">= 10", diff --git a/packages/xarc-app-dev/test/spec/dev-admin/log-parser.spec.js b/packages/xarc-app-dev/test/spec/dev-admin/log-parser.spec.js index b8cd9de80..13c517216 100644 --- a/packages/xarc-app-dev/test/spec/dev-admin/log-parser.spec.js +++ b/packages/xarc-app-dev/test/spec/dev-admin/log-parser.spec.js @@ -1,7 +1,7 @@ "use strict"; const expect = require("chai").expect; -const { BunyanTag, FyiTag, parse } = require("../../../lib/dev-admin/log-parser"); +const { parse } = require("../../../lib/dev-admin/log-parser"); describe("log-parser", function() { it("should return correct level and message for a simple error", () => {