fix(validation): support validating json5 pull requests

Closes #3931
This commit is contained in:
Rhys Arkins 2019-06-13 13:25:45 +02:00
parent 68a9a26ed9
commit 81eb175001

View file

@ -1,3 +1,4 @@
const JSON5 = require('json5');
const { migrateAndValidate } = require('../../../config/migrate-validate'); const { migrateAndValidate } = require('../../../config/migrate-validate');
const { configFileNames } = require('../../../config/app-strings'); const { configFileNames } = require('../../../config/app-strings');
const { appName, appSlug } = require('../../../config/app-strings'); const { appName, appSlug } = require('../../../config/app-strings');
@ -40,7 +41,12 @@ async function validatePrs(config) {
} }
let parsed; let parsed;
try { try {
parsed = JSON.parse(content); // istanbul ignore if
if (file.endsWith('.json5')) {
parsed = JSON5.parse(content);
} else {
parsed = JSON.parse(content);
}
} catch (err) { } catch (err) {
validations.push({ validations.push({
file, file,