Skip to content

Commit 94e0f67

Browse files
committed
run lint
1 parent f6255e2 commit 94e0f67

File tree

72 files changed

+264
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+264
-218
lines changed

_unused.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@
1818
// // Should not work - but sadly, there isnt much we can do!
1919
// let z = new Vector2();
2020

21-
2221
// class NodeExtender extends Node2D {
2322

2423
// }
2524

26-
27-
28-
2925
// // Should work
3026
// let yee = Test("Hello");
3127
// let yee2 = new Test();
@@ -43,12 +39,11 @@
4339
// // Should not work - but sadly, there isnt much we can do!
4440
// let aaz = new Vector2();
4541

46-
4742
// // class Testing {
4843
// // static stupid = 1;
4944
// // stupider = 2;
5045
// // }
5146

5247
// // // This should have statics + call signatures
5348
// // declare const Test: (typeof Testing) & Funky;
54-
// // declare type Test = Testing;
49+
// // declare type Test = Testing;

bin/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env node
22

3-
require('../js/main.js')
3+
require("../js/main.js")

check_version.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import packageJson from "./package.json"
21
import https from "https"
2+
33
import chalk from "chalk"
44

5+
import packageJson from "./package.json"
6+
57
export const checkVersionAsync = async () => {
68
console.info(chalk.whiteBright("ts2gd", "v" + packageJson.version))
79

errors.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import chalk from "chalk"
22
import ts from "typescript"
3+
34
import { ParsedArgs } from "./parse_args"
45

56
export enum ErrorName {

generate_library_defs/generate_base.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import fs from "fs"
22
import path from "path"
3+
4+
import { TsGdProjectClass } from "../project/project"
5+
36
import { ArrayDefinition } from "./custom_defs/array_def"
47
import { DictionaryDefinition } from "./custom_defs/dictionary_def"
58
import { PackedSceneDef } from "./custom_defs/packed_scene_def"
6-
import { TsGdProjectClass } from "../project/project"
79

810
export const baseFileContent = `
911

generate_library_defs/generate_gdscript_lib.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import fs from "fs"
2+
23
import { parseStringPromise } from "xml2js"
4+
35
import {
46
formatJsDoc,
57
godotTypeToTsType,
@@ -152,7 +154,7 @@ export const parseMethod = (
152154
containingClassName !== undefined && name === containingClassName
153155
const docString = formatJsDoc(method.description[0].trim())
154156
let returnType = godotTypeToTsType(method.return?.[0]["$"].type ?? "Variant")
155-
let argumentList: string = ""
157+
let argumentList = ""
156158

157159
if (args || isVarArgs) {
158160
if (isVarArgs) {

generate_library_defs/generate_library.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
import fs from "fs"
22
import path from "path"
3+
34
import { parseStringPromise } from "xml2js"
5+
46
import { TsGdProjectClass } from "../project/project"
57
import { copyFolderRecursiveSync } from "../ts_utils"
6-
import { buildBase as writeBaseDefinitions } from "./generate_base"
8+
79
import {
8-
generateGdscriptLib,
910
GodotXMLMethod,
11+
generateGdscriptLib,
1012
parseMethod,
1113
} from "./generate_gdscript_lib"
14+
import { buildBase as writeBaseDefinitions } from "./generate_base"
1215

1316
export function sanitizeGodotNameForTs(
1417
name: string,
@@ -86,7 +89,7 @@ export function godotTypeToTsType(godotType: string): string {
8689
return "NodePathType"
8790
}
8891

89-
if (!!godotType.match(/^[0-9]+$/)) {
92+
if (godotType.match(/^[0-9]+$/)) {
9093
return "int"
9194
}
9295

main.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,16 @@
150150

151151
// [x]: a better signal API would just be this.signal.connect(() => { stuff }) - we should get rid of all the other stuff.
152152

153-
import ts from "typescript"
154153
import * as process from "process"
155154

156-
import packageJson from "./package.json"
157-
import { makeTsGdProject } from "./project/project"
155+
import ts from "typescript"
156+
import chalk from "chalk"
157+
158+
import { ParsedArgs, parseArgs, printHelp } from "./parse_args"
158159
import { Paths } from "./project/tsgd_json"
159160
import { checkVersionAsync } from "./check_version"
160-
import { ParsedArgs, parseArgs, printHelp } from "./parse_args"
161-
import chalk from "chalk"
161+
import { makeTsGdProject } from "./project/project"
162+
import packageJson from "./package.json"
162163

163164
const setup = (tsgdJson: Paths) => {
164165
const formatHost: ts.FormatDiagnosticsHost = {

parse_node.ts

+42-41
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,69 @@
11
import * as utils from "tsutils"
22
import ts, { SyntaxKind, tokenToString } from "typescript"
3-
import { parseImportDeclaration } from "./parse_node/parse_import_declaration"
4-
import { parseBinaryExpression } from "./parse_node/parse_binary_expression"
5-
import { parseSourceFile } from "./parse_node/parse_source_file"
3+
4+
import { AssetSourceFile } from "./project/assets/asset_source_file"
5+
import { ErrorName, TsGdError, addError } from "./errors"
6+
import { LibraryFunctionName } from "./parse_node/library_functions"
7+
import { Scope } from "./scope"
8+
import { TsGdProjectClass } from "./project/project"
69
import {
710
generatePrecedingNewlines,
811
syntaxKindToString as kindToString,
912
syntaxKindToString,
1013
} from "./ts_utils"
11-
import { parseTypeReference } from "./parse_node/parse_type_reference"
12-
import { parseNumericLiteral } from "./parse_node/parse_numeric_literal"
1314
import { parseArrayLiteralExpression } from "./parse_node/parse_array_literal_expression"
14-
import { parseNewExpression } from "./parse_node/parse_new_expression"
15-
import { parsePostfixUnaryExpression } from "./parse_node/parse_postfix_unary_expression"
16-
import { parseIfStatement } from "./parse_node/parse_if_statement"
15+
import { parseArrowFunction } from "./parse_node/parse_arrow_function"
16+
import { parseBinaryExpression } from "./parse_node/parse_binary_expression"
17+
import { parseBlock } from "./parse_node/parse_block"
18+
import { parseBreakStatement } from "./parse_node/parse_break_statement"
19+
import { parseCallExpression } from "./parse_node/parse_call_expression"
1720
import {
18-
parseSwitchCaseBlock,
1921
parseCaseClause,
2022
parseDefaultClause,
23+
parseSwitchCaseBlock,
2124
parseSwitchStatement,
2225
} from "./parse_node/parse_switch_statement"
23-
import { parsePrefixUnaryExpression } from "./parse_node/parse_prefix_unary_expression"
24-
import { parseObjectLiteralExpression } from "./parse_node/parse_object_literal_expression"
26+
import { parseClassDeclaration } from "./parse_node/parse_class_declaration"
27+
import { parseConditionalExpression } from "./parse_node/parse_conditional_expression"
2528
import { parseConstructor } from "./parse_node/parse_constructor"
26-
import { parseThisKeyword } from "./parse_node/parse_this_keyword"
27-
import { parseSuperKeyword } from "./parse_node/parse_super_keyword"
28-
import { parseVariableDeclarationList } from "./parse_node/parse_variable_declaration_list"
29+
import { parseContinueStatement } from "./parse_node/parse_continue_statement"
30+
import { parseElementAccessExpression } from "./parse_node/parse_element_access_expression"
31+
import { parseEmptyStatement } from "./parse_node/parse_empty_statement"
2932
import { parseEnumDeclaration } from "./parse_node/parse_enum_declaration"
30-
import { parseVariableDeclaration } from "./parse_node/parse_variable_declaration"
3133
import { parseExpressionStatement } from "./parse_node/parse_expression_statement"
32-
import { parseStringLiteral } from "./parse_node/parse_string_literal"
33-
import { parseIdentifier } from "./parse_node/parse_identifier"
34-
import { parseParenthesizedExpression } from "./parse_node/parse_parenthesized_expression"
35-
import { parseElementAccessExpression } from "./parse_node/parse_element_access_expression"
36-
import { parseParameter } from "./parse_node/parse_parameter"
37-
import { parseMethodDeclaration } from "./parse_node/parse_method_declaration"
3834
import { parseForInStatement } from "./parse_node/parse_for_in_statement"
3935
import { parseForOfStatement } from "./parse_node/parse_for_of_statement"
4036
import { parseForStatement } from "./parse_node/parse_for_statement"
41-
import { parseWhileStatement } from "./parse_node/parse_while_statement"
37+
import { parseGetAccessor } from "./parse_node/parse_get_accessor"
38+
import { parseIdentifier } from "./parse_node/parse_identifier"
39+
import { parseIfStatement } from "./parse_node/parse_if_statement"
40+
import { parseImportDeclaration } from "./parse_node/parse_import_declaration"
41+
import { parseMethodDeclaration } from "./parse_node/parse_method_declaration"
42+
import { parseNewExpression } from "./parse_node/parse_new_expression"
43+
import { parseNoSubstitutionTemplateLiteral } from "./parse_node/parse_no_substitution_template_expression"
44+
import { parseNumericLiteral } from "./parse_node/parse_numeric_literal"
45+
import { parseObjectLiteralExpression } from "./parse_node/parse_object_literal_expression"
46+
import { parseParameter } from "./parse_node/parse_parameter"
47+
import { parseParenthesizedExpression } from "./parse_node/parse_parenthesized_expression"
48+
import { parsePostfixUnaryExpression } from "./parse_node/parse_postfix_unary_expression"
49+
import { parsePrefixUnaryExpression } from "./parse_node/parse_prefix_unary_expression"
50+
import { parsePropertyAccessExpression } from "./parse_node/parse_property_access_expression"
4251
import { parsePropertyDeclaration } from "./parse_node/parse_property_declaration"
43-
import { parseYieldExpression } from "./parse_node/parse_yield_expression"
4452
import { parseReturnStatement } from "./parse_node/parse_return_statement"
45-
import { parseBreakStatement } from "./parse_node/parse_break_statement"
46-
import { parseBlock } from "./parse_node/parse_block"
47-
import { parseCallExpression } from "./parse_node/parse_call_expression"
48-
import { parseVariableStatement } from "./parse_node/parse_variable_statement"
4953
import { parseSetAccessor } from "./parse_node/parse_set_accessor"
50-
import { parseGetAccessor } from "./parse_node/parse_get_accessor"
51-
import { parseContinueStatement } from "./parse_node/parse_continue_statement"
54+
import { parseSourceFile } from "./parse_node/parse_source_file"
55+
import { parseStringLiteral } from "./parse_node/parse_string_literal"
56+
import { parseSuperKeyword } from "./parse_node/parse_super_keyword"
57+
import { parseTemplateExpression } from "./parse_node/parse_template_expression"
58+
import { parseThisKeyword } from "./parse_node/parse_this_keyword"
5259
import { parseTypeAliasDeclaration } from "./parse_node/parse_type_alias_declaration"
53-
import { parsePropertyAccessExpression } from "./parse_node/parse_property_access_expression"
54-
import { parseClassDeclaration } from "./parse_node/parse_class_declaration"
55-
import { parseEmptyStatement } from "./parse_node/parse_empty_statement"
56-
import { parseConditionalExpression } from "./parse_node/parse_conditional_expression"
57-
import { parseArrowFunction } from "./parse_node/parse_arrow_function"
60+
import { parseTypeReference } from "./parse_node/parse_type_reference"
5861
import { parseTypeofExpression } from "./parse_node/parse_typeof_expression"
59-
import { TsGdProjectClass } from "./project/project"
60-
import { Scope } from "./scope"
61-
import { addError, ErrorName, TsGdError } from "./errors"
62-
import { parseTemplateExpression } from "./parse_node/parse_template_expression"
63-
import { parseNoSubstitutionTemplateLiteral } from "./parse_node/parse_no_substitution_template_expression"
64-
import { AssetSourceFile } from "./project/assets/asset_source_file"
65-
import { LibraryFunctionName } from "./parse_node/library_functions"
62+
import { parseVariableDeclaration } from "./parse_node/parse_variable_declaration"
63+
import { parseVariableDeclarationList } from "./parse_node/parse_variable_declaration_list"
64+
import { parseVariableStatement } from "./parse_node/parse_variable_statement"
65+
import { parseWhileStatement } from "./parse_node/parse_while_statement"
66+
import { parseYieldExpression } from "./parse_node/parse_yield_expression"
6667

6768
export type ParseState = {
6869
isConstructor: boolean

parse_node/parse_array_literal_expression.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts from "typescript"
2-
import { ParseState, parseNode, combine } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine, parseNode } from "../parse_node"
44
import { Test } from "../tests/test"
55

66
export const parseArrayLiteralExpression = (

parse_node/parse_arrow_function.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import ts, { SyntaxKind } from "typescript"
2-
import { addError, ErrorName } from "../errors"
3-
import { combine, ParseState } from "../parse_node"
4-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ErrorName, addError } from "../errors"
4+
import { ParseNodeType, ParseState, combine } from "../parse_node"
55

66
/**
77
* Get all identifiers in a scope that were declared in an enclosing scope.

parse_node/parse_binary_expression.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts, { SyntaxKind } from "typescript"
2-
import { ParseState, combine } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44
import { Test } from "../tests/test"
55

66
export const parseBinaryExpression = (

parse_node/parse_block.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts from "typescript"
2-
import { combine, ParseState } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44

55
export const parseBlock = (
66
node: ts.Block,

parse_node/parse_break_statement.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts from "typescript"
2-
import { combine, ParseState } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44
import { Test } from "../tests/test"
55

66
export const parseBreakStatement = (

parse_node/parse_call_expression.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import ts, { SyntaxKind } from "typescript"
2-
import { addError, ErrorName } from "../errors"
2+
3+
import { ErrorName, addError } from "../errors"
34
import {
4-
combine,
55
ExtraLine,
66
ExtraLineType,
7-
parseNode,
87
ParseState,
8+
combine,
9+
parseNode,
10+
ParseNodeType,
911
} from "../parse_node"
10-
import { ParseNodeType } from "../parse_node"
1112
import { Test } from "../tests/test"
1213
import { isArrayType, isDictionary, isNullableNode } from "../ts_utils"
14+
1315
import { LibraryFunctionName, LibraryFunctions } from "./library_functions"
1416
import { getCapturedScope } from "./parse_arrow_function"
1517

parse_node/parse_class_declaration.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import ts, { SyntaxKind } from "typescript"
2-
import { addError, ErrorName } from "../errors"
3-
import { ParseState, combine } from "../parse_node"
4-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ErrorName, addError } from "../errors"
4+
import { ParseNodeType, ParseState, combine } from "../parse_node"
55
import { Test } from "../tests/test"
66
import { getGodotType } from "../ts_utils"
7+
78
import {
89
isDecoratedAsExportFlags,
910
isDecoratedAsExports,
10-
parseExports,
1111
parseExportFlags,
12+
parseExports,
1213
} from "./parse_property_declaration"
1314

1415
const getSettersAndGetters = (

parse_node/parse_conditional_expression.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts from "typescript"
2-
import { combine, ParseState } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44
import { Test } from "../tests/test"
55

66
export const parseConditionalExpression = (

parse_node/parse_constructor.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ts from "typescript"
2-
import { ParseState, combine } from "../parse_node"
32

4-
import { ParseNodeType } from "../parse_node"
3+
import { ParseState, combine, ParseNodeType } from "../parse_node"
54

65
export const parseConstructor = (
76
node: ts.ConstructorDeclaration,

parse_node/parse_continue_statement.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ts from "typescript"
2-
import { combine, ParseState } from "../parse_node"
32

4-
import { ParseNodeType } from "../parse_node"
3+
import { ParseState, combine, ParseNodeType } from "../parse_node"
54
import { Test } from "../tests/test"
65

76
export const parseContinueStatement = (

parse_node/parse_element_access_expression.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import ts from "typescript"
2-
import { ParseState, parseNode, combine } from "../parse_node"
32

4-
import { ParseNodeType } from "../parse_node"
3+
import { ParseState, combine, parseNode, ParseNodeType } from "../parse_node"
54

65
export const parseElementAccessExpression = (
76
node: ts.ElementAccessExpression,

parse_node/parse_empty_statement.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts, { SyntaxKind } from "typescript"
2-
import { ParseState, combine } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44
import { Test } from "../tests/test"
55

66
export const parseEmptyStatement = (

parse_node/parse_enum_declaration.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import ts from "typescript"
22

3-
import { combine, ParseNodeType, ParseState } from "../parse_node"
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44
import { Test } from "../tests/test"
5+
56
import { getImportResPathForEnum } from "./parse_import_declaration"
67

78
export const parseEnumDeclaration = (

parse_node/parse_expression_statement.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ts from "typescript"
2-
import { ParseState, combine } from "../parse_node"
3-
import { ParseNodeType } from "../parse_node"
2+
3+
import { ParseNodeType, ParseState, combine } from "../parse_node"
44
import { Test } from "../tests/test"
55

66
export const parseExpressionStatement = (

0 commit comments

Comments
 (0)