Skip to content

Commit

Permalink
Disable new gitignore option when a custom file system implementation…
Browse files Browse the repository at this point in the history
… is provided due to globby issue (sindresorhus/globby#265).
  • Loading branch information
DavidAnson committed Apr 3, 2024
1 parent a083dec commit 9e37838
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion markdownlint-cli2.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ const main = async (params) => {
globPatterns,
dirToDirInfo,
optionsOverride,
Boolean(baseMarkdownlintOptions.gitignore),
// https://github.com/sindresorhus/globby/issues/265
!params.fs && Boolean(baseMarkdownlintOptions.gitignore),
noRequire
);
// Output linting status
Expand Down
16 changes: 16 additions & 0 deletions webworker/webworker-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const configNoMd047 = "{\n\"single-trailing-newline\": false\n}";
const files = [
[ "/file.md", md009md010 ],
[ "/file-two.md", md047 ],
[ "/.gitignore", "dir*" ],
[ "/package.json", `{\n"markdownlint-cli2": {\n"config": ${configNoMd047},\n"customRules": [],\n"markdownItPlugins": []\n}\n}` ],
[ "/dir1/file.md", md009md010 ],
[ "/dir1/.markdownlint.json", configNoMd010 ],
Expand Down Expand Up @@ -183,3 +184,18 @@ QUnit.test("workspace", (assert) => {
}
});
});

QUnit.test("workspace, gitignore (unsupported)", (assert) => {
assert.expect(1);
const filesWithGitignore = [
...files,
[ "/.markdownlint-cli2.jsonc", `{\n"gitignore":true\n}` ]
];
return markdownlintCli2.main({
"fs": new FsVirtual(filesWithGitignore),
"argv": [ "**/*.md" ],
"optionsOverride": {
"outputFormatters": [ [ outputFormatterLengthIs(assert, 8) ] ]
}
});
});

0 comments on commit 9e37838

Please sign in to comment.