diff --git a/gulp-src/lint-md.js b/gulp-src/lint-md.js index ee12d51ff5d2..2866588575a3 100644 --- a/gulp-src/lint-md.js +++ b/gulp-src/lint-md.js @@ -6,9 +6,7 @@ const markdownlint = require('markdownlint'); const { taskArgs, trimBlankLinesFromArray } = require('./_util'); const fs = require('fs'); -const defaultGlobs = [ - '**/*.md', -]; +const defaultGlobs = ['**/*.md']; const markdownFiles = [ '!.github/**', '!content-modules/**', @@ -127,7 +125,9 @@ function applyFixesToFileContent(content, issue) { function logFiles(debug) { return through2.obj(function (file, enc, cb) { - if (debug) { console.log('Processing file:', file.path); } + if (debug) { + console.log('Processing file:', file.path); + } cb(null, file); }); } @@ -137,7 +137,8 @@ function lintMarkdown() { glob: { alias: 'g', type: 'array', - description: 'Globs of files to run through markdownlint. List flag more than once for multiple values.', + description: + 'Globs of files to run through markdownlint. List flag more than once for multiple values.', default: defaultGlobs, }, debug: { @@ -159,7 +160,9 @@ function lintMarkdown() { fix = argv.fix; const globs = [...argv.glob, ...markdownFiles]; - if (argv.debug) { console.log('Globs being used:', globs); } + if (argv.debug) { + console.log('Globs being used:', globs); + } return gulp .src(globs, { followSymlinks: false }) diff --git a/package.json b/package.json index 7acda5cd94ef..5ae4b9ec7405 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)", "_check:links:internal": "npm run __check:links", "_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links", + "_check:markdown": "npx gulp lint-md", "_check:text": "npx textlint content data `ls *.md`", "_diff:check": "git diff --name-only --exit-code", "_diff:fail": "git diff --name-only --exit-code || exit 1", @@ -30,7 +31,7 @@ "_rename-to-kebab-case": "find assets content static -name '*_*' ! -name '_*' -exec sh -c 'mv \"$1\" \"${1//_/-}\"' _ {} \\;", "_serve:hugo": "hugo server --buildDrafts --minify", "_serve:netlify": "netlify dev -c \"npm run _serve:hugo -- --renderToMemory\"", - "_sync": "./scripts/sync-submodules.pl", + "_sync": "scripts/sync-submodules.pl", "all": "bash -c 'x=0; for c in \"$@\"; do npm run $c || x=$((x+1)); done; ((!x)) || (echo \"ERROR: some scripts failed!\" && exit 1)' -", "build:preview": "set -x && npm run _build -- --minify", "build:production": "npm run _hugo -- --minify", @@ -40,7 +41,7 @@ "check:format": "npm run _check:format || (echo '[help] Run: npm run fix:format'; exit 1)", "check:links:internal": "npm run _check:links:internal", "check:links": "npm run _check:links", - "check:markdown": "npx gulp lint-md", + "check:markdown": "scripts/check-markdown-wrapper.sh", "check:spelling": "npx cspell --no-progress -c .cspell.yml content data 'layouts/**/*.md'", "check:text": "npm run _check:text -- ", "check": "npm run seq -- $(npm run -s _list:check:*)", @@ -48,11 +49,11 @@ "code-excerpts": "rm -Rf tmp/excerpts/* && npm run seq -- code-excerpts:get code-excerpts:update-docs", "code-excerpts:get": "cd tools && dart run build_runner build --delete-conflicting-outputs --output ../tmp/excerpts", "code-excerpts:update-docs": "cd tools && dart run code_excerpt_updater --fragment-dir-path ../tmp/excerpts --src-dir-path examples --yaml --write-in-place content", - "cp:spec": "./scripts/content-modules/cp-pages.sh", + "cp:spec": "scripts/content-modules/cp-pages.sh", "diff:check": "npm run _diff:check || (echo; echo 'WARNING: the files above have not been committed'; echo)", "diff:fail": "npm run _diff:check || (echo; echo 'ERROR: the files above have changed. Locally rerun `npm run test-and-fix` and commit changes'; echo; exit 1)", "fix:all": "npm run seq -- $(npm -s run _list:fix:*)", - "fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 ./scripts/normalize-cspell-front-matter.pl", + "fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 scripts/normalize-cspell-front-matter.pl", "fix:filenames": "npm run _rename-to-kebab-case", "fix:format": "npm run format", "fix:i18n": "scripts/i18n-check.sh -u", @@ -83,7 +84,7 @@ "serve:hugo": "npm run _serve:hugo -- --renderToMemory", "serve:netlify": "npm run _serve:netlify", "serve": "npm run serve:hugo --", - "sync": "./scripts/sync-submodules.pl", + "sync": "scripts/sync-submodules.pl", "test-and-fix": "npm run seq -- check fix:dict fix:filenames", "test": "npm run check", "update:docsy-dep": "npm install --save-dev autoprefixer@latest postcss-cli@latest", diff --git a/scripts/check-markdown-wrapper.sh b/scripts/check-markdown-wrapper.sh index b74ee5922593..045eeed03949 100755 --- a/scripts/check-markdown-wrapper.sh +++ b/scripts/check-markdown-wrapper.sh @@ -11,4 +11,4 @@ if [[ ! -e $symlink_target ]]; then fi set -x -exec npx gulp lint-md "$@" +exec npm run _check:markdown "$@"