Skip to content

Commit 0144ebe

Browse files
committed
Manually address new violations reported by xo.
1 parent 6c1b9a2 commit 0144ebe

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

markdownlint.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ function printResult(lintResult) {
170170

171171
lintResultString = results
172172
.map(result => {
173-
const {file, lineNumber, column, names, description, severity} = result;
173+
const {file, lineNumber, column, names, severity} = result;
174174
const columnText = column ? `:${column}` : '';
175-
return `${file}:${lineNumber}${columnText} ${severity} ${names} ${description}`;
175+
return `${file}:${lineNumber}${columnText} ${severity} ${names} ${result.description}`;
176176
})
177177
.join('\n');
178178
}
@@ -281,10 +281,10 @@ if (existsSync(ignorePath)) {
281281
ignoreFilter = fileInfo => !ignoreInstance.ignores(fileInfo.relative);
282282
}
283283

284-
const files = prepareFileList(program.args, ['md', 'markdown']).filter(value => ignoreFilter(value));
285-
const ignores = prepareFileList(options.ignore, null, files);
284+
const inputs = prepareFileList(program.args, ['md', 'markdown']).filter(value => ignoreFilter(value));
285+
const ignores = prepareFileList(options.ignore, null, inputs);
286286
const customRules = loadCustomRules(options.rules);
287-
const diff = files.filter(file => ignores.every(ignore => ignore.absolute !== file.absolute)).map(paths => paths.original);
287+
const diff = inputs.filter(file => ignores.every(ignore => ignore.absolute !== file.absolute)).map(paths => paths.original);
288288

289289
function lintAndPrint(stdin, files) {
290290
files ||= [];
@@ -334,9 +334,9 @@ function lintAndPrint(stdin, files) {
334334
}
335335

336336
try {
337-
if (files.length > 0 && !options.stdin) {
337+
if (inputs.length > 0 && !options.stdin) {
338338
lintAndPrint(null, diff);
339-
} else if (files.length === 0 && options.stdin && !options.fix) {
339+
} else if (inputs.length === 0 && options.stdin && !options.fix) {
340340
import('node:stream/consumers').then(module => module.text(process.stdin)).then(lintAndPrint);
341341
} else {
342342
program.help();

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
"prefer-arrow-callback": 0,
6969
"promise/prefer-await-to-then": 0,
7070
"object-shorthand": 0,
71+
"regexp/prefer-named-capture-group": 0,
72+
"unicorn/max-nested-calls": 0,
7173
"unicorn/prefer-module": 0,
7274
"unicorn/prefer-ternary": 0,
7375
"unicorn/prefer-top-level-await": 0

test/test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ test('linting of unreadable Markdown file fails', async t => {
183183
});
184184

185185
test('linting of incorrect Markdown via npm run file fails with eol', async t => {
186-
const {default: spawn} = await import('nano-spawn');
187-
const error = await t.throwsAsync(() => spawn('npm', ['run', 'invalid']));
188-
t.regex(error.stderr, /MD\d{3}.*((\nnpm ERR!)|($))/v);
186+
const error = await t.throwsAsync(() => nanoSpawn('npm', ['run', 'invalid']));
187+
t.regex(error.stderr, /MD\d{3}.*((\nnpm ERR!)|$)/v);
189188
});
190189

191190
test('glob linting works with passing files', async t => {

0 commit comments

Comments
 (0)