New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: do not lint markdown ignored files #16057
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
@@ -71,8 +71,7 @@ const NODE = "node ", // intentional extra space | |||
// Files | |||
RULE_FILES = glob.sync("lib/rules/*.js").filter(filePath => path.basename(filePath) !== "index.js"), | |||
JSON_FILES = find("conf/").filter(fileType("json")), | |||
MARKDOWNLINT_IGNORED_FILES = fs.readFileSync(path.join(__dirname, ".markdownlintignore"), "utf-8").split("\n"), | |||
MARKDOWN_FILES_ARRAY = find("docs/").concat(ls(".")).filter(fileType("md")).filter(file => !MARKDOWNLINT_IGNORED_FILES.includes(file)), | |||
MARKDOWNLINT_IGNORED = fs.readFileSync(path.join(__dirname, ".markdownlintignore"), "utf-8").split("\n"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content of .markdownlintignore
are gitignore patterns. We can use the ignore
library we already have as a dependency to filter out ignored files. That would be easier and more reliable than a custom implementation.
Ideally, we would use a glob library that supports gitignore patterns so that it doesn't traverse ignored directories at all, but that could be another enhancement.
And I'm not sure why are we using markdownlint API here instead of markdownlint CLI which could handle .markdownlintignore
by itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I try adding the glob
library or can we use markdownlint CLI instead of markdownlint API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would try with markdownlint CLI. That looks a lot simpler and I don't see any specific reasons to use API for our use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will update.
I'm confused because I do not see any output from markdownlint when I run it locally with If something did break here, I would want to investigate what caused it. |
Reproducible on windows OS and macOS. Steps to reproduce:
mini.clip.lint.issue.mov |
Hey @amareshsm, thanks for that detail. I realized that the reason you are seeing this issue and I'm not is because you have run I put together a simpler implementation of the fix for this in #16060 which I recommend we use instead. Please take a look, and thanks for finding this issue originally. |
Closing as the problem is fixed by #16060. |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:
Do not lint markdownlint ignored files.
What changes did you make? (Give an overview)
Before:
node_modules markdown files are getting linted when we run the
npm run lint
command.After changes:
Ignored all
.markdownlintignore
files.