Skip to content

Commit f7b9bc0

Browse files
committed
Added linter
1 parent e1aeae6 commit f7b9bc0

28 files changed

+662
-638
lines changed

package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"license": "MIT",
1717
"types": "./dist/index.d.ts",
1818
"scripts": {
19-
"build": "rm -fR ./dist && tsc",
19+
"lint": "./node_modules/.bin/tslint -p ./tsconfig.json --fix",
20+
"build": "rm -fR ./dist ./temp && tsc && yarn lint",
2021
"watch": "rm -fR ./dist && tsc -w ",
2122
"fiddle": "node ./dist/fiddle.js",
2223
"test": "jest --detectOpenHandles",
@@ -29,10 +30,11 @@
2930
},
3031
"devDependencies": {
3132
"@blendsdk/git": "^1.0.3",
32-
"@types/jest": "^24.0.15",
33-
"@types/node": "^12.0.12",
34-
"jest": "^24.8.0",
33+
"@types/jest": "^24.0.18",
34+
"@types/node": "^12.7.2",
35+
"jest": "^24.9.0",
3536
"ts-jest": "^24.0.2",
36-
"typescript": "^3.5.2"
37+
"tslint": "^5.19.0",
38+
"typescript": "^3.5.3"
3739
}
3840
}

src/ID.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ export function ID(): number {
1111
const r = a;
1212
return r;
1313
})(_ID++);
14-
}
14+
}

src/argumentsToArray.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export function argumentsToArray(args: IArguments): any[] {
1313
result.push(item);
1414
});
1515
return result;
16-
}
16+
}

src/asyncForEach.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ export async function asyncForEach<T extends any>(array: T[], asyncCallback: (it
1010
for (let index = 0; index < array.length; index++) {
1111
await asyncCallback(array[index], index, array);
1212
}
13-
}
13+
}

src/camelCase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export function camelCase(value: string): string {
1515
return ucFirst(itm);
1616
})
1717
.join("");
18-
}
18+
}

src/dashedCase.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
*/
99
export function dashedCase(value: string): string {
1010
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
11-
}
11+
}

src/debounce.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { TFunction } from "./types";
1818
export function debounce(delay: number, callback: TFunction, scope?: any, immediate?: boolean): TFunction {
1919
let timeout: any;
2020
immediate = immediate || false;
21-
return function () {
21+
return function() {
2222
const me = this;
2323
scope = scope || me;
2424
const args = arguments;

src/delay.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export function delay(ms: number, callback: TFunction, scope?: any) {
1414
setTimeout(() => {
1515
callback.apply(scope, []);
1616
}, ms);
17-
}
17+
}

src/ensureBoolean.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function ensureBoolean(value: any): boolean {
99
return value === true ? true : false;
10-
}
10+
}

src/forEach.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { isInstanceOf } from "./isInstanceOf";
2-
import { isFunction } from "./isFunction";
31
import { isArray } from "./isArray";
2+
import { isFunction } from "./isFunction";
3+
import { isInstanceOf } from "./isInstanceOf";
44

55
/**
66
* Loops though the given object (array, dictionary, NodeList, HTMLCollection) and runs

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ export * from "./asyncForEach";
2525
export * from "./ucFirst";
2626
export * from "./camelCase";
2727
export * from "./ensureFilePath";
28-
export * from "./ensureFolder";
28+
export * from "./ensureFolder";

src/isArray.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isArray(value: any): boolean {
99
return Object.prototype.toString.apply(value) === "[object Array]";
10-
}
10+
}

src/isBoolean.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isBoolean(value: any): boolean {
99
return typeof value === "boolean";
10-
}
10+
}

src/isClass.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export function isClass(clazz: any): boolean {
1414
isObject((clazz as any).prototype) &&
1515
isFunction((clazz.prototype as any).constructor)
1616
);
17-
}
17+
}

src/isDate.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isDate(value: any): boolean {
99
return Object.prototype.toString.apply(value) === "[object Date]";
10-
}
10+
}

src/isFunction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isFunction(value: any): boolean {
99
return typeof value === "function";
10-
}
10+
}

src/isInstanceOf.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export function isInstanceOf(obj: any, clazz: any): boolean {
3535
return false;
3636
}
3737
}
38-
}
38+
}

src/isNullOrUndef.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ export function isNullOrUndef(value: any): boolean {
2121
*/
2222
export function isNullOrUndefDefault<ReturnType>(value: ReturnType, defaultValue: ReturnType): ReturnType {
2323
return isNullOrUndef(value) ? defaultValue : value;
24-
}
24+
}

src/isNumeric.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isNumeric(value: any): boolean {
99
return Object.prototype.toString.apply(value) === "[object Number]";
10-
}
10+
}

src/isObject.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { isRegExp } from "./isRegExp";
2-
import { isClass } from "./isClass";
31
import { isArray } from "./isArray";
2+
import { isClass } from "./isClass";
3+
import { isRegExp } from "./isRegExp";
44

55
/**
66
* Tests whether the given value is an object.
@@ -19,4 +19,4 @@ export function isObject(value: any): boolean {
1919
!isClass(value) &&
2020
!isArray(value))
2121
);
22-
}
22+
}

src/isRegExp.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isRegExp(value: any): boolean {
99
return value instanceof RegExp;
10-
}
10+
}

src/isString.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function isString(value: any): boolean {
99
return typeof value === "string";
10-
}
10+
}

src/random.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
*/
99
export function random(min: number, max: number): number {
1010
return Math.floor(Math.random() * max + min);
11-
}
11+
}

src/shallowClone.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ export function shallowClone(src: any): any {
2424
}
2525
}
2626
return dst;
27-
}
27+
}

src/types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export type TFunction = (...args: any[]) => any;
1010
* @interface IDictionary
1111
*/
1212
export interface IDictionary {
13-
[key: string]: any
13+
[key: string]: any;
1414
}
1515

1616
/**
@@ -21,5 +21,5 @@ export interface IDictionary {
2121
* @template T
2222
*/
2323
export interface IDictionaryOf<T> {
24-
[key: string]: T
25-
}
24+
[key: string]: T;
25+
}

src/ucFirst.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
*/
88
export function ucFirst(value: string): string {
99
return value.charAt(0).toUpperCase() + value.slice(1);
10-
}
10+
}

src/wrapInArray.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ import { isNullOrUndef } from "./isNullOrUndef";
1111
*/
1212
export function wrapInArray<T>(obj: any): T[] {
1313
return isArray(obj) ? obj : isNullOrUndef(obj) ? [] : [obj];
14-
}
14+
}

0 commit comments

Comments
 (0)