Skip to content

Commit 5fa53b1

Browse files
committed
Update code for issues newly reported by xo.
1 parent d5dffba commit 5fa53b1

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

markdownlint.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,12 @@ const customRules = loadCustomRules(options.rules);
266266
const diff = files.filter(file => !ignores.some(ignore => ignore.absolute === file.absolute)).map(paths => paths.original);
267267

268268
function lintAndPrint(stdin, files) {
269-
files = files || [];
269+
files ||= [];
270270
const config = readConfiguration(options.config);
271271

272272
for (const rule of options.enable || []) {
273273
// Leave default values in place if rule is an object
274-
if (!config[rule]) {
275-
config[rule] = true;
276-
}
274+
config[rule] ||= true;
277275
}
278276

279277
for (const rule of options.disable || []) {
@@ -324,9 +322,7 @@ try {
324322
if (files.length > 0 && !options.stdin) {
325323
lintAndPrint(null, diff);
326324
} else if (files.length === 0 && options.stdin && !options.fix) {
327-
import('get-stdin')
328-
.then(module => module.default())
329-
.then(lintAndPrint);
325+
import('get-stdin').then(module => module.default()).then(lintAndPrint);
330326
} else {
331327
program.help();
332328
}

test/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const os = require('node:os');
66
const process = require('node:process');
77
const test = require('ava');
88

9-
const execa = (...args) => import('execa').then(module => module.execa(...args));
9+
const execa = (...arguments_) => import('execa').then(module => module.execa(...arguments_));
1010

1111
const errorPattern = /(\.md|\.markdown|\.mdf|stdin):\d+(:\d+)? MD\d{3}/gm;
1212

0 commit comments

Comments
 (0)