Skip to content

Commit 2a4cd1e

Browse files
committed
fixup: add more tests and update comment rule
1 parent 7ff651d commit 2a4cd1e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/rules/comment-syntax.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export default createRule<Options, MessageIds>({
154154
context.report({ node: comment, messageId: 'lineCommentCapital' });
155155
}
156156

157-
if (lastChar === '.' && !comment.value.endsWith('etc.') && !comment.value.endsWith(' ...')) {
157+
if (lastChar === '.' && !comment.value.endsWith('etc.') && !comment.value.endsWith('...')) {
158158
context.report({ node: comment, messageId: 'lineCommentEnding' });
159159
}
160160

test/rules/comment.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@ ruleTester({
1616
// SHOULD be valid
1717
`,
1818
},
19+
{
20+
code: stripIndent`
21+
// #region foo
22+
`,
23+
},
24+
{
25+
code: stripIndent`
26+
// #endregion foo
27+
`,
28+
},
29+
{
30+
code: stripIndent`
31+
// foo...
32+
`,
33+
},
34+
{
35+
code: stripIndent`
36+
// foo ...
37+
`,
38+
},
39+
{
40+
code: stripIndent`
41+
// foo etc.
42+
`,
43+
},
1944
{
2045
code: stripIndent`
2146
/// <reference path="../../../../node_modules/@types/should_be_valid.d.ts" />

0 commit comments

Comments
 (0)