Skip to content

Commit c4bda06

Browse files
authored
Merge pull request #392 from ahwayakchih/test/check-indentation-examples-with-captions-and-code
Additional assertions for `check-indentation`
2 parents 326d2b5 + 55b2a8e commit c4bda06

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,35 @@ function quux () {
962962

963963
}
964964
// Message: There must be no indentation.
965+
966+
/**
967+
* @example <caption>
968+
* Here is a long
969+
* indented summary of this
970+
* example
971+
* </caption>
972+
* ```js
973+
* function hi () {
974+
* alert('Hello');
975+
* }
976+
* ```
977+
*/
978+
// Options: [{"excludeTags":[]}]
979+
// Message: There must be no indentation.
980+
981+
/**
982+
* @example <caption>
983+
* Here is a long
984+
* summary of this
985+
* example
986+
* </caption>
987+
* // Code is not wrapped into fenced code block
988+
* function hi () {
989+
* alert('Hello');
990+
* }
991+
*/
992+
// Options: [{"excludeTags":[]}]
993+
// Message: There must be no indentation.
965994
````
966995

967996
The following patterns are not considered problems:
@@ -1030,6 +1059,20 @@ function quux () {
10301059
function quux () {
10311060

10321061
}
1062+
1063+
/**
1064+
* @example <caption>
1065+
* Here is a long
1066+
* summary of this
1067+
* example
1068+
* </caption>
1069+
* ```js
1070+
* function hi () {
1071+
* alert('Hello');
1072+
* }
1073+
* ```
1074+
*/
1075+
// Options: [{"excludeTags":[]}]
10331076
````
10341077

10351078

test/rules/assertions/checkIndentation.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,55 @@ export default {
135135
},
136136
],
137137
},
138+
{
139+
code: `
140+
/**
141+
* @example <caption>
142+
* Here is a long
143+
* indented summary of this
144+
* example
145+
* </caption>
146+
* \`\`\`js
147+
* function hi () {
148+
* alert('Hello');
149+
* }
150+
* \`\`\`
151+
*/
152+
`,
153+
errors: [
154+
{
155+
line: 5,
156+
message: 'There must be no indentation.',
157+
},
158+
],
159+
options: [{
160+
excludeTags: [],
161+
}],
162+
},
163+
{
164+
code: `
165+
/**
166+
* @example <caption>
167+
* Here is a long
168+
* summary of this
169+
* example
170+
* </caption>
171+
* // Code is not wrapped into fenced code block
172+
* function hi () {
173+
* alert('Hello');
174+
* }
175+
*/
176+
`,
177+
errors: [
178+
{
179+
line: 10,
180+
message: 'There must be no indentation.',
181+
},
182+
],
183+
options: [{
184+
excludeTags: [],
185+
}],
186+
},
138187
],
139188
valid: [
140189
{
@@ -221,5 +270,24 @@ export default {
221270
}
222271
`,
223272
},
273+
{
274+
code: `
275+
/**
276+
* @example <caption>
277+
* Here is a long
278+
* summary of this
279+
* example
280+
* </caption>
281+
* \`\`\`js
282+
* function hi () {
283+
* alert('Hello');
284+
* }
285+
* \`\`\`
286+
*/
287+
`,
288+
options: [{
289+
excludeTags: [],
290+
}],
291+
},
224292
],
225293
};

0 commit comments

Comments
 (0)