Skip to content

Commit

Permalink
style: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Aug 4, 2023
1 parent 104c28d commit f746d5e
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/service/cache/cached-fs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { CachedWorkerOptions} from "./cached-worker.js";
import type {CachedWorkerOptions} from "./cached-worker.js";
import {CachedWorker} from "./cached-worker.js";
import type {TS} from "../../type/ts.js";
import type {FileSystem} from "../../util/file-system/file-system.js";
Expand Down
66 changes: 31 additions & 35 deletions src/service/emit/diagnostics/emit-diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,42 @@ export function emitDiagnostics({host, context, pluginOptions}: EmitDiagnosticsO

switch (diagnostic.category) {
case typescript.DiagnosticCategory.Error:
context.error(
{
frame,
code,
name: code,
stack,
...(diagnostic.length == null ? {} : {length: diagnostic.length}),
...(diagnostic.file == null && position == null
? {}
: {
loc: {
...(diagnostic.file == null ? {} : {file: diagnostic.file.fileName}),
...(position == null ? {} : {line: position.line + 1}),
...(position == null ? {} : {column: position.character + 1})
}
}),
...(diagnostic.file == null ? {} : {pos: diagnostic.file.pos}),
message
} as RollupError
);
context.error({
frame,
code,
name: code,
stack,
...(diagnostic.length == null ? {} : {length: diagnostic.length}),
...(diagnostic.file == null && position == null
? {}
: {
loc: {
...(diagnostic.file == null ? {} : {file: diagnostic.file.fileName}),
...(position == null ? {} : {line: position.line + 1}),
...(position == null ? {} : {column: position.character + 1})
}
}),
...(diagnostic.file == null ? {} : {pos: diagnostic.file.pos}),
message
} as RollupError);
break;

case typescript.DiagnosticCategory.Warning:
case typescript.DiagnosticCategory.Message:
case typescript.DiagnosticCategory.Suggestion:
context.warn(
{
frame,
code,
name: code,
...(diagnostic.length == null ? {} : {length: diagnostic.length}),
loc: {
...(diagnostic.file == null ? {} : {file: diagnostic.file.fileName}),
...(position == null ? {} : {line: position.line + 1}),
...(position == null ? {} : {column: position.character + 1})
},
...(diagnostic.file == null ? {} : {pos: diagnostic.file.pos}),
message
} as RollupWarning
);
context.warn({
frame,
code,
name: code,
...(diagnostic.length == null ? {} : {length: diagnostic.length}),
loc: {
...(diagnostic.file == null ? {} : {file: diagnostic.file.fileName}),
...(position == null ? {} : {line: position.line + 1}),
...(position == null ? {} : {column: position.character + 1})
},
...(diagnostic.file == null ? {} : {pos: diagnostic.file.pos}),
message
} as RollupWarning);
break;
}
});
Expand Down
9 changes: 6 additions & 3 deletions src/service/module-resolution-host/module-resolution-host.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {TS} from "../../type/ts.js";
import type {ModuleResolutionHostOptions} from "./module-resolution-host-options.js";
import {ensureAbsolute} from "../../util/path/path-util.js";
import type { SupportedExtensions} from "../../util/get-supported-extensions/get-supported-extensions.js";
import type {SupportedExtensions} from "../../util/get-supported-extensions/get-supported-extensions.js";
import {getSupportedExtensions} from "../../util/get-supported-extensions/get-supported-extensions.js";
import type {VirtualFile, VirtualFileInput} from "./virtual-file.js";
import type {AmbientExtension} from "../../constant/constant.js";
import { AMBIENT_EXTENSIONS} from "../../constant/constant.js";
import {AMBIENT_EXTENSIONS} from "../../constant/constant.js";
import path from "crosspath";

export class ModuleResolutionHost implements TS.ModuleResolutionHost {
Expand All @@ -14,7 +14,10 @@ export class ModuleResolutionHost implements TS.ModuleResolutionHost {
private currentFileNames: Set<string> | undefined;
private currentDirectories: Set<string> | undefined;
private currentNonAmbientSupportedExtensions: SupportedExtensions | undefined;
constructor(protected readonly options: ModuleResolutionHostOptions, protected readonly files: Map<string, VirtualFile> = new Map()) {}
constructor(
protected readonly options: ModuleResolutionHostOptions,
protected readonly files: Map<string, VirtualFile> = new Map()
) {}

add(fileInput: VirtualFileInput | VirtualFile): VirtualFile {
const file = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ export function deconflictPropertySignature(options: DeconflicterVisitorOptions<
}

return preserveMeta(factory.updatePropertySignature(node, node.modifiers, nameContResult, node.questionToken, typeContResult), node, options);

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function moduleBlockExtractor(options: ModuleBlockExtractorOptions): TS.S
context
),

continuation: <U extends TS.Node>(node: U): TS.VisitResult<TS.Node>|undefined =>
continuation: <U extends TS.Node>(node: U): TS.VisitResult<TS.Node> | undefined =>
visitNode({
...visitorOptions,
node
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {TS} from "../../../../type/ts.js";
import type {SourceFileBundlerVisitorOptions} from "../transformers/source-file-bundler/source-file-bundler-visitor-options.js";
import type { GetSymbolAtLocationOptions} from "./get-symbol-at-location.js";
import type {GetSymbolAtLocationOptions} from "./get-symbol-at-location.js";
import {getSymbolAtLocation} from "./get-symbol-at-location.js";
import {getParentNode} from "./get-parent-node.js";
import {isSameChunk} from "./generate-module-specifier.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GetSymbolAtLocationOptions} from "./get-symbol-at-location.js";
import type {GetSymbolAtLocationOptions} from "./get-symbol-at-location.js";
import {getSymbolAtLocation} from "./get-symbol-at-location.js";
import type {TS} from "../../../../type/ts.js";
import {generateRandomHash, generateRandomIntegerHash} from "../../../../util/hash/generate-random-hash.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {isRootLevelNode} from "../transformers/module-merger/util/is-root-level-
export interface NodePlacementQueue {
prependNodes(...nodes: TS.Node[]): void;
appendNodes(...nodes: TS.Node[]): void;
wrapVisitResult<T extends TS.Node>(node: TS.VisitResult<T>|undefined): TS.VisitResult<TS.Node> | undefined;
wrapVisitResult<T extends TS.Node>(node: TS.VisitResult<T> | undefined): TS.VisitResult<TS.Node> | undefined;
flush(): readonly [readonly TS.Node[], readonly TS.Node[]];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { GetAliasedDeclarationOptions} from "./get-aliased-declaration.js";
import type {GetAliasedDeclarationOptions} from "./get-aliased-declaration.js";
import {getAliasedDeclaration} from "./get-aliased-declaration.js";
import type { TypeReference} from "./get-type-reference-module-from-file-name.js";
import type {TypeReference} from "./get-type-reference-module-from-file-name.js";
import {getTypeReferenceModuleFromFileName} from "./get-type-reference-module-from-file-name.js";
import type {TS} from "../../../../type/ts.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import type {NamedExportedSymbol, NamespaceExportedSymbol, SourceFileToExportedSymbolSet} from "../transformers/track-exports-transformer/track-exports-transformer-visitor-options.js";
import type {
NamedExportedSymbol,
NamespaceExportedSymbol,
SourceFileToExportedSymbolSet
} from "../transformers/track-exports-transformer/track-exports-transformer-visitor-options.js";
import type {CompilerHost} from "../../../compiler-host/compiler-host.js";
import type {SourceFileResolver} from "../transformers/source-file-bundler/source-file-bundler-visitor-options.js";

Expand Down
3 changes: 1 addition & 2 deletions src/util/get-declaration-out-dir/get-declaration-out-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import type {OutputOptions} from "rollup";
import {ensureRelative} from "../path/path-util.js";
import {getOutDir} from "../get-out-dir/get-out-dir.js";
import type {TS} from "../../type/ts.js";
import type {
AmbientExtension} from "../../constant/constant.js";
import type {AmbientExtension} from "../../constant/constant.js";
import {
CJSX_EXTENSION,
CJS_EXTENSION,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type {
KnownExtension,
AmbientExtension} from "../../constant/constant.js";
import type {KnownExtension, AmbientExtension} from "../../constant/constant.js";
import {
D_TS_EXTENSION,
JS_EXTENSION,
Expand Down
4 changes: 2 additions & 2 deletions src/util/module-resolution/module-resolution-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {TS} from "../../type/ts.js";
* will throw.
*/
export function allowsNodeNextModuleResolution(typescript: typeof TS): boolean {
// If 'Node16' module resolution is available, NodeNext is allowed to be selected as a ModuleResolutionKind.
// This happened in v4.7
// If 'Node16' module resolution is available, NodeNext is allowed to be selected as a ModuleResolutionKind.
// This happened in v4.7
return typescript.ModuleResolutionKind.Node16 != null;
}
4 changes: 2 additions & 2 deletions src/util/transpiler-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ async function loadModules<TCoreModule extends string, TSubModules extends strin
({
status: "fulfilled",
value
} as const)
}) as const
)
.catch(
reason =>
({
status: "rejected",
reason
} as const)
}) as const
)
)
);
Expand Down
4 changes: 2 additions & 2 deletions test/setup/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type { TestContext} from "./test-context.js";
import type {TestContext} from "./test-context.js";
import {createTestContext} from "./test-context.js";
import type { TestFile, TestFileStructure} from "./test-file.js";
import type {TestFile, TestFileStructure} from "./test-file.js";
import {createTestFileStructure} from "./test-file.js";
import {createVirtualFileSystem} from "./create-virtual-file-system.js";
import type {MaybeArray, PartialExcept} from "helpertypes";
Expand Down

0 comments on commit f746d5e

Please sign in to comment.