-
-
Notifications
You must be signed in to change notification settings - Fork 163
Fix: ignore examples in check-indentation
#388
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
Fix: ignore examples in check-indentation
#388
Conversation
This adds an `excludeExamples` option, defaulting to `true`. When enabled (or not configured) it will mask all `@example` tags and their content before testing indentation. That prevents errors about indentation inside example code blocks and keeps correct line numbers when reporting indentation error found elsewhere. It should fix gajus#334.
Ideally this would default to `true`, but that could break existing setups.
check-indentation
Instead of rather specific `excludeExamples` option, we now have more generic `excludeTags` option. It takes an array of tag names to exclude from `check-indentation`, and defaults to `['example']`. Added test suggested by @golopot: gajus#388 (comment)
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 changed from excludeExamples
option to excludeTags
option, and made it default to ['example']
.
I also added suggested tests.
@brettz9, @golopot i could also add an option to ignore "code blocks" in description, which would fix #334, but i'm not sure if you'd be willing to accept such change, and if it's ok for this PR or better to add it separately. Or if "code blocks" should be kept in |
Another pr to handling code blocks (three ticks) would be great and it does not need to be under an option. It looks like that three ticks is recognized by jsdoc doc generator through the markdown plugin. And VS code recognized it. |
OK, i prepared #391, but it has to wait because it builds on top of this PR (so i don't have to solve merge conflicts later). |
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.
Instead of rather specific `excludeExamples` option, we now have more generic `excludeTags` option. It takes an array of tag names to exclude from `check-indentation`, and defaults to `['example']`. Added test suggested by @golopot: #388 (comment)
🎉 This PR is included in version 15.9.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
As requested by @brettz9: gajus#388 (comment)
This should fix
#334by makingcheck-indentation
rule ignore whole@example
blocks.UPDATE: actually it does not fix #334, but it fixes similar issue with example code blocks.
It could be improved to allow to pass which tags should be ignored as an option, instead of rather specific
excludeExamples
i added.