Skip to content

Commit 63ed06f

Browse files
Chris Johnstondependabot-preview[bot]
Chris Johnston
authored andcommitted
Fixed lint issues
1 parent aacafba commit 63ed06f

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ module.exports = {
1313
'@typescript-eslint/no-non-null-assertion': 'off',
1414
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
1515
'@typescript-eslint/no-inferrable-types': 'off',
16+
'@typescript-eslint/explicit-module-boundary-types': 'off'
1617
},
1718
}

src/commands/command.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ export abstract class Command implements Disposable {
5656
this._disposable && this._disposable.dispose(); // tslint:disable-line
5757
}
5858

59-
private createRepositoryCommand(method: Function): (...args: any[]) => any {
59+
private createRepositoryCommand(
60+
method: (...args: any[]) => void
61+
): (...args: any[]) => any {
6062
const result = async (...args: any[]) => {
6163
const sourceControlManager = (await commands.executeCommand(
6264
"svn.getSourceControlManager",

src/common/types.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ export interface ICommandOptions {
2020
diff?: boolean;
2121
}
2222

23-
export interface ICommand {
24-
commandId: string;
25-
key: string;
26-
method: Function;
27-
options: ICommandOptions;
28-
}
29-
3023
export interface IConflictOption {
3124
label: string;
3225
description: string;
@@ -180,7 +173,7 @@ export interface IEntry {
180173
reposStatus?: {
181174
props: string;
182175
item: string;
183-
lock?: object;
176+
lock?: Record<string, unknown>;
184177
};
185178
}
186179

src/decorators.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import { done } from "./util";
99

1010
function decorate(
11-
decorator: (fn: Function, key: string) => Function
12-
): Function {
11+
decorator: (fn: (...args: any[]) => void, key: string) => void
12+
): (_target: any, key: string, descriptor: any) => void {
1313
return (_target: any, key: string, descriptor: any) => {
1414
let fnKey: string | null = null;
15-
let fn: Function | null = null;
15+
let fn: ((...args: any[]) => void) | null = null;
1616

1717
if (typeof descriptor.value === "function") {
1818
fnKey = "value";
@@ -30,7 +30,10 @@ function decorate(
3030
};
3131
}
3232

33-
function _memoize(fn: Function, key: string): Function {
33+
function _memoize(
34+
fn: (...args: any[]) => void,
35+
key: string
36+
): (this: any, ...args: any[]) => any {
3437
const memoizeKey = `$memoize$${key}`;
3538

3639
return function (this: any, ...args: any[]) {
@@ -49,7 +52,10 @@ function _memoize(fn: Function, key: string): Function {
4952

5053
export const memoize = decorate(_memoize);
5154

52-
function _throttle<T>(fn: Function, key: string): Function {
55+
function _throttle(
56+
fn: (...args: any[]) => void,
57+
key: string
58+
): (this: any, ...args: any[]) => any {
5359
const currentKey = `$throttle$current$${key}`;
5460
const nextKey = `$throttle$next$${key}`;
5561

@@ -67,7 +73,7 @@ function _throttle<T>(fn: Function, key: string): Function {
6773
return this[nextKey];
6874
}
6975

70-
this[currentKey] = fn.apply(this, args) as Promise<T>;
76+
this[currentKey] = fn.apply(this, args);
7177

7278
const clear = () => (this[currentKey] = undefined);
7379
done(this[currentKey]).then(clear, clear);
@@ -80,7 +86,10 @@ function _throttle<T>(fn: Function, key: string): Function {
8086

8187
export const throttle = decorate(_throttle);
8288

83-
function _sequentialize(fn: Function, key: string): Function {
89+
function _sequentialize(
90+
fn: (...args: any[]) => void,
91+
key: string
92+
): (this: any, ...args: any[]) => any {
8493
const currentKey = `__$sequence$${key}`;
8594

8695
return function (this: any, ...args: any[]) {
@@ -94,7 +103,9 @@ function _sequentialize(fn: Function, key: string): Function {
94103

95104
export const sequentialize = decorate(_sequentialize);
96105

97-
export function debounce(delay: number): Function {
106+
export function debounce(
107+
delay: number
108+
): (_target: any, key: string, descriptor: any) => void {
98109
return decorate((fn, key) => {
99110
const timerKey = `$debounce$${key}`;
100111

@@ -107,7 +118,9 @@ export function debounce(delay: number): Function {
107118

108119
const _seqList: { [key: string]: any } = {};
109120

110-
export function globalSequentialize(name: string): Function {
121+
export function globalSequentialize(
122+
name: string
123+
): (_target: any, key: string, descriptor: any) => void {
111124
return decorate((fn, _key) => {
112125
return function (this: any, ...args: any[]) {
113126
const currentPromise =

0 commit comments

Comments
 (0)