Skip to content

Commit 3502bdf

Browse files
committed
Adds more linting rules
Fixes lint issues
1 parent 23db838 commit 3502bdf

32 files changed

+125
-76
lines changed

.vscode/tasks.json

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,33 @@
99
// A task runner that calls a custom npm script that compiles the extension.
1010
{
1111
"version": "2.0.0",
12-
"showOutput": "always",
12+
"showOutput": "silent",
1313
"tasks": [
1414
{
1515
"taskName": "compile",
16-
"command": "npm run compile",
16+
"command": "npm run compile --silent",
1717
"isBuildCommand": true,
1818
"isShellCommand": true,
19-
"problemMatcher": [ "$tsc", "$tslint5" ]
19+
"problemMatcher": [
20+
"$tsc",
21+
{
22+
"base": "$tslint5",
23+
"fileLocation": "relative"
24+
}
25+
]
2026
},
2127
{
2228
"taskName": "lint",
23-
"command": "npm run lint",
29+
"command": "npm run lint --silent",
2430
"isShellCommand": true,
25-
"problemMatcher": "$tslint5"
31+
"problemMatcher": {
32+
"base": "$tslint5",
33+
"fileLocation": "relative"
34+
}
2635
},
2736
{
2837
"taskName": "watch",
29-
"command": "npm run watch",
38+
"command": "npm run watch --silent",
3039
"isBackground": true,
3140
"isShellCommand": true,
3241
"problemMatcher": "$tsc-watch"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@
918918
"@types/node": "7.0.22",
919919
"@types/tmp": "0.0.33",
920920
"mocha": "3.4.1",
921-
"tslint": "5.3.0",
921+
"tslint": "5.3.2",
922922
"typescript": "2.3.3",
923923
"vscode": "1.1.0"
924924
}

src/activeEditorTracker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,4 @@ export class ActiveEditorTracker extends Disposable {
5656
this._resolver = undefined;
5757
return editor;
5858
}
59-
}
60-
59+
}

src/blameActiveLineController.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
import { Functions, Objects } from './system';
3-
import { DecorationOptions, DecorationInstanceRenderOptions, DecorationRenderOptions, Disposable, ExtensionContext, Range, StatusBarAlignment, StatusBarItem, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
3+
import { DecorationInstanceRenderOptions, DecorationOptions, DecorationRenderOptions, Disposable, ExtensionContext, Range, StatusBarAlignment, StatusBarItem, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode';
44
import { BlameAnnotationController } from './blameAnnotationController';
55
import { BlameAnnotationFormat, BlameAnnotationFormatter } from './blameAnnotationFormatter';
66
import { TextEditorComparer } from './comparers';
@@ -54,7 +54,7 @@ export class BlameActiveLineController extends Disposable {
5454
private _onConfigurationChanged() {
5555
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
5656

57-
let changed: boolean = false;
57+
let changed = false;
5858

5959
if (!Objects.areEquivalent(cfg.statusBar, this._config && this._config.statusBar)) {
6060
changed = true;
@@ -89,7 +89,7 @@ export class BlameActiveLineController extends Disposable {
8989

9090
if (!changed) return;
9191

92-
let trackActiveLine = cfg.statusBar.enabled || cfg.blame.annotation.activeLine !== 'off';
92+
const trackActiveLine = cfg.statusBar.enabled || cfg.blame.annotation.activeLine !== 'off';
9393
if (trackActiveLine && !this._activeEditorLineDisposable) {
9494
const subscriptions: Disposable[] = [];
9595

src/blameAnnotationController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { BlameAnnotationProvider } from './blameAnnotationProvider';
55
import { TextDocumentComparer, TextEditorComparer } from './comparers';
66
import { IBlameConfig } from './configuration';
77
import { ExtensionKey } from './constants';
8-
import { BlameabilityChangeEvent, GitService, GitUri, GitContextTracker } from './gitService';
8+
import { BlameabilityChangeEvent, GitContextTracker, GitService, GitUri } from './gitService';
99
import { Logger } from './logger';
1010
import { WhitespaceController } from './whitespaceController';
1111

@@ -199,7 +199,7 @@ export class BlameAnnotationController extends Disposable {
199199
async toggleBlameAnnotation(editor: TextEditor, shaOrLine?: string | number): Promise<boolean> {
200200
if (!editor || !editor.document || !this.git.isEditorBlameable(editor)) return false;
201201

202-
let provider = this._annotationProviders.get(editor.viewColumn || -1);
202+
const provider = this._annotationProviders.get(editor.viewColumn || -1);
203203
if (!provider) return this.showBlameAnnotation(editor, shaOrLine);
204204

205205
await this.clear(provider.editor.viewColumn || -1);

src/blameAnnotationFormatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class BlameAnnotationFormatter {
4646
return message;
4747
}
4848

49-
static getAnnotationHover(config: IBlameConfig, line: IGitCommitLine, commit: GitCommit): string | Array<string> {
49+
static getAnnotationHover(config: IBlameConfig, line: IGitCommitLine, commit: GitCommit): string | string[] {
5050
const message = `> \`${commit.message.replace(/\n/g, '\`\n>\n> \`')}\``;
5151
if (commit.isUncommitted) {
5252
return `\`${'0'.repeat(8)}\` &nbsp; __Uncommitted change__`;
@@ -103,7 +103,7 @@ export class BlameAnnotationFormatter {
103103
static getMessage(config: IBlameConfig, commit: GitCommit, truncateTo: number = 0, force: boolean = false) {
104104
if (!force && !config.annotation.message) return '';
105105

106-
let message = commit.isUncommitted ? 'Uncommitted change' : commit.message;
106+
const message = commit.isUncommitted ? 'Uncommitted change' : commit.message;
107107
if (truncateTo && message.length > truncateTo) {
108108
return `${message.substring(0, truncateTo - 1)}\u2026`;
109109
}

src/commands/diffDirectory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ActiveEditorCommand, Commands, getCommandUri } from './common';
55
import { BuiltInCommands } from '../constants';
66
import { GitService } from '../gitService';
77
import { Logger } from '../logger';
8-
import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks';
8+
import { BranchesQuickPick, CommandQuickPickItem } from '../quickPicks';
99

1010
export interface DiffDirectoryCommandCommandArgs {
1111
shaOrBranch1?: string;

src/commands/diffWithBranch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ActiveEditorCommand, Commands, getCommandUri } from './common';
44
import { BuiltInCommands } from '../constants';
55
import { GitService, GitUri } from '../gitService';
66
import { Logger } from '../logger';
7-
import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks';
7+
import { BranchesQuickPick, CommandQuickPickItem } from '../quickPicks';
88
import * as path from 'path';
99

1010
export interface DiffWithBranchCommandArgs {

src/commands/keyboard.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ export const keys: Keys[] = [
1616
'.'
1717
];
1818

19-
export declare type KeyMapping = { [id: string]: (QuickPickItem | (() => Promise<QuickPickItem>) | undefined) };
20-
let mappings: KeyMapping[] = [];
19+
export declare interface KeyMapping {
20+
[id: string]: (QuickPickItem | (() => Promise<QuickPickItem>) | undefined);
21+
}
22+
23+
const mappings: KeyMapping[] = [];
2124

2225
let _instance: Keyboard;
2326

src/commands/openInRemote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
2929
return command.execute();
3030
}
3131

32-
let placeHolder: string = '';
32+
let placeHolder = '';
3333
switch (args.resource.type) {
3434
case 'branch':
3535
// Check to see if the remote is in the branch

0 commit comments

Comments
 (0)