Skip to content

Commit

Permalink
test(check-indentation): additional assertions
Browse files Browse the repository at this point in the history
As requested by @brettz9:
gajus#388 (comment)
  • Loading branch information
ahwayakchih committed Oct 3, 2019
1 parent cce70b0 commit 55b2a8e
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,35 @@ function quux () {

}
// Message: There must be no indentation.

/**
* @example <caption>
* Here is a long
* indented summary of this
* example
* </caption>
* ```js
* function hi () {
* alert('Hello');
* }
* ```
*/
// Options: [{"excludeTags":[]}]
// Message: There must be no indentation.

/**
* @example <caption>
* Here is a long
* summary of this
* example
* </caption>
* // Code is not wrapped into fenced code block
* function hi () {
* alert('Hello');
* }
*/
// Options: [{"excludeTags":[]}]
// Message: There must be no indentation.
````

The following patterns are not considered problems:
Expand Down Expand Up @@ -1030,6 +1059,20 @@ function quux () {
function quux () {

}

/**
* @example <caption>
* Here is a long
* summary of this
* example
* </caption>
* ```js
* function hi () {
* alert('Hello');
* }
* ```
*/
// Options: [{"excludeTags":[]}]
````


Expand Down
68 changes: 68 additions & 0 deletions test/rules/assertions/checkIndentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,55 @@ export default {
},
],
},
{
code: `
/**
* @example <caption>
* Here is a long
* indented summary of this
* example
* </caption>
* \`\`\`js
* function hi () {
* alert('Hello');
* }
* \`\`\`
*/
`,
errors: [
{
line: 5,
message: 'There must be no indentation.',
},
],
options: [{
excludeTags: [],
}],
},
{
code: `
/**
* @example <caption>
* Here is a long
* summary of this
* example
* </caption>
* // Code is not wrapped into fenced code block
* function hi () {
* alert('Hello');
* }
*/
`,
errors: [
{
line: 10,
message: 'There must be no indentation.',
},
],
options: [{
excludeTags: [],
}],
},
],
valid: [
{
Expand Down Expand Up @@ -221,5 +270,24 @@ export default {
}
`,
},
{
code: `
/**
* @example <caption>
* Here is a long
* summary of this
* example
* </caption>
* \`\`\`js
* function hi () {
* alert('Hello');
* }
* \`\`\`
*/
`,
options: [{
excludeTags: [],
}],
},
],
};

0 comments on commit 55b2a8e

Please sign in to comment.