diff --git a/src/interpreter/environment/create-sanitized-environment.ts b/src/interpreter/environment/create-sanitized-environment.ts index 84da3b9..820cb53 100644 --- a/src/interpreter/environment/create-sanitized-environment.ts +++ b/src/interpreter/environment/create-sanitized-environment.ts @@ -14,7 +14,7 @@ import {ProcessError} from "../error/policy-error/process-error/process-error.js import {isProcessSpawnChildOperation} from "../policy/process/is-process-spawn-child-operation.js"; import type {ICreateSanitizedEnvironmentOptions} from "./i-create-sanitized-environment-options.js"; import {isConsoleOperation} from "../policy/console/is-console-operation.js"; -import { EvaluationErrorIntent } from "../error/evaluation-error/evaluation-error-intent.js"; +import {EvaluationErrorIntent} from "../error/evaluation-error/evaluation-error-intent.js"; /** * Creates an environment that provide hooks into policy checks @@ -27,27 +27,27 @@ export function createSanitizedEnvironment({policy, env}: ICreateSanitizedEnviro } if (!policy.io.read && isIoRead(item)) { - return new EvaluationErrorIntent((node, options) => new IoError({...options, node, kind: "read"})); + return new EvaluationErrorIntent((node, options) => new IoError({...options, node, kind: "read"})); } if (!policy.io.write && isIoWrite(item)) { - return new EvaluationErrorIntent((node, options) => new IoError({...options, node, kind: "write"})); + return new EvaluationErrorIntent((node, options) => new IoError({...options, node, kind: "write"})); } if (!policy.process.exit && isProcessExitOperation(item)) { - return new EvaluationErrorIntent((node, options) => new ProcessError({...options, node, kind: "exit"})); + return new EvaluationErrorIntent((node, options) => new ProcessError({...options, node, kind: "exit"})); } if (!policy.process.exit && isProcessSpawnChildOperation(item)) { - return new EvaluationErrorIntent((node, options) => new ProcessError({...options, node, kind: "spawnChild"})); + return new EvaluationErrorIntent((node, options) => new ProcessError({...options, node, kind: "spawnChild"})); } if (!policy.network && isNetworkOperation(item)) { - return new EvaluationErrorIntent((node, options) => new NetworkError({...options, node, operation: stringifyPolicyTrapKindOnPath(item.kind, item.path)})); + return new EvaluationErrorIntent((node, options) => new NetworkError({...options, node, operation: stringifyPolicyTrapKindOnPath(item.kind, item.path)})); } if (policy.deterministic && isNonDeterministic(item)) { - return new EvaluationErrorIntent((node, options) => new NonDeterministicError({...options, node, operation: stringifyPolicyTrapKindOnPath(item.kind, item.path)})); + return new EvaluationErrorIntent((node, options) => new NonDeterministicError({...options, node, operation: stringifyPolicyTrapKindOnPath(item.kind, item.path)})); } return true; diff --git a/src/interpreter/error/evaluation-error/evaluation-error.ts b/src/interpreter/error/evaluation-error/evaluation-error.ts index 6a388e5..035cb0a 100644 --- a/src/interpreter/error/evaluation-error/evaluation-error.ts +++ b/src/interpreter/error/evaluation-error/evaluation-error.ts @@ -1,6 +1,6 @@ import type {IEvaluationErrorOptions} from "./i-evaluation-error-options.js"; import type {TS} from "../../../type/ts.js"; -import type { LexicalEnvironment } from "../../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; export type ThrowError = (error: EvaluationError) => EvaluationError; @@ -22,6 +22,6 @@ export class EvaluationError extends Error { } } -export function isEvaluationError (item: unknown): item is EvaluationError { +export function isEvaluationError(item: unknown): item is EvaluationError { return typeof item === "object" && item != null && item instanceof EvaluationError; -} \ No newline at end of file +} diff --git a/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts b/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts index a90659b..f495c72 100644 --- a/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts +++ b/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts @@ -1,5 +1,5 @@ import type {TS} from "../../../type/ts.js"; -import type { LexicalEnvironment } from "../../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; export interface IEvaluationErrorOptions { node: TS.Node; diff --git a/src/interpreter/error/not-callable-error/not-callable-error.ts b/src/interpreter/error/not-callable-error/not-callable-error.ts index 169ac30..b0ea516 100644 --- a/src/interpreter/error/not-callable-error/not-callable-error.ts +++ b/src/interpreter/error/not-callable-error/not-callable-error.ts @@ -1,7 +1,7 @@ import {EvaluationError} from "../evaluation-error/evaluation-error.js"; import type {INotCallableErrorOptions} from "./i-not-callable-error-options.js"; import type {Literal} from "../../literal/literal.js"; -import { stringifyLiteral} from "../../literal/literal.js"; +import {stringifyLiteral} from "../../literal/literal.js"; /** * An Error that can be thrown when a value is attempted to be called, but isn't callable diff --git a/src/interpreter/evaluate.ts b/src/interpreter/evaluate.ts index 027ff5b..d7b1631 100644 --- a/src/interpreter/evaluate.ts +++ b/src/interpreter/evaluate.ts @@ -10,7 +10,7 @@ import {createStatementTraversalStack} from "./stack/traversal-stack/statement-t import {isExpression} from "./util/expression/is-expression.js"; import type {Literal} from "./literal/literal.js"; import {isStatement} from "./util/statement/is-statement.js"; -import type { Stack} from "./stack/stack.js"; +import type {Stack} from "./stack/stack.js"; import {createStack} from "./stack/stack.js"; import {isDeclaration} from "./util/declaration/is-declaration.js"; import {UnexpectedNodeError} from "./error/unexpected-node-error/unexpected-node-error.js"; @@ -19,7 +19,7 @@ import {reportError} from "./util/reporting/report-error.js"; import {createReportedErrorSet} from "./reporting/reported-error-set.js"; import type {ReportingOptionsSanitized} from "./reporting/i-reporting-options.js"; import type {EvaluationError, ThrowError} from "./error/evaluation-error/evaluation-error.js"; -import type { ICreateNodeEvaluatorOptions } from "./evaluator/node-evaluator/i-create-node-evaluator-options.js"; +import type {ICreateNodeEvaluatorOptions} from "./evaluator/node-evaluator/i-create-node-evaluator-options.js"; /** * Will get a literal value for the given Expression, ExpressionStatement, or Declaration. */ diff --git a/src/interpreter/evaluator/evaluate-arrow-function-expression.ts b/src/interpreter/evaluator/evaluate-arrow-function-expression.ts index d7fdb66..70e7e24 100644 --- a/src/interpreter/evaluator/evaluate-arrow-function-expression.ts +++ b/src/interpreter/evaluator/evaluate-arrow-function-expression.ts @@ -1,5 +1,5 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; -import type { LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {getFromLexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {Literal} from "../literal/literal.js"; diff --git a/src/interpreter/evaluator/evaluate-block.ts b/src/interpreter/evaluator/evaluate-block.ts index f22ebc5..8f7fb45 100644 --- a/src/interpreter/evaluator/evaluate-block.ts +++ b/src/interpreter/evaluator/evaluate-block.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; -import { pathInLexicalEnvironmentEquals} from "../lexical-environment/lexical-environment.js"; +import {pathInLexicalEnvironmentEquals} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import {BREAK_SYMBOL} from "../util/break/break-symbol.js"; import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol.js"; diff --git a/src/interpreter/evaluator/evaluate-call-expression.ts b/src/interpreter/evaluator/evaluate-call-expression.ts index dcfc0bc..8b7ef0e 100644 --- a/src/interpreter/evaluator/evaluate-call-expression.ts +++ b/src/interpreter/evaluator/evaluate-call-expression.ts @@ -1,5 +1,5 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; -import type { Literal} from "../literal/literal.js"; +import type {Literal} from "../literal/literal.js"; import {isLazyCall} from "../literal/literal.js"; import {NotCallableError} from "../error/not-callable-error/not-callable-error.js"; import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; diff --git a/src/interpreter/evaluator/evaluate-constructor-declaration.ts b/src/interpreter/evaluator/evaluate-constructor-declaration.ts index 0fda5ba..d5bddde 100644 --- a/src/interpreter/evaluator/evaluate-constructor-declaration.ts +++ b/src/interpreter/evaluator/evaluate-constructor-declaration.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; -import { pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {IndexLiteral, Literal} from "../literal/literal.js"; import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations.js"; diff --git a/src/interpreter/evaluator/evaluate-decorator.ts b/src/interpreter/evaluator/evaluate-decorator.ts index c1d5791..efc0992 100644 --- a/src/interpreter/evaluator/evaluate-decorator.ts +++ b/src/interpreter/evaluator/evaluate-decorator.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {IndexLiteral} from "../literal/literal.js"; -import { stringifyLiteral} from "../literal/literal.js"; +import {stringifyLiteral} from "../literal/literal.js"; import {NotCallableError} from "../error/not-callable-error/not-callable-error.js"; import type {TS} from "../../type/ts.js"; import {__decorate, __param} from "../util/tslib/tslib-util.js"; diff --git a/src/interpreter/evaluator/evaluate-element-access-expression.ts b/src/interpreter/evaluator/evaluate-element-access-expression.ts index 285f25d..a945a5a 100644 --- a/src/interpreter/evaluator/evaluate-element-access-expression.ts +++ b/src/interpreter/evaluator/evaluate-element-access-expression.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {IndexLiteral, IndexLiteralKey, LazyCall, Literal} from "../literal/literal.js"; -import { LAZY_CALL_FLAG, LiteralFlagKind} from "../literal/literal.js"; +import {LAZY_CALL_FLAG, LiteralFlagKind} from "../literal/literal.js"; import {isBindCallApply} from "../util/function/is-bind-call-apply.js"; import type {TS} from "../../type/ts.js"; import {maybeThrow} from "../error/evaluation-error/evaluation-error-intent.js"; diff --git a/src/interpreter/evaluator/evaluate-function-declaration.ts b/src/interpreter/evaluator/evaluate-function-declaration.ts index b078cc2..38fc3f9 100644 --- a/src/interpreter/evaluator/evaluate-function-declaration.ts +++ b/src/interpreter/evaluator/evaluate-function-declaration.ts @@ -1,5 +1,5 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; -import type { LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {getFromLexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {Literal} from "../literal/literal.js"; diff --git a/src/interpreter/evaluator/evaluate-function-expression.ts b/src/interpreter/evaluator/evaluate-function-expression.ts index 0509c17..9924d7a 100644 --- a/src/interpreter/evaluator/evaluate-function-expression.ts +++ b/src/interpreter/evaluator/evaluate-function-expression.ts @@ -1,5 +1,5 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; -import type { LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {getFromLexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {Literal} from "../literal/literal.js"; diff --git a/src/interpreter/evaluator/evaluate-get-accessor-declaration.ts b/src/interpreter/evaluator/evaluate-get-accessor-declaration.ts index 513e774..7ae41f7 100644 --- a/src/interpreter/evaluator/evaluate-get-accessor-declaration.ts +++ b/src/interpreter/evaluator/evaluate-get-accessor-declaration.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; -import { pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal.js"; import {THIS_SYMBOL} from "../util/this/this-symbol.js"; diff --git a/src/interpreter/evaluator/evaluate-method-declaration.ts b/src/interpreter/evaluator/evaluate-method-declaration.ts index 2b2bcb0..dea965a 100644 --- a/src/interpreter/evaluator/evaluate-method-declaration.ts +++ b/src/interpreter/evaluator/evaluate-method-declaration.ts @@ -1,5 +1,5 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; -import type { LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {getFromLexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal.js"; diff --git a/src/interpreter/evaluator/evaluate-property-access-expression.ts b/src/interpreter/evaluator/evaluate-property-access-expression.ts index e2ca3b2..5cff73c 100644 --- a/src/interpreter/evaluator/evaluate-property-access-expression.ts +++ b/src/interpreter/evaluator/evaluate-property-access-expression.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {IndexLiteral, LazyCall, Literal} from "../literal/literal.js"; -import { LAZY_CALL_FLAG, LiteralFlagKind} from "../literal/literal.js"; +import {LAZY_CALL_FLAG, LiteralFlagKind} from "../literal/literal.js"; import {isBindCallApply} from "../util/function/is-bind-call-apply.js"; import type {TS} from "../../type/ts.js"; import {maybeThrow} from "../error/evaluation-error/evaluation-error-intent.js"; diff --git a/src/interpreter/evaluator/evaluate-property-declaration.ts b/src/interpreter/evaluator/evaluate-property-declaration.ts index 7cc0254..fe8e43b 100644 --- a/src/interpreter/evaluator/evaluate-property-declaration.ts +++ b/src/interpreter/evaluator/evaluate-property-declaration.ts @@ -2,7 +2,7 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {IndexLiteral, IndexLiteralKey} from "../literal/literal.js"; import {inStaticContext} from "../util/static/in-static-context.js"; import type {TS} from "../../type/ts.js"; -import { canHaveDecorators, getDecorators } from "../util/node/modifier-util.js"; +import {canHaveDecorators, getDecorators} from "../util/node/modifier-util.js"; /** * Evaluates, or attempts to evaluate, a PropertyDeclaration, before applying it on the given parent diff --git a/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts b/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts index 156ca58..8c669b2 100644 --- a/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts +++ b/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts @@ -1,6 +1,6 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; -import { setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; import type {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal.js"; import {THIS_SYMBOL} from "../util/this/this-symbol.js"; diff --git a/src/interpreter/evaluator/evaluate-spread-assignment.ts b/src/interpreter/evaluator/evaluate-spread-assignment.ts index e6c1db5..031197c 100644 --- a/src/interpreter/evaluator/evaluate-spread-assignment.ts +++ b/src/interpreter/evaluator/evaluate-spread-assignment.ts @@ -7,10 +7,10 @@ import type {TS} from "../../type/ts.js"; */ export function evaluateSpreadAssignment({node, evaluate, ...options}: EvaluatorOptions, parent: IndexLiteral): void { const entries = evaluate.expression(node.expression, options) as IndexLiteral; - + if (options.getCurrentError() != null) { return; } - + Object.assign(parent, entries); } diff --git a/src/interpreter/evaluator/evaluate-throw-statement.ts b/src/interpreter/evaluator/evaluate-throw-statement.ts index 4814ba0..4658b62 100644 --- a/src/interpreter/evaluator/evaluate-throw-statement.ts +++ b/src/interpreter/evaluator/evaluate-throw-statement.ts @@ -1,14 +1,14 @@ import type {EvaluatorOptions} from "./evaluator-options.js"; import type {TS} from "../../type/ts.js"; -import type { EvaluationError } from "../error/evaluation-error/evaluation-error.js"; +import type {EvaluationError} from "../error/evaluation-error/evaluation-error.js"; /** * Evaluates, or attempts to evaluate, a ThrowStatement */ -export function evaluateThrowStatement({node, evaluate, ...options}: EvaluatorOptions): void|EvaluationError { +export function evaluateThrowStatement({node, evaluate, ...options}: EvaluatorOptions): void | EvaluationError { const {getCurrentError, throwError} = options; const result = evaluate.expression(node.expression, options) as EvaluationError; - + if (getCurrentError() != null) { return; } diff --git a/src/interpreter/evaluator/evaluate-variable-declaration.ts b/src/interpreter/evaluator/evaluate-variable-declaration.ts index 0b84b90..2d7e2ac 100644 --- a/src/interpreter/evaluator/evaluate-variable-declaration.ts +++ b/src/interpreter/evaluator/evaluate-variable-declaration.ts @@ -27,10 +27,10 @@ export function evaluateVariableDeclaration(options: EvaluatorOptions; throwError: ThrowError; - getCurrentError (): EvaluationError|undefined; + getCurrentError(): EvaluationError | undefined; statementTraversalStack: StatementTraversalStack; - } export interface EvaluatorOptions> extends NextEvaluatorOptions { diff --git a/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts b/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts index 2e3f519..3a3a350 100644 --- a/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts +++ b/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts @@ -10,8 +10,8 @@ import {evaluateNodeWithValue} from "../evaluate-node-with-value.js"; import {createStatementTraversalStack} from "../../stack/traversal-stack/statement-traversal-stack.js"; import type {TS} from "../../../type/ts.js"; import type {EvaluationError} from "../../error/evaluation-error/evaluation-error.js"; -import { isEvaluationError} from "../../error/evaluation-error/evaluation-error.js"; -import type { Literal } from "../../literal/literal.js"; +import {isEvaluationError} from "../../error/evaluation-error/evaluation-error.js"; +import type {Literal} from "../../literal/literal.js"; /** * Creates a Node Evaluator @@ -50,7 +50,6 @@ export function createNodeEvaluator(options: ICreateNodeEvaluatorOptions): NodeE }; const evaluate: NodeEvaluator = { - statement: (node, nextOptions): void => { const combinedNextOptions = {...nextOptions, statementTraversalStack: createStatementTraversalStack()}; const prequalifyResult = prequalifyNextNode(node, combinedNextOptions); @@ -73,14 +72,14 @@ export function createNodeEvaluator(options: ICreateNodeEvaluatorOptions): NodeE } return evaluateNodeWithArgument(getEvaluatorOptions(node, nextOptions), arg); }, - expression: (node, nextOptions): Literal|EvaluationError => { + expression: (node, nextOptions): Literal | EvaluationError => { const prequalifyResult = prequalifyNextNode(node, nextOptions); if (isEvaluationError(prequalifyResult)) { return prequalifyResult; } return evaluateExpression(getEvaluatorOptions(node, nextOptions)); }, - nodeWithValue: (node, nextOptions): Literal|EvaluationError => { + nodeWithValue: (node, nextOptions): Literal | EvaluationError => { const prequalifyResult = prequalifyNextNode(node, nextOptions); if (isEvaluationError(prequalifyResult)) { return prequalifyResult; diff --git a/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts b/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts index 60a281b..60d48e8 100644 --- a/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts +++ b/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts @@ -3,9 +3,9 @@ import type {Stack} from "../../stack/stack.js"; import type {EvaluatePolicySanitized} from "../../policy/evaluate-policy.js"; import type {ReportingOptionsSanitized} from "../../reporting/i-reporting-options.js"; import type {TS} from "../../../type/ts.js"; -import type { EvaluationError, ThrowError } from "../../error/evaluation-error/evaluation-error.js"; -import type { LexicalEnvironment } from "../../lexical-environment/lexical-environment.js"; -import type { StatementTraversalStack } from "../../stack/traversal-stack/statement-traversal-stack.js"; +import type {EvaluationError, ThrowError} from "../../error/evaluation-error/evaluation-error.js"; +import type {LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; +import type {StatementTraversalStack} from "../../stack/traversal-stack/statement-traversal-stack.js"; export interface ICreateNodeEvaluatorOptions { typeChecker?: TS.TypeChecker; @@ -18,5 +18,5 @@ export interface ICreateNodeEvaluatorOptions { statementTraversalStack: StatementTraversalStack; environment: LexicalEnvironment; throwError: ThrowError; - getCurrentError (): EvaluationError|undefined; + getCurrentError(): EvaluationError | undefined; } diff --git a/src/interpreter/evaluator/node-evaluator/node-evaluator.ts b/src/interpreter/evaluator/node-evaluator/node-evaluator.ts index 31e3ba8..2e5812e 100644 --- a/src/interpreter/evaluator/node-evaluator/node-evaluator.ts +++ b/src/interpreter/evaluator/node-evaluator/node-evaluator.ts @@ -1,15 +1,15 @@ import type {Literal} from "../../literal/literal.js"; import type {TS} from "../../../type/ts.js"; -import type { NextEvaluatorOptions } from "../evaluator-options.js"; -import type { EvaluationError } from "../../error/evaluation-error/evaluation-error.js"; +import type {NextEvaluatorOptions} from "../evaluator-options.js"; +import type {EvaluationError} from "../../error/evaluation-error/evaluation-error.js"; export type NodeWithValue = TS.PropertyName; export type StatementEvaluator = (node: TS.Statement, nextOptions: NextEvaluatorOptions) => void; export type DeclarationEvaluator = (node: TS.Declaration, nextOptions: NextEvaluatorOptions) => void; export type NodeEvaluatorWithArgument = (node: TS.Node, arg: Literal, nextOptions: NextEvaluatorOptions) => void; -export type ExpressionEvaluator = (node: TS.Expression | TS.PrivateIdentifier, nextOptions: NextEvaluatorOptions) => Literal|EvaluationError; -export type NodeWithValueEvaluator = (node: NodeWithValue, nextOptions: NextEvaluatorOptions) => Literal|EvaluationError; +export type ExpressionEvaluator = (node: TS.Expression | TS.PrivateIdentifier, nextOptions: NextEvaluatorOptions) => Literal | EvaluationError; +export type NodeWithValueEvaluator = (node: NodeWithValue, nextOptions: NextEvaluatorOptions) => Literal | EvaluationError; export interface NodeEvaluator { statement: StatementEvaluator; diff --git a/src/interpreter/lexical-environment/clone-lexical-environment.ts b/src/interpreter/lexical-environment/clone-lexical-environment.ts index ff67ec4..a8ee2fa 100644 --- a/src/interpreter/lexical-environment/clone-lexical-environment.ts +++ b/src/interpreter/lexical-environment/clone-lexical-environment.ts @@ -1,4 +1,4 @@ -import type { TS } from "../../type/ts.js"; +import type {TS} from "../../type/ts.js"; import type {LexicalEnvironment} from "./lexical-environment.js"; /** @@ -7,7 +7,7 @@ import type {LexicalEnvironment} from "./lexical-environment.js"; export function cloneLexicalEnvironment(environment: LexicalEnvironment, startingNode: TS.Node): LexicalEnvironment { return { parentEnv: environment, - startingNode, + startingNode, env: {} }; } diff --git a/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts b/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts index 22ccfd9..8f3eccd 100644 --- a/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts +++ b/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts @@ -1,6 +1,6 @@ import type {IEnvironment} from "../environment/i-environment.js"; import type {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; -import type { TS } from "../../type/ts.js"; +import type {TS} from "../../type/ts.js"; export interface ICreateLexicalEnvironmentOptions { startingNode: TS.Node; diff --git a/src/interpreter/lexical-environment/lexical-environment.ts b/src/interpreter/lexical-environment/lexical-environment.ts index 980dab9..0b1cc50 100644 --- a/src/interpreter/lexical-environment/lexical-environment.ts +++ b/src/interpreter/lexical-environment/lexical-environment.ts @@ -15,7 +15,7 @@ import type {ICreateLexicalEnvironmentOptions} from "./i-create-lexical-environm import type {TS} from "../../type/ts.js"; import {NODE_ESM_GLOBALS} from "../environment/node/node-esm-globals.js"; import {getStatementContext} from "../util/node/find-nearest-parent-node-of-kind.js"; -import { createSanitizedEnvironment } from "../environment/create-sanitized-environment.js"; +import {createSanitizedEnvironment} from "../environment/create-sanitized-environment.js"; export interface LexicalEnvironment { parentEnv: LexicalEnvironment | undefined; @@ -228,11 +228,7 @@ export function simplifyEnvironment(environment: LexicalEnvironment, typescript: /** * Creates a Lexical Environment */ -export function createLexicalEnvironment({ - inputEnvironment: {extra, preset}, - startingNode, - policy, -}: ICreateLexicalEnvironmentOptions): LexicalEnvironment { +export function createLexicalEnvironment({inputEnvironment: {extra, preset}, startingNode, policy}: ICreateLexicalEnvironmentOptions): LexicalEnvironment { let env: IndexLiteral; switch (preset) { diff --git a/src/interpreter/logger/logger.ts b/src/interpreter/logger/logger.ts index 3945a9e..8f767f9 100644 --- a/src/interpreter/logger/logger.ts +++ b/src/interpreter/logger/logger.ts @@ -1,7 +1,7 @@ import {LogLevelKind} from "./log-level.js"; import {stringifySyntaxKind} from "../util/syntax-kind/stringify-syntax-kind.js"; import type {Literal} from "../literal/literal.js"; -import { stringifyLiteral} from "../literal/literal.js"; +import {stringifyLiteral} from "../literal/literal.js"; import type {Stack} from "../stack/stack.js"; import type {StatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack.js"; import {inspect} from "util"; diff --git a/src/interpreter/policy/is-trap-condition-met.ts b/src/interpreter/policy/is-trap-condition-met.ts index 94cc672..5b2c08b 100644 --- a/src/interpreter/policy/is-trap-condition-met.ts +++ b/src/interpreter/policy/is-trap-condition-met.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/ban-types */ -import type { PolicyTrapKindToTrapConditionMap, TrapCondition, TrapConditionMap, TrapConditionMemberMap} from "./trap-condition-map.js"; +import type {PolicyTrapKindToTrapConditionMap, TrapCondition, TrapConditionMap, TrapConditionMemberMap} from "./trap-condition-map.js"; import {isTrapCondition, isTrapConditionFunction} from "./trap-condition-map.js"; import type {IPolicyProxyApplyHookOptions, IPolicyProxyConstructHookOptions, PolicyProxyHookOptions} from "../proxy/policy-proxy-hook.js"; diff --git a/src/interpreter/policy/module/built-in-module-map.ts b/src/interpreter/policy/module/built-in-module-map.ts index 0e63766..05e9f0a 100644 --- a/src/interpreter/policy/module/built-in-module-map.ts +++ b/src/interpreter/policy/module/built-in-module-map.ts @@ -77,4 +77,4 @@ export interface BuiltInModuleMap { v8: typeof import("v8"); vm: typeof import("vm"); zlib: typeof import("zlib"); -} \ No newline at end of file +} diff --git a/src/interpreter/proxy/create-policy-proxy.ts b/src/interpreter/proxy/create-policy-proxy.ts index fbaed78..94c55bf 100644 --- a/src/interpreter/proxy/create-policy-proxy.ts +++ b/src/interpreter/proxy/create-policy-proxy.ts @@ -4,8 +4,8 @@ import type {ICreatePolicyProxyOptions} from "./i-create-policy-proxy-options.js import {isBindCallApply} from "../util/function/is-bind-call-apply.js"; import {PolicyTrapKind} from "../policy/policy-trap-kind.js"; import type {EvaluationErrorIntent} from "../error/evaluation-error/evaluation-error-intent.js"; -import { isEvaluationErrorIntent} from "../error/evaluation-error/evaluation-error-intent.js"; -import { isEvaluationError } from "../error/evaluation-error/evaluation-error.js"; +import {isEvaluationErrorIntent} from "../error/evaluation-error/evaluation-error-intent.js"; +import {isEvaluationError} from "../error/evaluation-error/evaluation-error.js"; /** * Stringifies the given PropertyKey path diff --git a/src/interpreter/proxy/policy-proxy-hook.ts b/src/interpreter/proxy/policy-proxy-hook.ts index c8f2833..5fdbb3b 100644 --- a/src/interpreter/proxy/policy-proxy-hook.ts +++ b/src/interpreter/proxy/policy-proxy-hook.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/ban-types */ -import type { EvaluationErrorIntent } from "../error/evaluation-error/evaluation-error-intent.js"; +import type {EvaluationErrorIntent} from "../error/evaluation-error/evaluation-error-intent.js"; import type {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; import type {PolicyTrapKind} from "../policy/policy-trap-kind.js"; @@ -30,4 +30,4 @@ export interface IPolicyProxyApplyHookOptions extends IPolicyP // eslint-disable-next-line @typescript-eslint/no-explicit-any export type PolicyProxyHookOptions> = IPolicyProxyGetHookOptions | IPolicyProxyApplyHookOptions | IPolicyProxyConstructHookOptions; -export type PolicyProxyHook = (options: PolicyProxyHookOptions) => boolean|EvaluationErrorIntent; +export type PolicyProxyHook = (options: PolicyProxyHookOptions) => boolean | EvaluationErrorIntent; diff --git a/src/interpreter/util/declaration/get-declaration-name.ts b/src/interpreter/util/declaration/get-declaration-name.ts index 9d8654e..d2adba1 100644 --- a/src/interpreter/util/declaration/get-declaration-name.ts +++ b/src/interpreter/util/declaration/get-declaration-name.ts @@ -1,7 +1,7 @@ import type {EvaluatorOptions} from "../../evaluator/evaluator-options.js"; import {UnexpectedNodeError} from "../../error/unexpected-node-error/unexpected-node-error.js"; import type {TS} from "../../../type/ts.js"; -import type { EvaluationError } from "../../error/evaluation-error/evaluation-error.js"; +import type {EvaluationError} from "../../error/evaluation-error/evaluation-error.js"; /** * Gets the name of the given declaration diff --git a/src/interpreter/util/function/is-bind-call-apply.ts b/src/interpreter/util/function/is-bind-call-apply.ts index 9d04462..929649a 100644 --- a/src/interpreter/util/function/is-bind-call-apply.ts +++ b/src/interpreter/util/function/is-bind-call-apply.ts @@ -1,4 +1,4 @@ -import type { LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; +import type {LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; import {getFromLexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; /** diff --git a/src/interpreter/util/loader/optional-peer-dependency-loader.ts b/src/interpreter/util/loader/optional-peer-dependency-loader.ts index 7393d35..3c9c03c 100644 --- a/src/interpreter/util/loader/optional-peer-dependency-loader.ts +++ b/src/interpreter/util/loader/optional-peer-dependency-loader.ts @@ -1,5 +1,5 @@ import type {JSDOM} from "../../../type/jsdom.js"; -import { requireModule } from "./require-module.js"; +import {requireModule} from "./require-module.js"; /** * The jsdom module is optionally imported on-demand as needed diff --git a/src/interpreter/util/loader/require-module.ts b/src/interpreter/util/loader/require-module.ts index 908fa48..17f33f0 100644 --- a/src/interpreter/util/loader/require-module.ts +++ b/src/interpreter/util/loader/require-module.ts @@ -1,4 +1,4 @@ import {createRequire} from "module"; // Until import.meta.resolve becomes stable, we'll have to do this instead -export const requireModule = createRequire(import.meta.url); \ No newline at end of file +export const requireModule = createRequire(import.meta.url); diff --git a/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts b/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts index e99147d..3a6b380 100644 --- a/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts +++ b/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts @@ -43,9 +43,8 @@ export function getImplementationForDeclarationWithinDeclarationFile(options: Ev const moduleSpecifier = moduleDeclaration.name.text; const resolvedModuleSpecifier = getResolvedModuleName(moduleSpecifier, options); try { - // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires - const module = options.moduleOverrides?.[moduleSpecifier] ?? options.moduleOverrides?.[resolvedModuleSpecifier] ?? require(resolvedModuleSpecifier); + const module = options.moduleOverrides?.[moduleSpecifier] ?? options.moduleOverrides?.[resolvedModuleSpecifier] ?? require(resolvedModuleSpecifier); return typescript.isModuleDeclaration(node) ? module : module[name] ?? module; } catch (ex) { if (isEvaluationError(ex)) return ex; diff --git a/src/interpreter/util/module/get-resolved-module-name.ts b/src/interpreter/util/module/get-resolved-module-name.ts index 754ab4b..8bcd9e0 100644 --- a/src/interpreter/util/module/get-resolved-module-name.ts +++ b/src/interpreter/util/module/get-resolved-module-name.ts @@ -1,13 +1,13 @@ import path from "crosspath"; -import type { TS } from "../../../type/ts.js"; -import type { EvaluatorOptions } from "../../evaluator/evaluator-options.js"; +import type {TS} from "../../../type/ts.js"; +import type {EvaluatorOptions} from "../../evaluator/evaluator-options.js"; -export function getResolvedModuleName (moduleSpecifier: string, options: EvaluatorOptions): string { - const {node, typescript} = options; - if (!typescript.isExternalModuleNameRelative(moduleSpecifier)) { - return moduleSpecifier; - } +export function getResolvedModuleName(moduleSpecifier: string, options: EvaluatorOptions): string { + const {node, typescript} = options; + if (!typescript.isExternalModuleNameRelative(moduleSpecifier)) { + return moduleSpecifier; + } - const parentPath = node.getSourceFile().fileName; - return path.join(path.dirname(parentPath), moduleSpecifier); -} \ No newline at end of file + const parentPath = node.getSourceFile().fileName; + return path.join(path.dirname(parentPath), moduleSpecifier); +} diff --git a/src/interpreter/util/node/is-node.ts b/src/interpreter/util/node/is-node.ts index c18fcc1..1ff9605 100644 --- a/src/interpreter/util/node/is-node.ts +++ b/src/interpreter/util/node/is-node.ts @@ -1,5 +1,5 @@ -import type { TS } from "../../../type/ts.js"; +import type {TS} from "../../../type/ts.js"; - export function isTypescriptNode(node: T|unknown): node is T { - return node != null && typeof node === "object" && "kind" in node && "flags" in node && "pos" in node && "end" in node; +export function isTypescriptNode(node: T | unknown): node is T { + return node != null && typeof node === "object" && "kind" in node && "flags" in node && "pos" in node && "end" in node; } diff --git a/src/type/ts.ts b/src/type/ts.ts index 7600b63..3f87866 100644 --- a/src/type/ts.ts +++ b/src/type/ts.ts @@ -1,2 +1,2 @@ import type * as TS from "typescript"; -export type {TS}; \ No newline at end of file +export type {TS}; diff --git a/test/setup/cached-fs.ts b/test/setup/cached-fs.ts index 00bbd34..f105c31 100644 --- a/test/setup/cached-fs.ts +++ b/test/setup/cached-fs.ts @@ -1,6 +1,6 @@ -import type { TS } from "../../src/type/ts.js"; -import type { FileSystem } from "../../src/type/file-system.js"; -import type { CachedWorkerOptions} from "./cached-worker.js"; +import type {TS} from "../../src/type/ts.js"; +import type {FileSystem} from "../../src/type/file-system.js"; +import type {CachedWorkerOptions} from "./cached-worker.js"; import {CachedWorker} from "./cached-worker.js"; export interface CachedFsWorkerOptions extends CachedWorkerOptions { diff --git a/test/setup/execute-program.ts b/test/setup/execute-program.ts index b483a18..2139b8a 100644 --- a/test/setup/execute-program.ts +++ b/test/setup/execute-program.ts @@ -1,6 +1,6 @@ import type {TS} from "../../src/type/ts.js"; import type {TestResult} from "./test-result.js"; -import type { TestFile, TestFileEntry} from "./test-file.js"; +import type {TestFile, TestFileEntry} from "./test-file.js"; import {createBuiltInModuleTestFiles} from "./test-file.js"; import type {TestContext} from "./test-context.js"; import {createTestSetup} from "./test-setup.js"; diff --git a/test/setup/test-file.ts b/test/setup/test-file.ts index 5528b27..34605b8 100644 --- a/test/setup/test-file.ts +++ b/test/setup/test-file.ts @@ -5,7 +5,7 @@ import {generateRandomPath} from "../../src/interpreter/util/path/generate-rando import {ensureArray} from "../../src/interpreter/util/array/ensure-array.js"; import type {MaybeArray} from "helpertypes"; import {CachedFs} from "./cached-fs.js"; -import { requireModule } from "../../src/interpreter/util/loader/require-module.js"; +import {requireModule} from "../../src/interpreter/util/loader/require-module.js"; export interface TestFileRecord { fileName: string; @@ -93,7 +93,9 @@ export function createTestFileStructure(input: MaybeArray, entryInput: .map(file => ({...file, fileName: path.join(src, file.fileName)})); const entry: TestFileEntryRefRecord = - typeof entryInput === "string" ? {file: files[0], match: entryInput} : {file: files.find(file => file.fileName === path.join(src, entryInput.fileName))!, match: entryInput.match}; + typeof entryInput === "string" + ? {file: files[0], match: entryInput} + : {file: files.find(file => file.fileName === path.join(src, entryInput.fileName))!, match: entryInput.match}; return { dir: { diff --git a/test/setup/test-result.ts b/test/setup/test-result.ts index bcd243b..057fc45 100644 --- a/test/setup/test-result.ts +++ b/test/setup/test-result.ts @@ -1,5 +1,5 @@ import type {EvaluateResult} from "../../src/interpreter/evaluate-result.js"; -import type { TestSetup } from "./test-setup.js"; +import type {TestSetup} from "./test-setup.js"; export interface TestResult { result: EvaluateResult; diff --git a/test/setup/test-setup.ts b/test/setup/test-setup.ts index d2f407a..0c2a61a 100644 --- a/test/setup/test-setup.ts +++ b/test/setup/test-setup.ts @@ -1,7 +1,7 @@ -import type { TestContext} from "./test-context.js"; +import type {TestContext} from "./test-context.js"; import {createTestContext} from "./test-context.js"; import type {FileSystem} from "../../src/type/file-system.js"; -import type { TestFile, TestFileEntry, TestFileStructure} from "./test-file.js"; +import type {TestFile, TestFileEntry, TestFileStructure} from "./test-file.js"; import {createTestFileStructure} from "./test-file.js"; import {createVirtualFileSystem} from "./create-virtual-file-system.js"; import type {TS} from "../../src/type/ts.js";