forked from palantir/tslint
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for RexExp pattern in comment-format rule exceptions (fixes
- Loading branch information
1 parent
5df075a
commit 3d6ccef
Showing
12 changed files
with
198 additions
and
37 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
class Clazz { // This comment is correct | ||
/* block comment | ||
* adada | ||
*/ | ||
public funcxion() { // this comment has a lowercase letter starting it | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [upper] | ||
//this comment is on its own line, and starts with a lowercase _and_ no space | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [upper] | ||
console.log("test"); //This comment has no space | ||
} | ||
/// <reference or something> | ||
} | ||
|
||
//#region test | ||
//#endregion | ||
|
||
`${location.protocol}//${location.hostname}` | ||
|
||
// tslint should show error here | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [upper] | ||
|
||
// tslint: not a rule flag | ||
~~~~~~~~~~~~~~~~~~~~~~~~ [upper] | ||
|
||
class Invalid {} | ||
|
||
// tslint:disable-next-line:no-unused-expression | ||
class Valid {} | ||
|
||
// todo write more tests | ||
~~~~~~~~~~~~~~~~~~~~~~ [upper] | ||
|
||
// STDIN for input | ||
// STDOUT for output | ||
// stderr for errors | ||
|
||
|
||
[upper]: comment must start with uppercase letter, word from exceptions list or exceptions pattern |
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 @@ | ||
{ | ||
"rules": { | ||
"comment-format": [true, "check-space", "check-lowercase", {"ignorePattern": "STD\\w{2,3}"}] | ||
}, | ||
"jsRules": { | ||
"comment-format": [true, "check-uppercase", {"ignorePattern": "std(in|out|err)\\b"}] | ||
} | ||
} |
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,37 @@ | ||
class Clazz { // this comment is correct | ||
/* block comment | ||
* adada | ||
*/ | ||
public funcxion() { // This comment has a capital letter starting it | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [lower] | ||
//This comment is on its own line, and starts with a capital _and_ no space | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [lower] | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [space] | ||
console.log("test"); //this comment has no space | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ [space] | ||
} | ||
/// <reference or something> | ||
} | ||
|
||
//#region test | ||
//#endregion | ||
|
||
`${location.protocol}//${location.hostname}` | ||
|
||
//noinspection JSUnusedGlobalSymbols | ||
const unusedVar = 'unneeded value'; | ||
|
||
// TODO: Write more tests | ||
|
||
// HACKING is not an exception | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [lower] | ||
|
||
// STDIN for input | ||
~~~~~~~~~~~~~~~~ [lower] | ||
// STDOUT for output | ||
~~~~~~~~~~~~~~~~~~ [lower] | ||
// stderr for errors | ||
|
||
|
||
[lower]: comment must start with lowercase letter, word from exceptions list or exceptions pattern | ||
[space]: comment must start with a space |
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 @@ | ||
{ | ||
"rules": { | ||
"comment-format": [true, "check-space", "check-lowercase", {"ignoreWords": ["TODO", "HACK"]}] | ||
}, | ||
"jsRules": { | ||
"comment-format": [true, "check-uppercase", {"ignoreWords": ["todo"]}] | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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