diff --git a/markdownlint.js b/markdownlint.js index 846d1f43d..8d6984704 100755 --- a/markdownlint.js +++ b/markdownlint.js @@ -266,14 +266,12 @@ const customRules = loadCustomRules(options.rules); const diff = files.filter(file => !ignores.some(ignore => ignore.absolute === file.absolute)).map(paths => paths.original); function lintAndPrint(stdin, files) { - files = files || []; + files ||= []; const config = readConfiguration(options.config); for (const rule of options.enable || []) { // Leave default values in place if rule is an object - if (!config[rule]) { - config[rule] = true; - } + config[rule] ||= true; } for (const rule of options.disable || []) { @@ -324,9 +322,7 @@ try { if (files.length > 0 && !options.stdin) { lintAndPrint(null, diff); } else if (files.length === 0 && options.stdin && !options.fix) { - import('get-stdin') - .then(module => module.default()) - .then(lintAndPrint); + import('get-stdin').then(module => module.default()).then(lintAndPrint); } else { program.help(); } diff --git a/test/test.js b/test/test.js index 682385908..70f8d84c6 100644 --- a/test/test.js +++ b/test/test.js @@ -6,7 +6,7 @@ const os = require('node:os'); const process = require('node:process'); const test = require('ava'); -const execa = (...args) => import('execa').then(module => module.execa(...args)); +const execa = (...arguments_) => import('execa').then(module => module.execa(...arguments_)); const errorPattern = /(\.md|\.markdown|\.mdf|stdin):\d+(:\d+)? MD\d{3}/gm;