Skip to content

Commit

Permalink
Update code for issues newly reported by xo.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Feb 13, 2024
1 parent d5dffba commit 5fa53b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions markdownlint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || []) {
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 5fa53b1

Please sign in to comment.