diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2c2abf1..669e6ca 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -9,24 +9,33 @@ // A task runner that calls a custom npm script that compiles the extension. { "version": "2.0.0", - "showOutput": "always", + "showOutput": "silent", "tasks": [ { "taskName": "compile", - "command": "npm run compile", + "command": "npm run compile --silent", "isBuildCommand": true, "isShellCommand": true, - "problemMatcher": [ "$tsc", "$tslint5" ] + "problemMatcher": [ + "$tsc", + { + "base": "$tslint5", + "fileLocation": "relative" + } + ] }, { "taskName": "lint", - "command": "npm run lint", + "command": "npm run lint --silent", "isShellCommand": true, - "problemMatcher": "$tslint5" + "problemMatcher": { + "base": "$tslint5", + "fileLocation": "relative" + } }, { "taskName": "watch", - "command": "npm run watch", + "command": "npm run watch --silent", "isBackground": true, "isShellCommand": true, "problemMatcher": "$tsc-watch" diff --git a/package.json b/package.json index 19b4887..9c8e1ef 100644 --- a/package.json +++ b/package.json @@ -918,7 +918,7 @@ "@types/node": "7.0.22", "@types/tmp": "0.0.33", "mocha": "3.4.1", - "tslint": "5.3.0", + "tslint": "5.3.2", "typescript": "2.3.3", "vscode": "1.1.0" } diff --git a/src/activeEditorTracker.ts b/src/activeEditorTracker.ts index 1ded701..daaeaf1 100644 --- a/src/activeEditorTracker.ts +++ b/src/activeEditorTracker.ts @@ -56,5 +56,4 @@ export class ActiveEditorTracker extends Disposable { this._resolver = undefined; return editor; } -} - +} \ No newline at end of file diff --git a/src/blameActiveLineController.ts b/src/blameActiveLineController.ts index c298b6b..1e1eb59 100644 --- a/src/blameActiveLineController.ts +++ b/src/blameActiveLineController.ts @@ -1,6 +1,6 @@ 'use strict'; import { Functions, Objects } from './system'; -import { DecorationOptions, DecorationInstanceRenderOptions, DecorationRenderOptions, Disposable, ExtensionContext, Range, StatusBarAlignment, StatusBarItem, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode'; +import { DecorationInstanceRenderOptions, DecorationOptions, DecorationRenderOptions, Disposable, ExtensionContext, Range, StatusBarAlignment, StatusBarItem, TextEditor, TextEditorDecorationType, TextEditorSelectionChangeEvent, window, workspace } from 'vscode'; import { BlameAnnotationController } from './blameAnnotationController'; import { BlameAnnotationFormat, BlameAnnotationFormatter } from './blameAnnotationFormatter'; import { TextEditorComparer } from './comparers'; @@ -54,7 +54,7 @@ export class BlameActiveLineController extends Disposable { private _onConfigurationChanged() { const cfg = workspace.getConfiguration().get(ExtensionKey)!; - let changed: boolean = false; + let changed = false; if (!Objects.areEquivalent(cfg.statusBar, this._config && this._config.statusBar)) { changed = true; @@ -89,7 +89,7 @@ export class BlameActiveLineController extends Disposable { if (!changed) return; - let trackActiveLine = cfg.statusBar.enabled || cfg.blame.annotation.activeLine !== 'off'; + const trackActiveLine = cfg.statusBar.enabled || cfg.blame.annotation.activeLine !== 'off'; if (trackActiveLine && !this._activeEditorLineDisposable) { const subscriptions: Disposable[] = []; diff --git a/src/blameAnnotationController.ts b/src/blameAnnotationController.ts index 8bb55f3..5e30720 100644 --- a/src/blameAnnotationController.ts +++ b/src/blameAnnotationController.ts @@ -5,7 +5,7 @@ import { BlameAnnotationProvider } from './blameAnnotationProvider'; import { TextDocumentComparer, TextEditorComparer } from './comparers'; import { IBlameConfig } from './configuration'; import { ExtensionKey } from './constants'; -import { BlameabilityChangeEvent, GitService, GitUri, GitContextTracker } from './gitService'; +import { BlameabilityChangeEvent, GitContextTracker, GitService, GitUri } from './gitService'; import { Logger } from './logger'; import { WhitespaceController } from './whitespaceController'; @@ -199,7 +199,7 @@ export class BlameAnnotationController extends Disposable { async toggleBlameAnnotation(editor: TextEditor, shaOrLine?: string | number): Promise { if (!editor || !editor.document || !this.git.isEditorBlameable(editor)) return false; - let provider = this._annotationProviders.get(editor.viewColumn || -1); + const provider = this._annotationProviders.get(editor.viewColumn || -1); if (!provider) return this.showBlameAnnotation(editor, shaOrLine); await this.clear(provider.editor.viewColumn || -1); diff --git a/src/blameAnnotationFormatter.ts b/src/blameAnnotationFormatter.ts index 4a45eb8..007383b 100644 --- a/src/blameAnnotationFormatter.ts +++ b/src/blameAnnotationFormatter.ts @@ -46,7 +46,7 @@ export class BlameAnnotationFormatter { return message; } - static getAnnotationHover(config: IBlameConfig, line: IGitCommitLine, commit: GitCommit): string | Array { + static getAnnotationHover(config: IBlameConfig, line: IGitCommitLine, commit: GitCommit): string | string[] { const message = `> \`${commit.message.replace(/\n/g, '\`\n>\n> \`')}\``; if (commit.isUncommitted) { return `\`${'0'.repeat(8)}\`   __Uncommitted change__`; @@ -103,7 +103,7 @@ export class BlameAnnotationFormatter { static getMessage(config: IBlameConfig, commit: GitCommit, truncateTo: number = 0, force: boolean = false) { if (!force && !config.annotation.message) return ''; - let message = commit.isUncommitted ? 'Uncommitted change' : commit.message; + const message = commit.isUncommitted ? 'Uncommitted change' : commit.message; if (truncateTo && message.length > truncateTo) { return `${message.substring(0, truncateTo - 1)}\u2026`; } diff --git a/src/commands/diffDirectory.ts b/src/commands/diffDirectory.ts index 34db366..8461186 100644 --- a/src/commands/diffDirectory.ts +++ b/src/commands/diffDirectory.ts @@ -5,7 +5,7 @@ import { ActiveEditorCommand, Commands, getCommandUri } from './common'; import { BuiltInCommands } from '../constants'; import { GitService } from '../gitService'; import { Logger } from '../logger'; -import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks'; +import { BranchesQuickPick, CommandQuickPickItem } from '../quickPicks'; export interface DiffDirectoryCommandCommandArgs { shaOrBranch1?: string; diff --git a/src/commands/diffWithBranch.ts b/src/commands/diffWithBranch.ts index d650ef5..716a7e3 100644 --- a/src/commands/diffWithBranch.ts +++ b/src/commands/diffWithBranch.ts @@ -4,7 +4,7 @@ import { ActiveEditorCommand, Commands, getCommandUri } from './common'; import { BuiltInCommands } from '../constants'; import { GitService, GitUri } from '../gitService'; import { Logger } from '../logger'; -import { CommandQuickPickItem, BranchesQuickPick } from '../quickPicks'; +import { BranchesQuickPick, CommandQuickPickItem } from '../quickPicks'; import * as path from 'path'; export interface DiffWithBranchCommandArgs { diff --git a/src/commands/keyboard.ts b/src/commands/keyboard.ts index 0a107d2..16aa820 100644 --- a/src/commands/keyboard.ts +++ b/src/commands/keyboard.ts @@ -16,8 +16,11 @@ export const keys: Keys[] = [ '.' ]; -export declare type KeyMapping = { [id: string]: (QuickPickItem | (() => Promise) | undefined) }; -let mappings: KeyMapping[] = []; +export declare interface KeyMapping { + [id: string]: (QuickPickItem | (() => Promise) | undefined); +} + +const mappings: KeyMapping[] = []; let _instance: Keyboard; diff --git a/src/commands/openInRemote.ts b/src/commands/openInRemote.ts index d4193b8..e175c2a 100644 --- a/src/commands/openInRemote.ts +++ b/src/commands/openInRemote.ts @@ -29,7 +29,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand { return command.execute(); } - let placeHolder: string = ''; + let placeHolder = ''; switch (args.resource.type) { case 'branch': // Check to see if the remote is in the branch diff --git a/src/extension.ts b/src/extension.ts index d4d6c4c..9380c40 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -12,7 +12,7 @@ import { ShowBlameCommand, ToggleBlameCommand } from './commands'; import { ShowBlameHistoryCommand, ShowFileHistoryCommand } from './commands'; import { ShowLastQuickPickCommand } from './commands'; import { ShowQuickBranchHistoryCommand, ShowQuickCurrentBranchHistoryCommand, ShowQuickFileHistoryCommand } from './commands'; -import { ShowQuickCommitDetailsCommand, ShowQuickCommitFileDetailsCommand, ShowCommitSearchCommand } from './commands'; +import { ShowCommitSearchCommand, ShowQuickCommitDetailsCommand, ShowQuickCommitFileDetailsCommand } from './commands'; import { ShowQuickRepoStatusCommand, ShowQuickStashListCommand } from './commands'; import { StashApplyCommand, StashDeleteCommand, StashSaveCommand } from './commands'; import { ToggleCodeLensCommand } from './commands'; diff --git a/src/git/gitContextTracker.ts b/src/git/gitContextTracker.ts index 594ec10..be761a1 100644 --- a/src/git/gitContextTracker.ts +++ b/src/git/gitContextTracker.ts @@ -72,8 +72,8 @@ export class GitContextTracker extends Disposable { if (!TextDocumentComparer.equals(this._editor && this._editor.document, e && e.document)) return; // Can't unsubscribe here because undo doesn't trigger any other event - //this._unsubscribeToDocumentChanges(); - //this.updateBlameability(false); + // this._unsubscribeToDocumentChanges(); + // this.updateBlameability(false); // We have to defer because isDirty is not reliable inside this event setTimeout(() => this._updateBlameability(!e.document.isDirty), 1); @@ -83,7 +83,7 @@ export class GitContextTracker extends Disposable { if (!TextDocumentComparer.equals(this._editor && this._editor.document, e)) return; // Don't need to resubscribe as we aren't unsubscribing on document changes anymore - //this._subscribeToDocumentChanges(); + // this._subscribeToDocumentChanges(); this._updateBlameability(!e.isDirty); } diff --git a/src/git/models/logCommit.ts b/src/git/models/logCommit.ts index e6e9927..02c6850 100644 --- a/src/git/models/logCommit.ts +++ b/src/git/models/logCommit.ts @@ -1,7 +1,7 @@ 'use strict'; import { Uri } from 'vscode'; import { GitCommit, GitCommitType, IGitCommitLine } from './commit'; -import { IGitStatusFile, GitStatusFileStatus } from './status'; +import { GitStatusFileStatus, IGitStatusFile } from './status'; import * as path from 'path'; export class GitLogCommit extends GitCommit { diff --git a/src/git/models/stashCommit.ts b/src/git/models/stashCommit.ts index 5c5720b..5a47afa 100644 --- a/src/git/models/stashCommit.ts +++ b/src/git/models/stashCommit.ts @@ -1,7 +1,7 @@ 'use strict'; import { IGitCommitLine } from './commit'; import { GitLogCommit } from './logCommit'; -import { IGitStatusFile, GitStatusFileStatus } from './status'; +import { GitStatusFileStatus, IGitStatusFile } from './status'; export class GitStashCommit extends GitLogCommit { diff --git a/src/git/parsers/blameParser.ts b/src/git/parsers/blameParser.ts index 266f5a8..1c20438 100644 --- a/src/git/parsers/blameParser.ts +++ b/src/git/parsers/blameParser.ts @@ -41,7 +41,7 @@ export class GitBlameParser { let entry: IBlameEntry | undefined = undefined; let position = -1; while (++position < lines.length) { - let lineParts = lines[position].split(' '); + const lineParts = lines[position].split(' '); if (lineParts.length < 2) { continue; } @@ -122,7 +122,7 @@ export class GitBlameParser { const authors: Map = new Map(); const commits: Map = new Map(); - const lines: Array = []; + const lines: IGitCommitLine[] = []; let relativeFileName = repoPath && fileName; diff --git a/src/git/parsers/logParser.ts b/src/git/parsers/logParser.ts index 538ee6c..3f69f75 100644 --- a/src/git/parsers/logParser.ts +++ b/src/git/parsers/logParser.ts @@ -1,6 +1,6 @@ 'use strict'; import { Range } from 'vscode'; -import { Git, GitStatusFileStatus, GitLogCommit, GitCommitType, IGitAuthor, IGitLog, IGitStatusFile } from './../git'; +import { Git, GitCommitType, GitLogCommit, GitStatusFileStatus, IGitAuthor, IGitLog, IGitStatusFile } from './../git'; // import { Logger } from '../../logger'; import * as moment from 'moment'; import * as path from 'path'; diff --git a/src/git/parsers/statusParser.ts b/src/git/parsers/statusParser.ts index de9b78c..3580b79 100644 --- a/src/git/parsers/statusParser.ts +++ b/src/git/parsers/statusParser.ts @@ -1,5 +1,5 @@ 'use strict'; -import { Git, GitStatusFileStatus, GitStatusFile, IGitStatus } from './../git'; +import { Git, GitStatusFile, GitStatusFileStatus, IGitStatus } from './../git'; interface IFileStatusEntry { staged: boolean; @@ -61,7 +61,7 @@ export class GitStatusParser { else { let entry: IFileStatusEntry; const rawStatus = line.substring(0, 2); - let fileName = line.substring(3); + const fileName = line.substring(3); if (rawStatus[0] === 'R') { const [file1, file2] = fileName.replace(/\"/g, '').split('->'); entry = this._parseFileEntry(rawStatus, file2.trim(), file1.trim()); @@ -98,7 +98,7 @@ export class GitStatusParser { } } else { - let lineParts = line.split(' '); + const lineParts = line.split(' '); let entry: IFileStatusEntry | undefined = undefined; switch (lineParts[0][0]) { case '1': // normal diff --git a/src/git/remotes/bitbucket.ts b/src/git/remotes/bitbucket.ts index 7877cd7..fdf07be 100644 --- a/src/git/remotes/bitbucket.ts +++ b/src/git/remotes/bitbucket.ts @@ -21,7 +21,7 @@ export class BitbucketService extends RemoteProvider { } protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string { - let line: string = ''; + let line = ''; if (range) { if (range.start.line === range.end.line) { line = `#${fileName}-${range.start.line}`; diff --git a/src/git/remotes/github.ts b/src/git/remotes/github.ts index 3f9fb55..bde91db 100644 --- a/src/git/remotes/github.ts +++ b/src/git/remotes/github.ts @@ -21,7 +21,7 @@ export class GitHubService extends RemoteProvider { } protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string { - let line: string = ''; + let line = ''; if (range) { if (range.start.line === range.end.line) { line = `#L${range.start.line}`; diff --git a/src/git/remotes/visualStudio.ts b/src/git/remotes/visualStudio.ts index dcb8997..89b5e08 100644 --- a/src/git/remotes/visualStudio.ts +++ b/src/git/remotes/visualStudio.ts @@ -21,7 +21,7 @@ export class VisualStudioService extends RemoteProvider { } protected getUrlForFile(fileName: string, branch?: string, sha?: string, range?: Range): string { - let line: string = ''; + let line = ''; if (range) { if (range.start.line === range.end.line) { line = `&line=${range.start.line}`; diff --git a/src/gitCodeLensProvider.ts b/src/gitCodeLensProvider.ts index 3b51b5f..ef8a4bc 100644 --- a/src/gitCodeLensProvider.ts +++ b/src/gitCodeLensProvider.ts @@ -3,7 +3,7 @@ import { Functions, Iterables, Strings } from './system'; import { CancellationToken, CodeLens, CodeLensProvider, Command, commands, DocumentSelector, Event, EventEmitter, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri, workspace } from 'vscode'; import { Commands, DiffWithPreviousCommandArgs, ShowBlameHistoryCommandArgs, ShowFileHistoryCommandArgs, ShowQuickCommitDetailsCommandArgs, ShowQuickCommitFileDetailsCommandArgs, ShowQuickFileHistoryCommandArgs } from './commands'; import { BuiltInCommands, DocumentSchemes, ExtensionKey } from './constants'; -import { CodeLensCommand, CodeLensLocation, IConfig, ICodeLensLanguageLocation } from './configuration'; +import { CodeLensCommand, CodeLensLocation, ICodeLensLanguageLocation, IConfig } from './configuration'; import { GitCommit, GitService, GitUri, IGitBlame, IGitBlameLines } from './gitService'; import { Logger } from './logger'; import * as moment from 'moment'; @@ -115,7 +115,7 @@ export class GitCodeLensProvider implements CodeLensProvider { } private _validateSymbolAndGetBlameRange(document: TextDocument, symbol: SymbolInformation, languageLocation: ICodeLensLanguageLocation): Range | undefined { - let valid: boolean = false; + let valid = false; let range: Range | undefined; switch (languageLocation.location) { case CodeLensLocation.All: diff --git a/src/gitService.ts b/src/gitService.ts index 3d58910..367c5c1 100644 --- a/src/gitService.ts +++ b/src/gitService.ts @@ -33,17 +33,16 @@ class GitCacheEntry { return Iterables.every(this.cache.values(), _ => _.errorMessage !== undefined); } - get (key: string): T | undefined { + get(key: string): T | undefined { return this.cache.get(key) as T; } - set (key: string, value: T) { + set(key: string, value: T) { this.cache.set(key, value); } } interface ICachedItem { - //date: Date; item: Promise; errorMessage?: string; } @@ -238,7 +237,7 @@ export class GitService extends Disposable { } private async _fileExists(repoPath: string, fileName: string): Promise { - return await new Promise((resolve, reject) => fs.exists(path.resolve(repoPath, fileName), e => resolve(e))); + return await new Promise((resolve, reject) => fs.exists(path.resolve(repoPath, fileName), resolve)); } async findNextCommit(repoPath: string, fileName: string, sha?: string): Promise { @@ -319,7 +318,7 @@ export class GitService extends Disposable { } async getBlameForFile(uri: GitUri): Promise { - let key: string = 'blame'; + let key = 'blame'; if (uri.sha !== undefined) { key += `:${uri.sha}`; } @@ -369,7 +368,6 @@ export class GitService extends Disposable { Logger.log(`Add blame cache for '${entry.key}:${key}'`); entry.set(key, { - //date: new Date(), item: promise } as ICachedBlame); } @@ -400,7 +398,6 @@ export class GitService extends Disposable { Logger.log(`Replace blame cache with empty promise for '${entry.key}:${key}'`); entry.set(key, { - //date: new Date(), item: GitService.EmptyPromise, errorMessage: msg } as ICachedBlame); @@ -519,7 +516,7 @@ export class GitService extends Disposable { const commitCount = blame.commits.size; - const locations: Array = []; + const locations: Location[] = []; Iterables.forEach(blame.commits.values(), (c, i) => { if (c.isUncommitted) return; @@ -567,7 +564,7 @@ export class GitService extends Disposable { } async getDiffForFile(repoPath: string | undefined, fileName: string, sha1?: string, sha2?: string): Promise { - let key: string = 'diff'; + let key = 'diff'; if (sha1 !== undefined) { key += `:${sha1}`; } @@ -605,7 +602,6 @@ export class GitService extends Disposable { Logger.log(`Add log cache for '${entry.key}:${key}'`); entry.set(key, { - //date: new Date(), item: promise } as ICachedDiff); } @@ -627,7 +623,6 @@ export class GitService extends Disposable { Logger.log(`Replace diff cache with empty promise for '${entry.key}:${key}'`); entry.set(key, { - //date: new Date(), item: GitService.EmptyPromise, errorMessage: msg } as ICachedDiff); @@ -729,7 +724,7 @@ export class GitService extends Disposable { } async getLogForFile(repoPath: string | undefined, fileName: string, sha?: string, maxCount?: number, range?: Range, reverse: boolean = false): Promise { - let key: string = 'log'; + let key = 'log'; if (sha !== undefined) { key += `:${sha}`; } @@ -785,7 +780,6 @@ export class GitService extends Disposable { Logger.log(`Add log cache for '${entry.key}:${key}'`); entry.set(key, { - //date: new Date(), item: promise } as ICachedLog); } @@ -813,7 +807,6 @@ export class GitService extends Disposable { Logger.log(`Replace log cache with empty promise for '${entry.key}:${key}'`); entry.set(key, { - //date: new Date(), item: GitService.EmptyPromise, errorMessage: msg } as ICachedLog); @@ -833,7 +826,7 @@ export class GitService extends Disposable { const commitCount = log.commits.size; - const locations: Array = []; + const locations: Location[] = []; Iterables.forEach(log.commits.values(), (c, i) => { if (c.isUncommitted) return; diff --git a/src/quickPicks/commitDetails.ts b/src/quickPicks/commitDetails.ts index 0d3fbfa..62ab443 100644 --- a/src/quickPicks/commitDetails.ts +++ b/src/quickPicks/commitDetails.ts @@ -83,7 +83,7 @@ export class OpenCommitFilesCommandQuickPickItem extends OpenFilesCommandQuickPi super(uris, item || { label: `$(file-symlink-file) Open Changed Files`, description: `\u00a0 \u2014 \u00a0\u00a0 in \u00a0$(git-commit) ${commit.shortSha}` - //detail: `Opens all of the changed files in $(git-commit) ${commit.shortSha}` + // detail: `Opens all of the changed files in $(git-commit) ${commit.shortSha}` }); } } @@ -96,7 +96,7 @@ export class OpenCommitWorkingTreeFilesCommandQuickPickItem extends OpenFilesCom super(uris, item || { label: `$(file-symlink-file) Open Changed Working Files`, description: '' - //detail: `Opens all of the changed file in the working tree` + // detail: `Opens all of the changed file in the working tree` }); } } diff --git a/src/quickPicks/common.ts b/src/quickPicks/common.ts index ef15b16..10dc8ef 100644 --- a/src/quickPicks/common.ts +++ b/src/quickPicks/common.ts @@ -1,6 +1,6 @@ 'use strict'; import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, TextEditor, Uri, window, workspace } from 'vscode'; -import { Commands, Keyboard, Keys, KeyboardScope, KeyMapping, openEditor } from '../commands'; +import { Commands, Keyboard, KeyboardScope, KeyMapping, Keys, openEditor } from '../commands'; import { IAdvancedConfig } from '../configuration'; import { ExtensionKey } from '../constants'; import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService'; diff --git a/src/quickPicks/remotes.ts b/src/quickPicks/remotes.ts index 07375c5..df56bc7 100644 --- a/src/quickPicks/remotes.ts +++ b/src/quickPicks/remotes.ts @@ -30,7 +30,7 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem { constructor(remotes: GitRemote[], resource: RemoteResource, goBackCommand?: CommandQuickPickItem) { const name = getNameFromRemoteResource(resource); - let description: string = ''; + let description = ''; switch (resource.type) { case 'branch': description = `$(git-branch) ${resource.branch}`; diff --git a/src/quickPicks/repoStatus.ts b/src/quickPicks/repoStatus.ts index 724616e..2b55551 100644 --- a/src/quickPicks/repoStatus.ts +++ b/src/quickPicks/repoStatus.ts @@ -16,7 +16,7 @@ export class OpenStatusFileCommandQuickPickItem extends OpenFileCommandQuickPick directory = ''; } - let description = (status.status === 'R' && status.originalFileName) + const description = (status.status === 'R' && status.originalFileName) ? `${directory} \u00a0\u2190\u00a0 ${status.originalFileName}` : directory; @@ -46,7 +46,7 @@ export class OpenStatusFilesCommandQuickPickItem extends CommandQuickPickItem { super(item || { label: `$(file-symlink-file) Open Changed Files`, description: '' - //detail: `Opens all of the changed files in the repository` + // detail: `Opens all of the changed files in the repository` }, Commands.OpenChangedFiles, [ undefined, { @@ -211,7 +211,6 @@ export class RepoStatusQuickPick { ])); } - if (goBackCommand) { items.splice(0, 0, goBackCommand); } diff --git a/src/system/iterable.ts b/src/system/iterable.ts index 7779960..2c818d3 100644 --- a/src/system/iterable.ts +++ b/src/system/iterable.ts @@ -55,7 +55,7 @@ export namespace Iterables { } export function join(source: Iterable, separator: string): string { - let value: string = ''; + let value = ''; const iterator = source[Symbol.iterator](); let next = iterator.next(); diff --git a/src/system/object.ts b/src/system/object.ts index d0bc626..cc1029f 100644 --- a/src/system/object.ts +++ b/src/system/object.ts @@ -1,5 +1,4 @@ 'use strict'; -//import { isEqual as _isEqual } from 'lodash'; const _isEqual = require('lodash.isequal'); export namespace Objects { @@ -8,13 +7,13 @@ export namespace Objects { } export function* entries(o: any): IterableIterator<[string, any]> { - for (let key in o) { + for (const key in o) { yield [key, o[key]]; } } export function flatten(o: any, prefix: string = '', stringify: boolean = false): { [key: string]: any } { - let flattened = Object.create(null); + const flattened = Object.create(null); _flatten(flattened, prefix, o, stringify); return flattened; } @@ -37,7 +36,7 @@ export namespace Objects { } } else if (Array.isArray(value)) { - let len = value.length; + const len = value.length; for (let i = 0; i < len; i++) { _flatten(flattened, `${key}[${i}]`, value[i], stringify); } @@ -47,7 +46,7 @@ export namespace Objects { } else { let isEmpty = true; - for (let p in value) { + for (const p in value) { isEmpty = false; _flatten(flattened, key ? `${key}.${p}` : p, value[p], stringify); } diff --git a/src/system/string.ts b/src/system/string.ts index 1b4f630..e9ef1b7 100644 --- a/src/system/string.ts +++ b/src/system/string.ts @@ -1,5 +1,4 @@ 'use strict'; -//import { escapeRegExp as _escapeRegExp } from 'lodash'; const _escapeRegExp = require('lodash.escaperegexp'); export namespace Strings { diff --git a/src/telemetry.ts b/src/telemetry.ts index 330938e..a97cfae 100644 --- a/src/telemetry.ts +++ b/src/telemetry.ts @@ -1,5 +1,5 @@ 'use strict'; -import { env, Disposable, version, workspace } from 'vscode'; +import { Disposable, env, version, workspace } from 'vscode'; import * as os from 'os'; let _reporter: TelemetryReporter; diff --git a/tsconfig.json b/tsconfig.json index 9b4d849..6a41444 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "forceConsistentCasingInFileNames": true, - "lib": [ "es6" ], + "lib": [ "es2015" ], "module": "commonjs", "noFallthroughCasesInSwitch": true, "noImplicitReturns": true, @@ -12,7 +12,7 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "es6" + "target": "es2015" }, "exclude": [ "node_modules", diff --git a/tslint.json b/tslint.json index e377605..bf5beb6 100644 --- a/tslint.json +++ b/tslint.json @@ -1,22 +1,52 @@ { "rules": { - "arrow-parens": false, + "adjacent-overload-signatures": true, + "array-type": [ + true, + "array" + ], + "arrow-parens": [ + true, + "ban-single-arg-parens" + ], + "arrow-return-shorthand": true, "class-name": true, "comment-format": [ - false + true, + "check-space" + ], + "curly": [ + true, + "ignore-same-line" ], - "curly": false, "indent": [ true, "spaces" ], + "interface-over-type-literal": true, "new-parens": true, - "no-duplicate-variable": true, + "no-angle-bracket-type-assertion": true, + "no-consecutive-blank-lines": [ + true, + 1 + ], + "no-default-export": true, "no-eval": true, - "no-for-in-array": false, + // "no-for-in-array": true, + "no-inferrable-types": [ + true, + "ignore-params", + "ignore-properties" + ], "no-internal-module": true, + "no-invalid-template-strings": true, + "no-irregular-whitespace": true, "no-reference": true, + "no-string-throw": true, "no-trailing-whitespace": true, + "no-unnecessary-callback-wrapper": true, + // "no-unnecessary-qualifier": true, + // "no-unsafe-any": true, "no-unsafe-finally": true, "no-unused-expression": false, "no-var-keyword": true, @@ -35,11 +65,18 @@ "ignore-for-loop" ], "ordered-imports": [ - false, + true, { + "import-sources-order": "any", "named-imports-order": "case-insensitive" } ], + "prefer-const": true, + "prefer-for-of": true, + "prefer-template": [ + true, + "allow-single-concat" + ], "quotemark": [ true, "single", @@ -50,6 +87,16 @@ true, "always" ], + "space-before-function-paren": [ + true, + { + "anonymous": "never", + "named": "never", + "asyncArrow": "always" + } + ], + // "strict-boolean-expressions": true, + // "strict-type-predicates": true, "trailing-comma": [ true, { @@ -71,6 +118,7 @@ "variable-declaration": "nospace" } ], + "typeof-compare": true, "use-isnan": true, "variable-name": [ true,