diff --git a/flake.nix b/flake.nix index e41a7086..b3412cdb 100644 --- a/flake.nix +++ b/flake.nix @@ -199,10 +199,6 @@ name = "NODE_PATH"; prefix = "${ast}/lib/node_modules"; } - { - name = "TS_NODE_PROJECT"; - prefix = "./tsconfig.json"; - } ]; commands = [ { diff --git a/tested/languages/typescript/config.py b/tested/languages/typescript/config.py index ee9ad819..abf8fb1d 100644 --- a/tested/languages/typescript/config.py +++ b/tested/languages/typescript/config.py @@ -32,6 +32,7 @@ logger = logging.getLogger(__name__) + class TypeScript(Language): def initial_dependencies(self) -> list[str]: @@ -107,9 +108,18 @@ def compilation(self, files: list[str]) -> CallbackResult: submission = submission_file(self) main_file = list(filter(lambda x: x == submission, files)) if main_file: - return (["tsc", "--module", "nodenext", "--moduleResolution", - "nodenext", "--noEmit", main_file[0]], - files) + return ( + [ + "tsc", + "--module", + "nodenext", + "--moduleResolution", + "nodenext", + "--noEmit", + main_file[0], + ], + files, + ) else: return [], files @@ -133,7 +143,7 @@ def modify_solution(self, solution: Path): assert output, "Missing output from TypesScript's modify_solution" namings = output.stdout.strip() with open(solution, "a") as file: - # print(f"\ndeclare var module: any;", file=file) + # print(f"\ndeclare var module: any;", file=file) print(f"\nexport {{{namings}}};", file=file) # Add strict mode to the script. @@ -197,38 +207,36 @@ def generate_encoder(self, values: list[Value]) -> str: def get_declaration_metadata(self) -> TypeDeclarationMetadata: return { - "names": { # type: ignore - "integer": "number", - "real": "number", - "char": "string", - "text": "string", - "string": "string", - "boolean": "boolean", - "sequence": "array", - "set": "set", - "map": "object", - "nothing": "null", - "undefined": "undefined", - "int8": "number", - "uint8": "number", - "int16": "number", - "uint16": "number", - "int32": "number", - "uint32": "number", - "int64": "number", - "uint64": "number", - "bigint": "number", + "names": { # type: ignore + "integer": "number", + "real": "number", + "char": "string", + "text": "string", + "string": "string", + "boolean": "boolean", + "sequence": "array", + "set": "set", + "map": "object", + "nothing": "null", + "undefined": "undefined", + "int8": "number", + "uint8": "number", + "int16": "number", + "uint16": "number", + "int32": "number", + "uint32": "number", + "int64": "number", + "uint64": "number", + "bigint": "number", "single_precision": "number", "double_precision": "number", - "double_extended": "number", - "fixed_precision": "number", - "array": "array", - "list": "array", - "tuple": "array", - "any": "object", + "double_extended": "number", + "fixed_precision": "number", + "array": "array", + "list": "array", + "tuple": "array", + "any": "object", }, - "nested": ("<", ">"), + "nested": ("<", ">"), "exception": "Error", } - - diff --git a/tested/languages/typescript/generators.py b/tested/languages/typescript/generators.py index 3ca690b0..c93a8923 100644 --- a/tested/languages/typescript/generators.py +++ b/tested/languages/typescript/generators.py @@ -68,9 +68,9 @@ def convert_value(value: Value) -> str: result += "}" return result elif value.type in ( - AdvancedNumericTypes.INT_64, - AdvancedNumericTypes.U_INT_64, - AdvancedNumericTypes.BIG_INT, + AdvancedNumericTypes.INT_64, + AdvancedNumericTypes.U_INT_64, + AdvancedNumericTypes.BIG_INT, ): return f'BigInt("{value.data}")' # Handle basic types @@ -182,9 +182,9 @@ def _generate_internal_context(ctx: PreparedContext, pu: PreparedExecutionUnit) # We need special code to make variables available outside of the try-catch block. if ( - not tc.testcase.is_main_testcase() - and isinstance(tc.input, PreparedTestcaseStatement) - and isinstance(tc.input.statement, VariableAssignment) + not tc.testcase.is_main_testcase() + and isinstance(tc.input, PreparedTestcaseStatement) + and isinstance(tc.input.statement, VariableAssignment) ): result += f"let {tc.input.statement.variable}\n" diff --git a/tests/test_linters.py b/tests/test_linters.py index 3497d84b..00db95ec 100644 --- a/tests/test_linters.py +++ b/tests/test_linters.py @@ -56,7 +56,6 @@ def test_eslint(tmp_path: Path, config: dict, pytestconfig: pytest.Config): config, ) result = execute_config(conf) - print(conf) updates = assert_valid_output(result, pytestconfig) assert len(updates.find_all("annotate-code")) > 0