From 142b2fffbcc3d2a5ae922dfaf2cc44ce00e2b80e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:53:37 +0000 Subject: [PATCH 1/5] Initial plan From 2ac4b0f520a2e509c95232cb8c665929333e5d21 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:55:43 +0000 Subject: [PATCH 2/5] Initial analysis of json-lint removal Co-authored-by: taylortom <1059083+taylortom@users.noreply.github.com> --- package-lock.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package-lock.json b/package-lock.json index 3ed588a..e8bc8fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -192,6 +192,7 @@ "integrity": "sha512-rYKilwgzQ7/imScn3M9/pFfUf4I1AZEH3KhyJmtPdE2zfaXAn2mFfUy4FbKewzc2We5y/LlKLj36fWJLKC2SIQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@octokit/auth-token": "^3.0.0", "@octokit/graphql": "^5.0.0", @@ -629,6 +630,7 @@ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2322,6 +2324,7 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "7.12.11", "@eslint/eslintrc": "^0.4.3", @@ -2477,6 +2480,7 @@ "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.8", @@ -2544,6 +2548,7 @@ "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "eslint-plugin-es": "^3.0.0", "eslint-utils": "^2.0.0", @@ -2585,6 +2590,7 @@ "integrity": "sha512-SftLb1pUG01QYq2A/hGAWfDRXqYD82zE7j7TopDOyNdU+7SvvoXREls/+PRTY17vUXzXnZA/zfnyKgRH6x4JJw==", "dev": true, "license": "ISC", + "peer": true, "engines": { "node": "^10.12.0 || >=12.0.0" }, @@ -4926,6 +4932,7 @@ "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "dev": true, "license": "MIT", + "peer": true, "bin": { "marked": "bin/marked.js" }, @@ -9077,6 +9084,7 @@ "integrity": "sha512-NMPKdfpXTnPn49FDogMBi36SiBfXkSOJqCkk0E4iWOY1tusvvgBwqUmxTX1kmlT6kIYed9YwNKD1sfPpqa5yaA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/error": "^3.0.0", From 24e5be43d1ba4a9623f94c8b9f86699cd83ccc1f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:57:31 +0000 Subject: [PATCH 3/5] Replace json-lint with json-parse-even-better-errors Co-authored-by: taylortom <1059083+taylortom@users.noreply.github.com> --- lib/util/JSONReadValidate.js | 21 ++++++++++++++------- package-lock.json | 30 +++++++++++++++--------------- package.json | 12 ++++++------ 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/lib/util/JSONReadValidate.js b/lib/util/JSONReadValidate.js index 42e4111..be59b73 100644 --- a/lib/util/JSONReadValidate.js +++ b/lib/util/JSONReadValidate.js @@ -1,5 +1,5 @@ import fs from 'fs-extra' -import JSONLint from 'json-lint' +import parseJson from 'json-parse-even-better-errors' /** * @param {string} filepath @@ -24,11 +24,18 @@ export function readValidateJSONSync (filepath) { } function validateJSON (jsonData, filepath) { - const lint = JSONLint(jsonData) - if (!lint.error) return - let errorMessage = 'JSON parsing error: ' + lint.error + ', line: ' + lint.line + ', character: ' + lint.character - if (filepath) { - errorMessage += ', file: \'' + filepath + '\'' + try { + parseJson(jsonData) + } catch (err) { + // Extract line and column from error message + const match = err.message.match(/line (\d+) column (\d+)/) + const line = match ? match[1] : 'unknown' + const character = match ? match[2] : 'unknown' + + let errorMessage = 'JSON parsing error: ' + err.message + ', line: ' + line + ', character: ' + character + if (filepath) { + errorMessage += ', file: \'' + filepath + '\'' + } + throw new Error(errorMessage) } - throw new Error(errorMessage) } diff --git a/package-lock.json b/package-lock.json index e8bc8fb..264ac5e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "fs-extra": "^10.0.0", "globs": "^0.1.4", "inquirer": "^7.3.3", - "json-lint": "^0.1.0", + "json-parse-even-better-errors": "^5.0.0", "lodash-es": "^4.17.21", "node-fetch": "^3.2.10", "parse-github-url": "^1.0.2", @@ -4610,15 +4610,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json-lint": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/json-lint/-/json-lint-0.1.0.tgz", - "integrity": "sha512-QoBMCAo3sFnAl2nvCcrt5NmjqMRejlghhMvZ0ykhgfNpp7ukp1te7dP6q2o4fkvl03t08t75njni+y6S7jiHLg==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "engines": { - "node": ">=0.5" - } - }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -4627,11 +4618,13 @@ "license": "MIT" }, "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, - "license": "MIT" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-5.0.0.tgz", + "integrity": "sha512-ZF1nxZ28VhQouRWhUcVlUIN3qwSgPuswK05s/HIaoetAoE/9tngVmCHjSxmSQPav1nd+lPtTL0YZ/2AFdR/iYQ==", + "license": "MIT", + "engines": { + "node": "^20.17.0 || >=22.9.0" + } }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -8216,6 +8209,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-json/node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, "node_modules/path-exists": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", diff --git a/package.json b/package.json index 46c3beb..206f340 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "fs-extra": "^10.0.0", "globs": "^0.1.4", "inquirer": "^7.3.3", - "json-lint": "^0.1.0", + "json-parse-even-better-errors": "^5.0.0", "lodash-es": "^4.17.21", "node-fetch": "^3.2.10", "parse-github-url": "^1.0.2", @@ -30,17 +30,17 @@ "adapt": "./bin/adapt.js" }, "devDependencies": { - "eslint": "^7.31.0", - "eslint-config-standard": "^16.0.3", - "eslint-plugin-import": "^2.23.4", - "eslint-plugin-node": "^11.1.0", - "eslint-plugin-promise": "^5.1.0", "@semantic-release/commit-analyzer": "^9.0.2", "@semantic-release/git": "^10.0.1", "@semantic-release/github": "^8.0.5", "@semantic-release/npm": "^9.0.1", "@semantic-release/release-notes-generator": "^10.0.3", "conventional-changelog-eslint": "^3.0.9", + "eslint": "^7.31.0", + "eslint-config-standard": "^16.0.3", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^5.1.0", "semantic-release": "^19.0.3" }, "release": { From f66c8bae15901351a75ac801b405169883b3d4d7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:58:53 +0000 Subject: [PATCH 4/5] Improve error message formatting to avoid duplication Co-authored-by: taylortom <1059083+taylortom@users.noreply.github.com> --- lib/util/JSONReadValidate.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/util/JSONReadValidate.js b/lib/util/JSONReadValidate.js index be59b73..3ba9d3f 100644 --- a/lib/util/JSONReadValidate.js +++ b/lib/util/JSONReadValidate.js @@ -27,12 +27,14 @@ function validateJSON (jsonData, filepath) { try { parseJson(jsonData) } catch (err) { - // Extract line and column from error message - const match = err.message.match(/line (\d+) column (\d+)/) - const line = match ? match[1] : 'unknown' - const character = match ? match[2] : 'unknown' + // Extract line, column, and error description from error message + // Format: "Error description at position X (line Y column Z) while parsing..." + const match = err.message.match(/^(.+?) at position \d+ \(line (\d+) column (\d+)\)/) + const errorDescription = match ? match[1] : err.message + const line = match ? match[2] : 'unknown' + const character = match ? match[3] : 'unknown' - let errorMessage = 'JSON parsing error: ' + err.message + ', line: ' + line + ', character: ' + character + let errorMessage = 'JSON parsing error: ' + errorDescription + ', line: ' + line + ', character: ' + character if (filepath) { errorMessage += ', file: \'' + filepath + '\'' } From e965e02890b553ac296c7f19bfb101a2ceda399c Mon Sep 17 00:00:00 2001 From: Thomas Taylor Date: Tue, 17 Feb 2026 15:02:27 +0000 Subject: [PATCH 5/5] Simplify validateJSON to use default error messages from json-parse-even-better-errors The library already produces clear, human-readable messages with position, line/column, and a context snippet showing surrounding text. The regex reformatting was losing the useful "near ..." context and was fragile against future message format changes. Co-Authored-By: Claude Opus 4.6 --- lib/util/JSONReadValidate.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/util/JSONReadValidate.js b/lib/util/JSONReadValidate.js index 3ba9d3f..7d8617f 100644 --- a/lib/util/JSONReadValidate.js +++ b/lib/util/JSONReadValidate.js @@ -27,17 +27,9 @@ function validateJSON (jsonData, filepath) { try { parseJson(jsonData) } catch (err) { - // Extract line, column, and error description from error message - // Format: "Error description at position X (line Y column Z) while parsing..." - const match = err.message.match(/^(.+?) at position \d+ \(line (\d+) column (\d+)\)/) - const errorDescription = match ? match[1] : err.message - const line = match ? match[2] : 'unknown' - const character = match ? match[3] : 'unknown' - - let errorMessage = 'JSON parsing error: ' + errorDescription + ', line: ' + line + ', character: ' + character - if (filepath) { - errorMessage += ', file: \'' + filepath + '\'' - } - throw new Error(errorMessage) + const msg = filepath + ? `${err.message} in file '${filepath}'` + : err.message + throw new Error(msg) } }