Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn about declarations with multiple comments
Resolves #1855
- Loading branch information
Showing
7 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Logger, LogLevel } from "../lib/utils"; | ||
import { fail } from "assert/strict"; | ||
|
||
const levelMap: Record<LogLevel, string> = { | ||
[LogLevel.Error]: "error: ", | ||
[LogLevel.Warn]: "warn: ", | ||
[LogLevel.Info]: "info: ", | ||
[LogLevel.Verbose]: "debug: ", | ||
}; | ||
|
||
export class TestLogger extends Logger { | ||
messages: string[] = []; | ||
|
||
expectMessage(message: string) { | ||
if (!this.messages.includes(message)) { | ||
const messages = this.messages.join("\n\t"); | ||
fail( | ||
`Expected "${message}" to be logged. The logged messages were:\n\t${messages}` | ||
); | ||
} | ||
} | ||
|
||
override log(message: string, level: LogLevel): void { | ||
this.messages.push(levelMap[level] + message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export namespace SingleCommentMultiDeclaration {} | ||
/** Comment on second declaration */ | ||
export namespace SingleCommentMultiDeclaration {} | ||
|
||
/** Comment 1 */ | ||
export namespace MultiCommentMultiDeclaration {} | ||
/** Comment 2 */ | ||
export namespace MultiCommentMultiDeclaration {} |