From 3d037c8ec203bdba576412ea7942451cf57e9edf Mon Sep 17 00:00:00 2001 From: David Anson Date: Mon, 1 Mar 2021 21:41:11 -0800 Subject: [PATCH] Address new linting issues. --- markdownlint.js | 7 ++++--- test/test.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/markdownlint.js b/markdownlint.js index 9ffb018f3..15864cc73 100755 --- a/markdownlint.js +++ b/markdownlint.js @@ -78,7 +78,7 @@ function readConfiguration(args) { function prepareFileList(files, fileExtensions, previousResults) { const globOptions = { - dot: !!options.dot, + dot: Boolean(options.dot), nodir: true }; let extensionGlobPart = '*.'; @@ -205,6 +205,7 @@ function tryResolvePath(filepath) { // Looks like a package name, resolve it relative to cwd // Get list of directories, where requested module can be. let paths = Module._nodeModulePaths(processCwd); + // eslint-disable-next-line unicorn/prefer-spread paths = paths.concat(Module.globalPaths); if (require.resolve.paths) { // Node >= 8.9.0 @@ -285,7 +286,7 @@ function lintAndPrint(stdin, files) { resultVersion: 3 }; const markdownlintRuleHelpers = require('markdownlint-rule-helpers'); - files.forEach(file => { + for (const file of files) { fixOptions.files = [file]; const fixResult = markdownlint.sync(fixOptions); const fixes = fixResult[file].filter(error => error.fixInfo); @@ -296,7 +297,7 @@ function lintAndPrint(stdin, files) { fs.writeFileSync(file, fixedText, fsOptions); } } - }); + } } const lintResult = markdownlint.sync(lintOptions); diff --git a/test/test.js b/test/test.js index 66a9a018a..d6ae68b73 100644 --- a/test/test.js +++ b/test/test.js @@ -741,7 +741,7 @@ test('Linter text file --output must end with EOF newline', async t => { } }); -test('--dot option to include folders/files with a dot', async (t) => { +test('--dot option to include folders/files with a dot', async t => { try { await execa('../markdownlint.js', ['--config', 'test-config.json', '--dot', '**/incorrect-dot.md', '**/.file-with-dot.md', '**/correct.md'], @@ -753,7 +753,7 @@ test('--dot option to include folders/files with a dot', async (t) => { } }); -test('without --dot option exclude folders/files with a dot', async (t) => { +test('without --dot option exclude folders/files with a dot', async t => { const result = await execa('../markdownlint.js', ['--config', 'test-config.json', '**/incorrect-dot.md', '**/.file-with-dot.md', '**/correct.md'], {stripFinalNewline: false});