mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Update dependency: strip-json-comments to 4.0.0.
This commit is contained in:
parent
528758e962
commit
05b9e6e43c
4 changed files with 10 additions and 28 deletions
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2019
|
||||
"ecmaVersion": 2020
|
||||
},
|
||||
"plugins": [
|
||||
"jsdoc",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue