mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
parent
b29a0e004c
commit
3532e3110a
36 changed files with 11751 additions and 175 deletions
|
@ -8,16 +8,19 @@ import jsYaml from "js-yaml";
|
|||
import { lint, readConfig } from "markdownlint/promise";
|
||||
import { markdownlintParallel } from "./markdownlint-test-parallel.mjs";
|
||||
|
||||
/** @typedef {import("markdownlint").Configuration} Configuration */
|
||||
|
||||
/**
|
||||
* Lints a test repository.
|
||||
*
|
||||
* @param {Object} t Test instance.
|
||||
* @param {string[]} globPatterns Array of files to in/exclude.
|
||||
* @param {string} configPath Path to config file.
|
||||
* @param {Configuration} [configOverrides] Configuration overrides.
|
||||
* @param {boolean} [parallel] True to lint in parallel.
|
||||
* @returns {Promise} Test result.
|
||||
*/
|
||||
export function lintTestRepo(t, globPatterns, configPath, parallel) {
|
||||
export function lintTestRepo(t, globPatterns, configPath, configOverrides, parallel) {
|
||||
t.plan(1);
|
||||
const jsoncParse = (json) => {
|
||||
const config = jsoncParser.parse(json, [], { "allowTrailingComma": true });
|
||||
|
@ -31,13 +34,17 @@ export function lintTestRepo(t, globPatterns, configPath, parallel) {
|
|||
const [ files, rawConfig ] = globbyAndReadConfigResults;
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`${t.title}: Linting ${files.length} files...`);
|
||||
const config = Object.fromEntries(
|
||||
const cookedConfig = Object.fromEntries(
|
||||
Object.entries(rawConfig)
|
||||
.map(([ k, v ]) => [
|
||||
k.replace(/header/, "heading"),
|
||||
v
|
||||
])
|
||||
);
|
||||
const config = {
|
||||
...cookedConfig,
|
||||
...configOverrides
|
||||
};
|
||||
return (parallel ? markdownlintParallel : lint)({
|
||||
files,
|
||||
config
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue