Skip to content
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

Don't check indentation within code blocks #334

Closed
iansan5653 opened this issue Jul 12, 2019 · 2 comments · Fixed by #388 or #391
Closed

Don't check indentation within code blocks #334

iansan5653 opened this issue Jul 12, 2019 · 2 comments · Fixed by #388 or #391

Comments

@iansan5653
Copy link

Currently, if jsdoc/check-indentation is set and a markdown code block is included that contains indentation, the comment is considered to be an error because there is indentation in the comment. However, code blocks are expected to be properly indented for display, so this rule should either not check within blocks, or it should have an option to ignore code blocks.

Example:

/**
 * This is a class that injects some HTML elements.
 * The injected elements can be styled as follows:
 * ```xml
 * <container>
 *  <element class="readout__gauge gauge">
 *    <element class="gauge__name">{Caption}</element>
 *    <element class="gauge__value">{Value}</element>
 *  </element>
 *  <element class="readout__gauge gauge">
 *    <element class="gauge__name">{Caption}</element>
 *    <element class="gauge__value">{Value}</element>
 *  </element>
 * </container>
 * ```
 */
ahwayakchih added a commit to ahwayakchih/eslint-plugin-jsdoc that referenced this issue Sep 30, 2019
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.
ahwayakchih added a commit to ahwayakchih/eslint-plugin-jsdoc that referenced this issue Oct 2, 2019
golopot pushed a commit that referenced this issue Oct 2, 2019
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 #334.
@gajus
Copy link
Owner

gajus commented Oct 2, 2019

🎉 This issue has been resolved in version 15.9.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label Oct 2, 2019
ahwayakchih added a commit to ahwayakchih/eslint-plugin-jsdoc that referenced this issue Oct 2, 2019
@gajus
Copy link
Owner

gajus commented Oct 2, 2019

🎉 This issue has been resolved in version 15.9.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants