mirror of
https://github.com/Microsoft/vscode
synced 2024-10-30 11:10:48 +00:00
Enable strict compilation settings in git extension
Enables strict checks in the git extensions
This commit is contained in:
parent
00ca96b766
commit
b743e245ad
7 changed files with 17 additions and 16 deletions
|
@ -902,6 +902,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/mocha": "2.2.43",
|
"@types/mocha": "2.2.43",
|
||||||
"@types/node": "7.0.43",
|
"@types/node": "7.0.43",
|
||||||
|
"@types/byline": "4.2.31",
|
||||||
"mocha": "^3.2.0"
|
"mocha": "^3.2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1384,7 +1384,7 @@ export class CommandCenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private createCommand(id: string, key: string, method: Function, options: CommandOptions): (...args: any[]) => any {
|
private createCommand(id: string, key: string, method: Function, options: CommandOptions): (...args: any[]) => any {
|
||||||
const result = (...args) => {
|
const result = (...args: any[]) => {
|
||||||
let result: Promise<any>;
|
let result: Promise<any>;
|
||||||
|
|
||||||
if (!options.repository) {
|
if (!options.repository) {
|
||||||
|
@ -1433,7 +1433,7 @@ export class CommandCenter {
|
||||||
.replace(/^error: /mi, '')
|
.replace(/^error: /mi, '')
|
||||||
.replace(/^> husky.*$/mi, '')
|
.replace(/^> husky.*$/mi, '')
|
||||||
.split(/[\r\n]/)
|
.split(/[\r\n]/)
|
||||||
.filter(line => !!line)
|
.filter((line: any) => !!line)
|
||||||
[0];
|
[0];
|
||||||
|
|
||||||
message = hint
|
message = hint
|
||||||
|
@ -1459,7 +1459,7 @@ export class CommandCenter {
|
||||||
};
|
};
|
||||||
|
|
||||||
// patch this object, so people can call methods directly
|
// patch this object, so people can call methods directly
|
||||||
this[key] = result;
|
(this as any)[key] = result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ function decorate(decorator: (fn: Function, key: string) => Function): Function
|
||||||
function _memoize(fn: Function, key: string): Function {
|
function _memoize(fn: Function, key: string): Function {
|
||||||
const memoizeKey = `$memoize$${key}`;
|
const memoizeKey = `$memoize$${key}`;
|
||||||
|
|
||||||
return function (...args: any[]) {
|
return function (this: any, ...args: any[]) {
|
||||||
if (!this.hasOwnProperty(memoizeKey)) {
|
if (!this.hasOwnProperty(memoizeKey)) {
|
||||||
Object.defineProperty(this, memoizeKey, {
|
Object.defineProperty(this, memoizeKey, {
|
||||||
configurable: false,
|
configurable: false,
|
||||||
|
@ -51,7 +51,7 @@ function _throttle<T>(fn: Function, key: string): Function {
|
||||||
const currentKey = `$throttle$current$${key}`;
|
const currentKey = `$throttle$current$${key}`;
|
||||||
const nextKey = `$throttle$next$${key}`;
|
const nextKey = `$throttle$next$${key}`;
|
||||||
|
|
||||||
const trigger = function (...args: any[]) {
|
const trigger = function (this: any, ...args: any[]) {
|
||||||
if (this[nextKey]) {
|
if (this[nextKey]) {
|
||||||
return this[nextKey];
|
return this[nextKey];
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ export const throttle = decorate(_throttle);
|
||||||
function _sequentialize<T>(fn: Function, key: string): Function {
|
function _sequentialize<T>(fn: Function, key: string): Function {
|
||||||
const currentKey = `__$sequence$${key}`;
|
const currentKey = `__$sequence$${key}`;
|
||||||
|
|
||||||
return function (...args: any[]) {
|
return function (this: any, ...args: any[]) {
|
||||||
const currentPromise = this[currentKey] as Promise<any> || Promise.resolve(null);
|
const currentPromise = this[currentKey] as Promise<any> || Promise.resolve(null);
|
||||||
const run = async () => await fn.apply(this, args);
|
const run = async () => await fn.apply(this, args);
|
||||||
this[currentKey] = currentPromise.then(run, run);
|
this[currentKey] = currentPromise.then(run, run);
|
||||||
|
@ -95,7 +95,7 @@ export function debounce(delay: number): Function {
|
||||||
return decorate((fn, key) => {
|
return decorate((fn, key) => {
|
||||||
const timerKey = `$debounce$${key}`;
|
const timerKey = `$debounce$${key}`;
|
||||||
|
|
||||||
return function (...args: any[]) {
|
return function (this: any, ...args: any[]) {
|
||||||
clearTimeout(this[timerKey]);
|
clearTimeout(this[timerKey]);
|
||||||
this[timerKey] = setTimeout(() => fn.apply(this, args), delay);
|
this[timerKey] = setTimeout(() => fn.apply(this, args), delay);
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ async function init(context: ExtensionContext, disposables: Disposable[]): Promi
|
||||||
|
|
||||||
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
|
outputChannel.appendLine(localize('using git', "Using git {0} from {1}", info.version, info.path));
|
||||||
|
|
||||||
const onOutput = str => outputChannel.append(str);
|
const onOutput = (str: string) => outputChannel.append(str);
|
||||||
git.onOutput.addListener('log', onOutput);
|
git.onOutput.addListener('log', onOutput);
|
||||||
disposables.push(toDisposable(() => git.onOutput.removeListener('log', onOutput)));
|
disposables.push(toDisposable(() => git.onOutput.removeListener('log', onOutput)));
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ export class Resource implements SourceControlResourceState {
|
||||||
get original(): Uri { return this._resourceUri; }
|
get original(): Uri { return this._resourceUri; }
|
||||||
get renameResourceUri(): Uri | undefined { return this._renameResourceUri; }
|
get renameResourceUri(): Uri | undefined { return this._renameResourceUri; }
|
||||||
|
|
||||||
private static Icons = {
|
private static Icons: any = {
|
||||||
light: {
|
light: {
|
||||||
Modified: getIconUri('status-modified', 'light'),
|
Modified: getIconUri('status-modified', 'light'),
|
||||||
Added: getIconUri('status-added', 'light'),
|
Added: getIconUri('status-added', 'light'),
|
||||||
|
@ -724,7 +724,7 @@ export class Repository implements Disposable {
|
||||||
|
|
||||||
const child = this.repository.stream(['check-ignore', ...filePaths]);
|
const child = this.repository.stream(['check-ignore', ...filePaths]);
|
||||||
|
|
||||||
const onExit = exitCode => {
|
const onExit = (exitCode: number) => {
|
||||||
if (exitCode === 1) {
|
if (exitCode === 1) {
|
||||||
// nothing ignored
|
// nothing ignored
|
||||||
resolve(new Set<string>());
|
resolve(new Set<string>());
|
||||||
|
|
|
@ -84,7 +84,7 @@ export function once(fn: (...args: any[]) => any): (...args: any[]) => any {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function assign<T>(destination: T, ...sources: any[]): T {
|
export function assign<T>(destination: T, ...sources: (keyof T)[]): T {
|
||||||
for (const source of sources) {
|
for (const source of sources) {
|
||||||
Object.keys(source).forEach(key => destination[key] = source[key]);
|
Object.keys(source).forEach(key => destination[key] = source[key]);
|
||||||
}
|
}
|
||||||
|
@ -115,12 +115,12 @@ export function groupBy<T>(arr: T[], fn: (el: T) => string): { [key: string]: T[
|
||||||
}, Object.create(null));
|
}, Object.create(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function denodeify<R>(fn: Function): (...args) => Promise<R> {
|
export function denodeify<R>(fn: Function): (...args: any[]) => Promise<R> {
|
||||||
return (...args) => new Promise<R>((c, e) => fn(...args, (err, r) => err ? e(err) : c(r)));
|
return (...args) => new Promise<R>((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r)));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function nfcall<R>(fn: Function, ...args): Promise<R> {
|
export function nfcall<R>(fn: Function, ...args: any[]): Promise<R> {
|
||||||
return new Promise<R>((c, e) => fn(...args, (err, r) => err ? e(err) : c(r)));
|
return new Promise<R>((c, e) => fn(...args, (err: any, r: any) => err ? e(err) : c(r)));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function mkdirp(path: string, mode?: number): Promise<boolean> {
|
export async function mkdirp(path: string, mode?: number): Promise<boolean> {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
],
|
],
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"outDir": "./out",
|
"outDir": "./out",
|
||||||
"strictNullChecks": true,
|
"strict": true,
|
||||||
"experimentalDecorators": true
|
"experimentalDecorators": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
|
Loading…
Reference in a new issue