Skip to content

Commit

Permalink
fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
hchiam committed Aug 4, 2019
1 parent b55403a commit b4ec120
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to the "custom-vscode-linter" extension will be documented in this file.

## 0.7.0

- Added check for `TODO` comments.

## 0.6.0

- Added check for `Number(someID)`
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "custom-vscode-linter",
"displayName": "custom-vscode-linter",
"description": "Custom VSCode Linter!",
"version": "0.6.5",
"version": "0.7.0",
"publisher": "hchiam",
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function activate(context: vscode.ExtensionContext) {
check_encryptedSQL(rangesToDecorate);
check_consoleLog(rangesToDecorate);
check_numberOfId(rangesToDecorate);
check_todoComment(rangesToDecorate);
activeEditor.setDecorations(decorationType, rangesToDecorate);
}

Expand Down Expand Up @@ -116,6 +117,13 @@ export function activate(context: vscode.ExtensionContext) {
genericCheck(regex, hoverMessage, popupMessage, rangesToDecorate);
}

function check_todoComment(rangesToDecorate: vscode.DecorationOptions[]) {
let regex = /(\/\/|--) ?TODO/g;
let hoverMessage = 'To-do comment detected.';
let popupMessage = 'To-do comment detected.';
genericCheck(regex, hoverMessage, popupMessage, rangesToDecorate);
}

function genericCheck(regex: RegExp = /^$/, hoverMessage: string = '', popupMessage: string = '', rangesToDecorate: vscode.DecorationOptions[] = []) {
if (!activeEditor) {
return;
Expand Down
5 changes: 5 additions & 0 deletions visually-check-this.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ Number(-1 || someId) // NO
if (!someID) { // YES

}

// TODO // YES
//TODO:// YES
-- TODO: // YES
--TODO // YES

0 comments on commit b4ec120

Please sign in to comment.