From 7a264eeeecb6557ae1507710760071f3525c2b33 Mon Sep 17 00:00:00 2001 From: Stephen Carter Date: Wed, 7 Feb 2024 11:20:37 -0500 Subject: [PATCH] @W-14989109@: Restore plugin linkability by fixing a few imports --- package.json | 2 +- src/lib/DefaultRuleManager.ts | 2 +- src/lib/output/TableOutputFormatter.ts | 6 ++++-- yarn.lock | 7 ++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 66ce561e6..ad4a79ad9 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@salesforce/eslint-config-lwc": "^3.2.1", "@salesforce/eslint-plugin-lightning": "^1.0.0", "@salesforce/sf-plugins-core": "^5.0.4", + "@types/wordwrap": "^1.0.3", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "cross-spawn": "^7.0.3", @@ -40,7 +41,6 @@ "typescript": "~5.1.0", "untildify": "^4.0.0", "uuid": "^9.0.0", - "word-wrap": "^1.2.3", "xml-js": "^1.6.11" }, "resolutions": { diff --git a/src/lib/DefaultRuleManager.ts b/src/lib/DefaultRuleManager.ts index 62e4ec78f..7b46e4bda 100644 --- a/src/lib/DefaultRuleManager.ts +++ b/src/lib/DefaultRuleManager.ts @@ -251,7 +251,7 @@ export class DefaultRuleManager implements RuleManager { const ruleTargets: RuleTarget[] = []; // Ask engines for their desired target patterns. const engineTargets = await engine.getTargetPatterns(); - assert(engineTargets); + assert.ok(engineTargets); // We also need to do a bit of processing on the patterns we were given. const positivePatterns: string[] = []; const negativePatterns: string[] = []; diff --git a/src/lib/output/TableOutputFormatter.ts b/src/lib/output/TableOutputFormatter.ts index b294db70b..a84103380 100644 --- a/src/lib/output/TableOutputFormatter.ts +++ b/src/lib/output/TableOutputFormatter.ts @@ -1,10 +1,12 @@ import {OutputFormatter, Results} from "./Results"; import {FormattedOutput, ResultTableRow, RuleResult} from "../../types"; import * as path from "path"; -import * as wrap from "word-wrap"; +import * as wordwrap from "wordwrap"; import {isPathlessViolation} from "../util/Utils"; import {Ux} from "@salesforce/sf-plugins-core"; +const WORDWRAP_LIMIT = 50; + const BASE_COLUMNS: Ux.Table.Columns = { description: {}, category: {}, @@ -47,7 +49,7 @@ export class TableOutputFormatter implements OutputFormatter { const relativeFile = path.relative(process.cwd(), fileName); // Instantiate our Row object. const baseRow: ResultTableRow = { - description: wrap(message), + description: wordwrap.hard(WORDWRAP_LIMIT)(message), category: violation.category, url: violation.url }; diff --git a/yarn.lock b/yarn.lock index 3c9dfa8a6..08e2405d9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1311,6 +1311,11 @@ "@types/expect" "^1.20.4" "@types/node" "*" +"@types/wordwrap@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@types/wordwrap/-/wordwrap-1.0.3.tgz#1faf6e6002e8d63534bd9ad329a32bc772d4983e" + integrity sha512-jx39cOYWJxZxVOZeNHvLVoDLRUFcYtIJaurC6C0qzCovIB3GPDbMDbYvoWi9D1B2PtIE16rElQOFR4Y+8QbUgw== + "@typescript-eslint/eslint-plugin@^5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz#aeef0328d172b9e37d9bab6dbc13b87ed88977db" @@ -7492,7 +7497,7 @@ winreg@~1.2.2: resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.5.tgz#b650383e89278952494b5d113ba049a5a4fa96d8" integrity sha512-uf7tHf+tw0B1y+x+mKTLHkykBgK2KMs3g+KlzmyMbLvICSHQyB/xOFjTT8qZ3oeTFyU7Bbj4FzXitGG6jvKhYw== -word-wrap@^1.2.3, word-wrap@~1.2.3: +word-wrap@~1.2.3: version "1.2.5" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34" integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==