Skip to content

Commit

Permalink
Address new linting issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Mar 2, 2021
1 parent c350877 commit 3d037c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions markdownlint.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '*.';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -296,7 +297,7 @@ function lintAndPrint(stdin, files) {
fs.writeFileSync(file, fixedText, fsOptions);
}
}
});
}
}

const lintResult = markdownlint.sync(lintOptions);
Expand Down
4 changes: 2 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -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});
Expand Down

0 comments on commit 3d037c8

Please sign in to comment.