Skip to content

Commit

Permalink
Update dependency: strip-json-comments to 4.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Dec 27, 2021
1 parent 528758e commit 05b9e6e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
],
"parserOptions": {
"ecmaVersion": 2019
"ecmaVersion": 2020
},
"plugins": [
"jsdoc",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"markdownlint-rule-github-internal-links": "~0.1.0",
"markdownlint-rule-helpers": "~0.15.0",
"npm-run-all": "~4.1.5",
"strip-json-comments": "~3.1.1",
"strip-json-comments": "~4.0.0",
"toml": "~3.0.0",
"ts-loader": "~9.2.6",
"tv4": "~1.3.0",
Expand Down
27 changes: 5 additions & 22 deletions test/markdownlint-test-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,11 @@ const { join } = require("path");
const { promisify } = require("util");
const globby = require("globby");
const jsYaml = require("js-yaml");
const stripJsonComments = require("strip-json-comments");
const test = require("ava").default;
const markdownlint = require("../lib/markdownlint");
const markdownlintPromise = promisify(markdownlint);
const readConfigPromise = promisify(markdownlint.readConfig);

/**
* Parses JSONC text.
*
* @param {string} json JSON to parse.
* @returns {Object} Object representation.
*/
function jsoncParse(json) {
return JSON.parse(stripJsonComments(json));
}

/**
* Parses YAML text.
*
* @param {string} yaml YAML to parse.
* @returns {Object} Object representation.
*/
function yamlParse(yaml) {
return jsYaml.load(yaml);
}

/**
* Lints a test repository.
*
Expand All @@ -43,8 +22,12 @@ function yamlParse(yaml) {
* @param {RegExp[]} [ignoreRes] Array of RegExp violations to ignore.
* @returns {Promise} Test result.
*/
function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
async function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
t.plan(1);
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { "default": stripJsonComments } = await import("strip-json-comments");
const jsoncParse = (json) => JSON.parse(stripJsonComments(json));
const yamlParse = (yaml) => jsYaml.load(yaml);
return Promise.all([
globby(globPatterns),
// @ts-ignore
Expand Down
7 changes: 3 additions & 4 deletions test/markdownlint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const pluginInline = require("markdown-it-for-inline");
const pluginSub = require("markdown-it-sub");
const pluginSup = require("markdown-it-sup");
const pluginTexMath = require("markdown-it-texmath");
const stripJsonComments = require("strip-json-comments");
const test = require("ava").default;
const tv4 = require("tv4");
const { homepage, version } = require("../package.json");
Expand Down Expand Up @@ -1070,9 +1069,10 @@ test("validateConfigSchemaAppliesToUnknownProperties", (t) => {
}
});

test("validateConfigExampleJson", (t) => {
test("validateConfigExampleJson", async(t) => {
t.plan(2);

// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { "default": stripJsonComments } = await import("strip-json-comments");
// Validate JSONC
const fileJson = ".markdownlint.jsonc";
const dataJson = fs.readFileSync(
Expand All @@ -1084,7 +1084,6 @@ test("validateConfigExampleJson", (t) => {
// @ts-ignore
tv4.validate(jsonObject, configSchemaStrict),
fileJson + "\n" + JSON.stringify(tv4.error, null, 2));

// Validate YAML
const fileYaml = ".markdownlint.yaml";
const dataYaml = fs.readFileSync(
Expand Down

0 comments on commit 05b9e6e

Please sign in to comment.