mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 14:00:13 +01:00
Deprecate LintResults.toString() (at edit time; continue to support at run time), provide helper function formatLintResults, remove outdated grunt/gulp samples, improve typing.
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled
This commit is contained in:
parent
2a06f0a871
commit
616c3f2c22
18 changed files with 161 additions and 207 deletions
|
|
@ -1,28 +0,0 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = function wrapper(grunt) {
|
||||
grunt.initConfig({
|
||||
"markdownlint": {
|
||||
"example": {
|
||||
"src": [ "*.md" ]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerMultiTask("markdownlint", function task() {
|
||||
const done = this.async();
|
||||
import("markdownlint/async").then(({ lint }) => {
|
||||
lint(
|
||||
{ "files": this.filesSrc },
|
||||
function callback(err, result) {
|
||||
const resultString = err || ((result || "").toString());
|
||||
if (resultString) {
|
||||
grunt.fail.warn("\n" + resultString + "\n");
|
||||
}
|
||||
done(!err || !resultString);
|
||||
});
|
||||
}).catch(done);
|
||||
});
|
||||
};
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// @ts-check
|
||||
|
||||
"use strict";
|
||||
|
||||
const gulp = require("gulp");
|
||||
const through2 = require("through2");
|
||||
|
||||
// Simple task wrapper
|
||||
gulp.task("markdownlint", function task() {
|
||||
return gulp.src("*.md", { "read": false })
|
||||
.pipe(through2.obj(function obj(file, enc, next) {
|
||||
import("markdownlint/async").then(({ lint }) => {
|
||||
lint(
|
||||
{ "files": [ file.relative ] },
|
||||
function callback(err, result) {
|
||||
const resultString = (result || "").toString();
|
||||
if (resultString) {
|
||||
console.log(resultString);
|
||||
}
|
||||
next(err, file);
|
||||
});
|
||||
}).catch(next);
|
||||
}));
|
||||
});
|
||||
|
|
@ -18,18 +18,18 @@ const options = {
|
|||
|
||||
if (true) {
|
||||
|
||||
// Makes a synchronous call, uses result.toString for pretty formatting
|
||||
// Makes a synchronous call
|
||||
const results = lintSync(options);
|
||||
console.log(results.toString());
|
||||
console.dir(results, { "colors": true, "depth": null });
|
||||
|
||||
}
|
||||
|
||||
if (true) {
|
||||
|
||||
// Makes an asynchronous call, uses result.toString for pretty formatting
|
||||
// Makes an asynchronous call
|
||||
lintAsync(options, function callback(error, results) {
|
||||
if (!error && results) {
|
||||
console.log(results.toString());
|
||||
console.dir(results, { "colors": true, "depth": null });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ if (true) {
|
|||
|
||||
if (true) {
|
||||
|
||||
// Makes a Promise-based asynchronous call, displays the result object directly
|
||||
// Makes a Promise-based asynchronous call
|
||||
const results = await lintPromise(options);
|
||||
console.dir(results, { "colors": true, "depth": null });
|
||||
|
||||
|
|
|
|||
|
|
@ -171,13 +171,15 @@ lintAsync(options, assertLintResultsCallback);
|
|||
assertLintResultsCallback(null, await lintPromise(options));
|
||||
})();
|
||||
|
||||
const needsFixing = "# Heading\n";
|
||||
|
||||
assert.equal(
|
||||
applyFix(
|
||||
"# Fixing\n",
|
||||
needsFixing,
|
||||
{
|
||||
"insertText": "Head",
|
||||
"editColumn": 3,
|
||||
"deleteCount": 3
|
||||
"insertText": " ",
|
||||
"editColumn": 2,
|
||||
"deleteCount": 2
|
||||
},
|
||||
"\n"
|
||||
),
|
||||
|
|
@ -186,17 +188,12 @@ assert.equal(
|
|||
|
||||
assert.equal(
|
||||
applyFixes(
|
||||
"# Fixing\n",
|
||||
[
|
||||
{
|
||||
"lineNumber": 1,
|
||||
"fixInfo": {
|
||||
"insertText": "Head",
|
||||
"editColumn": 3,
|
||||
"deleteCount": 3
|
||||
}
|
||||
needsFixing,
|
||||
lintSync({
|
||||
"strings": {
|
||||
needsFixing
|
||||
}
|
||||
]
|
||||
})["needsFixing"]
|
||||
),
|
||||
"# Heading\n"
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue