Skip to content

Commit 58e1d44

Browse files
committed
Enable more eslint rules
1 parent d4d27cf commit 58e1d44

File tree

16 files changed

+19
-20
lines changed

16 files changed

+19
-20
lines changed

src/LuaAST.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export function createNode(kind: SyntaxKind, tsOriginal?: ts.Node): Node {
145145
}
146146

147147
export function cloneNode<T extends Node>(node: T): T {
148-
return Object.assign({}, node);
148+
return { ...node };
149149
}
150150

151151
export function setNodePosition<T extends Node>(node: T, position: TextRange): T {

src/LuaPrinter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const escapeString = (value: string) => `"${value.replace(escapeStringReg
3131
* `foo.bar` => passes (`function foo.bar()` is valid)
3232
* `getFoo().bar` => fails (`function getFoo().bar()` would be illegal)
3333
*/
34-
const isValidLuaFunctionDeclarationName = (str: string) => /^[a-zA-Z0-9_\.]+$/.test(str);
34+
const isValidLuaFunctionDeclarationName = (str: string) => /^[a-zA-Z0-9_.]+$/.test(str);
3535

3636
/**
3737
* Returns true if expression contains no function calls.
@@ -217,7 +217,7 @@ export class LuaPrinter {
217217
}
218218

219219
protected pushIndent(): void {
220-
this.currentIndent = this.currentIndent + " ";
220+
this.currentIndent += " ";
221221
}
222222

223223
protected popIndent(): void {

src/lualib/ArrayFind.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function __TS__ArrayFind<T>(
1111
if (predicate(elem, k, arr)) {
1212
return elem;
1313
}
14-
k = k + 1;
14+
k += 1;
1515
}
1616

1717
return undefined;

src/lualib/ArrayReduceRight.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function __TS__ArrayReduceRight<T>(
1515
accumulator = select(1, ...initial);
1616
} else if (len > 0) {
1717
accumulator = arr[k];
18-
k = k - 1;
18+
k -= 1;
1919
} else {
2020
throw "Reduce of empty array with no initial value";
2121
}

src/lualib/ArrayReverse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ function __TS__ArrayReverse(this: void, arr: any[]): any[] {
55
const temp = arr[j];
66
arr[j] = arr[i];
77
arr[i] = temp;
8-
i = i + 1;
9-
j = j - 1;
8+
i += 1;
9+
j -= 1;
1010
}
1111
return arr;
1212
}

src/lualib/InstanceOf.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function __TS__InstanceOf(this: void, obj: LuaClassInstance, classTbl: LuaClass)
44
}
55

66
if (classTbl[Symbol.hasInstance] !== undefined) {
7+
// eslint-disable-next-line no-implicit-coercion
78
return !!classTbl[Symbol.hasInstance](obj);
89
}
910

src/lualib/Iterator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function __TS__Iterator<T>(this: void, iterable: Iterable<T>): (this: void) => T
1212
} else {
1313
let i = 0;
1414
return () => {
15-
i = i + 1;
15+
i += 1;
1616
return iterable[i];
1717
};
1818
}

src/lualib/Map.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Map = class Map<K, V> {
4242
this.firstKey = undefined;
4343
this.lastKey = undefined;
4444
this.size = 0;
45-
return;
4645
}
4746

4847
public delete(key: K): boolean {
@@ -79,7 +78,6 @@ Map = class Map<K, V> {
7978
for (const key of this.keys()) {
8079
callback(this.items.get(key), key, this);
8180
}
82-
return;
8381
}
8482

8583
public get(key: K): V | undefined {

src/lualib/Set.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Set = class Set<T> {
5656
this.firstKey = undefined;
5757
this.lastKey = undefined;
5858
this.size = 0;
59-
return;
6059
}
6160

6261
public delete(value: T): boolean {

src/lualib/StringConcat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function __TS__StringConcat(this: void, str1: string, ...args: string[]): string {
22
let out = str1;
33
for (const arg of args) {
4-
out = out + arg;
4+
out += arg;
55
}
66
return out;
77
}

0 commit comments

Comments
 (0)