-
Notifications
You must be signed in to change notification settings - Fork 886
Conversation
@@ -10,7 +10,8 @@ class Clazz { // This comment is correct | |||
console.log("test"); //This comment has no space | |||
~~~~~~~~~~~~~~~~~~~~~~~~~ [space] | |||
} | |||
/// <reference or something> | |||
/// <not a reference> | |||
~~~~~~~~~~~~~~~~~~~ [space] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message could be better -- there is a space, the problem is the extra /
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it should handle comments starting with more than 2 slashes better. The comment text should only be checked starting from the first non-slash character.
And maybe there could be a new option to disallow more than 2 slashes
super(sourceFile, options); | ||
function parseOptions(options: Array<string | IExceptionsObject>): Options { | ||
return { | ||
case: options.indexOf(OPTION_LOWERCASE) !== -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nested ternary is discouraged
src/rules/commentFormatRule.ts
Outdated
} | ||
const commentText = fullText.slice(start, end); | ||
// whitelist //#region and //#endregion and JetBrains IDEs' "//noinspection ..." | ||
if (/^(?:#(!?end)?region|noinspection\s)/.test(commentText)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the !?end
part for? This matches !end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that should be ?:end
PR checklist
Overview of change:
Initially I just wanted to convert the walker to a function. But then I needed to change so much it became a complete rewrite.
Is there anything you'd like reviewers to focus on?
CHANGELOG.md entry:
[enhancement]
comment-format
no longer excludes comments with triple slash from linting except/// <reference path="..."/>