From 553711ce662e84e0a4055b0db3f5743e2cb9f869 Mon Sep 17 00:00:00 2001 From: David Sveningsson Date: Fri, 29 Nov 2024 10:12:36 +0100 Subject: [PATCH] fix: remove extra quotes from aliased disallowed dependency --- src/package-json.spec.ts | 2 +- src/package-json.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package-json.spec.ts b/src/package-json.spec.ts index 729be90c..aa0a3d0b 100644 --- a/src/package-json.spec.ts +++ b/src/package-json.spec.ts @@ -75,7 +75,7 @@ it("should return error if aliased dependency is disallowed", async () => { const { content, ast } = generateAst(pkg); const results = await verifyPackageJson(pkg, ast, "package.json"); expect(codeframe(content, results)).toMatchInlineSnapshot(` - "ERROR: ""aliased" ("npm:eslint")" should be a devDependency (disallowed-dependency) at package.json + "ERROR: "aliased" ("npm:eslint") should be a devDependency (disallowed-dependency) at package.json 18 | }, 19 | "dependencies": { > 20 | "aliased": "npm:eslint@1.2.3" diff --git a/src/package-json.ts b/src/package-json.ts index 31d66d67..e3dbe120 100644 --- a/src/package-json.ts +++ b/src/package-json.ts @@ -112,11 +112,11 @@ function verifyDependencies( if (isDisallowedDependency(pkg, dependency)) { const { line, column } = jsonLocation(pkgAst, "member", "dependencies", key); - const name = key === dependency ? dependency : `"${key}" ("npm:${dependency}")`; + const name = key === dependency ? `"${dependency}"` : `"${key}" ("npm:${dependency}")`; messages.push({ ruleId: "disallowed-dependency", severity: 2, - message: `"${name}" should be a devDependency`, + message: `${name} should be a devDependency`, line, column, });