Skip to content

Commit 5f72d43

Browse files
committed
Fixed some linting issues
1 parent b83de62 commit 5f72d43

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/CommandLineParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function parseCommandLine(args: string[]): ParsedCommandLine {
102102

103103
function addTSTLOptions(commandLine: ts.ParsedCommandLine,
104104
additionalArgs?: yargs.Arguments,
105-
forceOverride?: boolean) {
105+
forceOverride?: boolean): void {
106106
additionalArgs = additionalArgs ? additionalArgs : commandLine.raw;
107107
// Add compiler options that are ignored by TS parsers
108108
if (additionalArgs) {
@@ -116,7 +116,7 @@ function addTSTLOptions(commandLine: ts.ParsedCommandLine,
116116
}
117117

118118
/** Check the current state of the ParsedCommandLine for errors */
119-
function runDiagnostics(commandLine: ts.ParsedCommandLine) {
119+
function runDiagnostics(commandLine: ts.ParsedCommandLine): void {
120120
// Remove files that dont exist
121121
commandLine.fileNames = commandLine.fileNames.filter(file => fs.existsSync(file) || fs.existsSync(file + ".ts"));
122122

@@ -154,7 +154,7 @@ function runDiagnostics(commandLine: ts.ParsedCommandLine) {
154154
}
155155

156156
/** Find configFile, function from ts api seems to be broken? */
157-
export function findConfigFile(commandLine: ts.ParsedCommandLine) {
157+
export function findConfigFile(commandLine: ts.ParsedCommandLine): void {
158158
if (!commandLine.options.project) {
159159
throw new CLIError(`error no base path provided, could not find config.`);
160160
}

src/Compiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { LuaTranspiler53 } from "./targets/Transpiler.53";
99
import { LuaTranspilerJIT } from "./targets/Transpiler.JIT";
1010
import { LuaLibImportKind, LuaTarget, LuaTranspiler, TranspileError } from "./Transpiler";
1111

12-
export function compile(argv: string[]) {
12+
export function compile(argv: string[]): void {
1313
const commandLine = parseCommandLine(argv);
1414
compileFilesWithOptions(commandLine.fileNames, commandLine.options);
1515
}

src/TSHelper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as ts from "typescript";
33
export class TSHelper {
44

55
// Reverse lookup of enum key by value
6-
public static enumName(needle, haystack) {
6+
public static enumName(needle, haystack): string {
77
for (const name in haystack) {
88
if (haystack[name] === needle) {
99
return name;
@@ -13,7 +13,7 @@ export class TSHelper {
1313
}
1414

1515
// Breaks down a mask into all flag names.
16-
public static enumNames(mask, haystack) {
16+
public static enumNames(mask, haystack): string[] {
1717
const result = [];
1818
for (const name in haystack) {
1919
if ((mask & haystack[name]) !== 0 && mask >= haystack[name]) {
@@ -41,7 +41,7 @@ export class TSHelper {
4141
return undefined;
4242
}
4343

44-
public static isFileModule(sourceFile: ts.SourceFile) {
44+
public static isFileModule(sourceFile: ts.SourceFile): boolean {
4545
if (sourceFile) {
4646
// Vanilla ts flags files as external module if they have an import or
4747
// export statement, we only check for export statements
@@ -53,7 +53,7 @@ export class TSHelper {
5353
return false;
5454
}
5555

56-
public static isInDestructingAssignment(node: ts.Node) {
56+
public static isInDestructingAssignment(node: ts.Node): boolean {
5757
return node.parent && ts.isVariableDeclaration(node.parent) && ts.isArrayBindingPattern(node.parent.name);
5858
}
5959

src/Transpiler.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,8 @@ export abstract class LuaTranspiler {
12591259
return "__";
12601260
} else if (ts.isIdentifier(name)) {
12611261
return this.transpileIdentifier(name);
1262+
} else if (ts.isBindingElement(name) && ts.isIdentifier(name.name)) {
1263+
return this.transpileIdentifier(name.name);
12621264
} else {
12631265
const kind = tsHelper.enumName(name.kind, ts.SyntaxKind);
12641266
throw new TranspileError(`Encountered not-supported array binding element kind: ${kind}`, name);
@@ -1303,7 +1305,7 @@ export abstract class LuaTranspiler {
13031305
throw new TranspileError(`Ellipsis destruction is not allowed.`, node);
13041306
}
13051307

1306-
const vars = node.name.elements.map(this.transpileArrayBindingElement).join(",");
1308+
const vars = node.name.elements.map(e => this.transpileArrayBindingElement(e)).join(",");
13071309

13081310
// Don't unpack TupleReturn decorated functions
13091311
if (tsHelper.isTupleReturnCall(node.initializer, this.checker)) {

0 commit comments

Comments
 (0)