Skip to content

Commit 9bb7fab

Browse files
CopilotApollon77
andauthored
Exclude admin/tsconfig.json from strict JSON validation and add base directory JSON validation (#700)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: Apollon77 <[email protected]> Co-authored-by: Ingo Fischer <[email protected]>
1 parent 4671c7d commit 9bb7fab

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
PLACEHOLDER for the next version:
55
## **WORK IN PROGRESS**
66
-->
7+
## **WORK IN PROGRESS**
8+
* (@Apollon77/@copilot) Exclude admin/tsconfig.json from strict JSON validation as it may contain JSON5 syntax
9+
* (@Apollon77/@copilot) Add JSON validation for package.json and io-package.json in base directory
10+
711
## 5.2.1 (2025-11-08)
812
* (@Apollon77/@copilot) Add validation for JSON files in admin/ and admin/i18n/ directories
913
* (@Apollon77/@copilot) Logs npm and installation errors to console for easier debugging

build/tests/packageFiles/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,26 @@ function validatePackageFiles(adapterDir) {
291291
});
292292
});
293293
describe(`Validate JSON files`, () => {
294+
// Validate base directory JSON files
295+
describe(`Base directory JSON files`, () => {
296+
for (const filename of ['package.json', 'io-package.json']) {
297+
const filePath = path.join(adapterDir, filename);
298+
if (fs.existsSync(filePath)) {
299+
it(`${filename} contains valid JSON`, () => {
300+
(0, chai_1.expect)(() => {
301+
JSON.parse(fs.readFileSync(filePath, 'utf8'));
302+
}, `${filename} contains invalid JSON!`).not.to.throw();
303+
});
304+
}
305+
}
306+
});
294307
// Find all JSON and JSON5 files in admin/ directory (recursively)
295308
const adminDir = path.join(adapterDir, 'admin');
296309
const allAdminJsonFiles = findFiles(adminDir, /\.json$/);
297310
const allAdminJson5Files = findFiles(adminDir, /\.json5$/);
298311
// Split JSON files into admin/*.json and admin/i18n/**/*.json
299-
const adminDirectJsonFiles = allAdminJsonFiles.filter(file => !file.includes(`${path.sep}i18n${path.sep}`));
312+
// Exclude tsconfig.json as it may contain JSON5 syntax (comments, trailing commas)
313+
const adminDirectJsonFiles = allAdminJsonFiles.filter(file => !file.includes(`${path.sep}i18n${path.sep}`) && !file.endsWith(`${path.sep}tsconfig.json`));
300314
const i18nJsonFiles = allAdminJsonFiles.filter(file => file.includes(`${path.sep}i18n${path.sep}`));
301315
if (adminDirectJsonFiles.length > 0) {
302316
describe(`admin/*.json files`, () => {

src/tests/packageFiles/index.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,30 @@ export function validatePackageFiles(adapterDir: string): void {
302302
});
303303

304304
describe(`Validate JSON files`, () => {
305+
// Validate base directory JSON files
306+
describe(`Base directory JSON files`, () => {
307+
for (const filename of ['package.json', 'io-package.json']) {
308+
const filePath = path.join(adapterDir, filename);
309+
if (fs.existsSync(filePath)) {
310+
it(`${filename} contains valid JSON`, () => {
311+
expect(() => {
312+
JSON.parse(fs.readFileSync(filePath, 'utf8'));
313+
}, `${filename} contains invalid JSON!`).not.to.throw();
314+
});
315+
}
316+
}
317+
});
318+
305319
// Find all JSON and JSON5 files in admin/ directory (recursively)
306320
const adminDir = path.join(adapterDir, 'admin');
307321
const allAdminJsonFiles = findFiles(adminDir, /\.json$/);
308322
const allAdminJson5Files = findFiles(adminDir, /\.json5$/);
309323

310324
// Split JSON files into admin/*.json and admin/i18n/**/*.json
311-
const adminDirectJsonFiles = allAdminJsonFiles.filter(file => !file.includes(`${path.sep}i18n${path.sep}`));
325+
// Exclude tsconfig.json as it may contain JSON5 syntax (comments, trailing commas)
326+
const adminDirectJsonFiles = allAdminJsonFiles.filter(
327+
file => !file.includes(`${path.sep}i18n${path.sep}`) && !file.endsWith(`${path.sep}tsconfig.json`),
328+
);
312329
const i18nJsonFiles = allAdminJsonFiles.filter(file => file.includes(`${path.sep}i18n${path.sep}`));
313330

314331
if (adminDirectJsonFiles.length > 0) {

0 commit comments

Comments
 (0)