mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Update dependency: globby to 12.0.2.
This commit is contained in:
parent
05b9e6e43c
commit
11e9a20531
4 changed files with 29 additions and 24 deletions
|
|
@ -56,7 +56,7 @@
|
|||
"eslint-plugin-jsdoc": "~37.4.0",
|
||||
"eslint-plugin-node": "~11.1.0",
|
||||
"eslint-plugin-unicorn": "~39.0.0",
|
||||
"globby": "~11.0.4",
|
||||
"globby": "~12.0.2",
|
||||
"js-yaml": "~4.1.0",
|
||||
"markdown-it-for-inline": "~0.1.1",
|
||||
"markdown-it-sub": "~1.0.0",
|
||||
|
|
|
|||
|
|
@ -2,20 +2,27 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const globby = require("globby");
|
||||
const fs = require("fs").promises;
|
||||
|
||||
const [ command, ...args ] = process.argv.slice(2);
|
||||
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await
|
||||
(async() => {
|
||||
if (command === "copy") {
|
||||
const [ src, dest ] = args;
|
||||
fs.copyFileSync(src, dest);
|
||||
await fs.copyFile(src, dest);
|
||||
} else if (command === "delete") {
|
||||
for (const arg of args) {
|
||||
for (const file of globby.sync(arg)) {
|
||||
fs.unlinkSync(file);
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { globby } = await import("globby");
|
||||
await Promise.all(
|
||||
args.flatMap(
|
||||
(glob) => globby(glob)
|
||||
.then(
|
||||
(files) => files.map((file) => fs.unlink(file))
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
throw new Error(`Unsupported command: ${command}`);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -2,18 +2,15 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const globby = require("globby");
|
||||
const test = require("ava").default;
|
||||
const markdownlint = require("../lib/markdownlint");
|
||||
|
||||
// Parses all Markdown files in all package dependencies
|
||||
test.cb("parseAllFiles", (t) => {
|
||||
test("parseAllFiles", async(t) => {
|
||||
t.plan(1);
|
||||
const options = {
|
||||
"files": globby.sync("**/*.{md,markdown}")
|
||||
};
|
||||
markdownlint(options, (err) => {
|
||||
t.falsy(err);
|
||||
t.end();
|
||||
});
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { globby } = await import("globby");
|
||||
const files = await globby("**/*.{md,markdown}");
|
||||
await markdownlint.promises.markdownlint({ files });
|
||||
t.pass();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ const { existsSync } = require("fs");
|
|||
// eslint-disable-next-line unicorn/import-style
|
||||
const { join } = require("path");
|
||||
const { promisify } = require("util");
|
||||
const globby = require("globby");
|
||||
const jsYaml = require("js-yaml");
|
||||
const test = require("ava").default;
|
||||
const markdownlint = require("../lib/markdownlint");
|
||||
|
|
@ -25,6 +24,8 @@ const readConfigPromise = promisify(markdownlint.readConfig);
|
|||
async function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
|
||||
t.plan(1);
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
||||
const { globby } = await import("globby");
|
||||
// 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue