diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 024f8309b2..ec8ff06763 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -18,7 +18,7 @@ jobs: run: make check-file-and-folder-names-in-docs - name: run markdownlint - run: npx gulp lint-md + run: make markdownlint yamllint: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 6f2cf5c809..196b270fbb 100644 --- a/Makefile +++ b/Makefile @@ -101,17 +101,8 @@ markdown-toc: .PHONY: markdownlint markdownlint: - @if ! npm ls markdownlint; then npm install; fi - @npx gulp lint-md - -.PHONY: markdownlint-old -markdownlint-old: - @if ! npm ls markdownlint; then npm install; fi - @for f in $(ALL_DOCS); do \ - echo $$f; \ - npx --no -p markdownlint-cli markdownlint -c .markdownlint.yaml $$f \ - || exit 1; \ - done + @if ! npm ls markdownlint-cli; then npm install; fi + npx --no -- markdownlint-cli -c .markdownlint.yaml $(ALL_DOCS) .PHONY: install-yamllint install-yamllint: diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index b01927ecc0..0000000000 --- a/gulpfile.js +++ /dev/null @@ -1,64 +0,0 @@ -const gulp = require("gulp"); -const through2 = require("through2"); -const markdownlint = require("markdownlint"); -const yaml = require("js-yaml"); -const fs = require("fs"); - -let numFilesProcessed = 0, - numFilesWithIssues = 0; - -function markdownLintFile(file, encoding, callback) { - const config = yaml.load(fs.readFileSync("./.markdownlint.yaml", "utf8")); - const options = { - files: [file.path], - config: config, - }; - - markdownlint(options, function (err, result) { - if (err) { - console.error("ERROR occurred while running markdownlint: ", err); - return callback(err); - } - - const _resultString = (result || "").toString(); - // Result is a string with lines of the form: - // - // :\s*: - // - // Strip out any whitespace between the filepath and line number - // so that tools can jump directly to the line. - const resultString = _resultString - .split("\n") - .map((line) => line.replace(/^([^:]+):\s*(\d+):(.*)/, "$1:$2:$3")) - .join("\n"); - if (resultString) { - console.log(resultString); - numFilesWithIssues++; - // Don't report an error yet so that other files can be checked: - // callback(new Error('...')); - } - numFilesProcessed++; - callback(null, file); - }); -} - -function lintMarkdown() { - const markdownFiles = ["**/*.md", "!**/node_modules/**", "!**/.github/**"]; - - return gulp - .src(markdownFiles) - .pipe(through2.obj(markdownLintFile)) - .on("end", () => { - const fileOrFiles = "file" + (numFilesProcessed == 1 ? "" : "s"); - const msg = `Processed ${numFilesProcessed} ${fileOrFiles}, ${numFilesWithIssues} had issues.`; - if (numFilesWithIssues > 0) { - throw new Error(msg); - } else { - console.log(msg); - } - }); -} - -lintMarkdown.description = `Run markdownlint on all '*.md' files.`; - -gulp.task("lint-md", lintMarkdown); diff --git a/package.json b/package.json index ef069a000a..6e32c045d4 100644 --- a/package.json +++ b/package.json @@ -9,14 +9,10 @@ "test": "npm run check" }, "devDependencies": { - "gulp": "^5.0.0", - "js-yaml": "^4.1.0", "markdown-link-check": "3.11.2", "markdown-toc": "^1.2.0", - "markdownlint": "0.36.1", "markdownlint-cli": "0.43.0", - "prettier": "^3.0.0", - "through2": "^4.0.2" + "prettier": "^3.0.0" }, "prettier": { "proseWrap": "preserve"