Skip to content

Commit a0897c1

Browse files
committed
- Testing: Make tabs explicit
- Testing: Add test cases for jsdoc blocks flush at beginning of line
1 parent dd7d19f commit a0897c1

File tree

2 files changed

+84
-14
lines changed

2 files changed

+84
-14
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,31 @@ The following patterns are considered problems:
338338
* @param {Number} foo
339339
*/
340340
function quux (foo) {
341+
// with spaces
342+
}
343+
// Message: Expected JSDoc block to be aligned.
344+
345+
/**
346+
* @param {Number} foo
347+
*/
348+
function quux (foo) {
349+
// with tabs
350+
}
351+
// Message: Expected JSDoc block to be aligned.
341352

353+
/**
354+
* @param {Number} foo
355+
*/
356+
function quux (foo) {
357+
// with spaces
358+
}
359+
// Message: Expected JSDoc block to be aligned.
360+
361+
/**
362+
* @param {Number} foo
363+
*/
364+
function quux (foo) {
365+
// with spaces
342366
}
343367
// Message: Expected JSDoc block to be aligned.
344368

test/rules/assertions/checkAlignment.js

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ export default {
2424
}
2525
`,
2626
},
27-
/* eslint-disable no-tabs */
2827
{
2928
code: `
30-
/**
31-
* @param {Number} foo
32-
*/
33-
function quux (foo) {
34-
// with tabs
35-
}
29+
\t\t\t\t/**
30+
\t\t\t\t * @param {Number} foo
31+
\t\t\t\t */
32+
\t\t\t\tfunction quux (foo) {
33+
\t\t\t\t\t// with tabs
34+
\t\t\t\t}
3635
`,
3736
errors: [
3837
{
@@ -41,15 +40,62 @@ export default {
4140
},
4241
],
4342
output: `
44-
/**
45-
* @param {Number} foo
46-
*/
47-
function quux (foo) {
48-
// with tabs
49-
}
43+
\t\t\t\t/**
44+
\t\t\t\t * @param {Number} foo
45+
\t\t\t\t */
46+
\t\t\t\tfunction quux (foo) {
47+
\t\t\t\t\t// with tabs
48+
\t\t\t\t}
49+
`,
50+
},
51+
{
52+
code: `
53+
/**
54+
* @param {Number} foo
55+
*/
56+
function quux (foo) {
57+
// with spaces
58+
}
59+
`,
60+
errors: [
61+
{
62+
line: 3,
63+
message: 'Expected JSDoc block to be aligned.',
64+
},
65+
],
66+
output: `
67+
/**
68+
* @param {Number} foo
69+
*/
70+
function quux (foo) {
71+
// with spaces
72+
}
73+
`,
74+
},
75+
{
76+
code: `
77+
/**
78+
* @param {Number} foo
79+
*/
80+
function quux (foo) {
81+
// with spaces
82+
}
83+
`,
84+
errors: [
85+
{
86+
line: 3,
87+
message: 'Expected JSDoc block to be aligned.',
88+
},
89+
],
90+
output: `
91+
/**
92+
* @param {Number} foo
93+
*/
94+
function quux (foo) {
95+
// with spaces
96+
}
5097
`,
5198
},
52-
/* eslint-enable no-tabs */
5399
{
54100
code: `
55101
/**

0 commit comments

Comments
 (0)