Skip to content

Commit 3ffa43d

Browse files
committed
Remove unused exports + some remaining dead code
1 parent bdc3152 commit 3ffa43d

File tree

5 files changed

+11
-47
lines changed

5 files changed

+11
-47
lines changed

scripts/build/tests.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
const mochaJs = path.resolve(findUpRoot(), "node_modules", "mocha", "bin", "_mocha");
2121
export const localBaseline = "tests/baselines/local/";
2222
export const refBaseline = "tests/baselines/reference/";
23-
export const coverageDir = "coverage";
23+
const coverageDir = "coverage";
2424

2525
/**
2626
* @param {string} runJs
@@ -174,7 +174,7 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt
174174
}
175175
}
176176

177-
export async function cleanTestDirs() {
177+
async function cleanTestDirs() {
178178
await rimraf(localBaseline);
179179
await fs.promises.mkdir(localBaseline, { recursive: true });
180180
}
@@ -192,7 +192,7 @@ export async function cleanTestDirs() {
192192
* @param {number | undefined} [shards]
193193
* @param {number | undefined} [shardId]
194194
*/
195-
export function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
195+
function writeTestConfigFile(tests, runners, light, taskConfigsFolder, workerCount, stackTraceLimit, timeout, keepFailed, shards, shardId) {
196196
const testConfigContents = JSON.stringify({
197197
test: tests ? [tests] : undefined,
198198
runners: runners ? runners.split(",") : undefined,
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
const path = require("path");
21
const { TSESLint } = require("@typescript-eslint/utils");
32

4-
module.exports.ROOT_DIR = path.join(process.cwd(), "scripts", "eslint", "tests", "fixtures");
5-
module.exports.FILENAME = path.join(module.exports.ROOT_DIR, "file.ts");
63
module.exports.RuleTester = TSESLint.RuleTester;

src/deprecatedCompat/deprecate.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ import {
77
version,
88
} from "./_namespaces/ts";
99

10-
export let enableDeprecationWarnings = true;
11-
12-
export function setEnableDeprecationWarnings(value: boolean) {
13-
enableDeprecationWarnings = value;
14-
}
15-
1610
let typeScriptVersion: Version | undefined;
1711

1812
function getTypeScriptVersion() {
@@ -38,16 +32,16 @@ function createErrorDeprecation(name: string, errorAfter: Version | undefined, s
3832
function createWarningDeprecation(name: string, errorAfter: Version | undefined, since: Version | undefined, message: string | undefined) {
3933
let hasWrittenDeprecation = false;
4034
return () => {
41-
if (enableDeprecationWarnings && !hasWrittenDeprecation) {
35+
if (!hasWrittenDeprecation) {
4236
Debug.log.warn(formatDeprecationMessage(name, /*error*/ false, errorAfter, since, message));
4337
hasWrittenDeprecation = true;
4438
}
4539
};
4640
}
4741

48-
export function createDeprecation(name: string, options: DeprecationOptions & { error: true; }): () => never;
49-
export function createDeprecation(name: string, options?: DeprecationOptions): () => void;
50-
export function createDeprecation(name: string, options: DeprecationOptions = {}) {
42+
function createDeprecation(name: string, options: DeprecationOptions & { error: true; }): () => never;
43+
function createDeprecation(name: string, options?: DeprecationOptions): () => void;
44+
function createDeprecation(name: string, options: DeprecationOptions = {}) {
5145
const version = typeof options.typeScriptVersion === "string" ? new Version(options.typeScriptVersion) : options.typeScriptVersion ?? getTypeScriptVersion();
5246
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
5347
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;

src/harness/tsserverLogger.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function replaceAll(source: string, searchValue: string, replaceValue: st
2727
return result;
2828
}
2929

30-
export interface Logger extends ts.server.Logger {
30+
interface Logger extends ts.server.Logger {
3131
logs?: string[];
3232
log(s: string): void;
3333
host?: ts.server.ServerHost;
@@ -93,22 +93,7 @@ export function nowString(logger: Logger) {
9393
return `hh:mm:ss:mss`;
9494
}
9595

96-
export function createLoggerWritingToConsole(host: ts.server.ServerHost, sanitizeLibs?: true) {
97-
const logger = createHasErrorMessageLogger();
98-
logger.logs = [];
99-
logger.logs.push = (...args) => {
100-
args.forEach(s => console.log(s));
101-
return 0;
102-
};
103-
return handleLoggerGroup(
104-
logger,
105-
host,
106-
s => console.log(s),
107-
sanitizeLibs,
108-
) as LoggerWithInMemoryLogs;
109-
}
110-
111-
export function sanitizeLog(s: string): string {
96+
function sanitizeLog(s: string): string {
11297
s = s.replace(/Elapsed::?\s*\d+(?:\.\d+)?ms/g, "Elapsed:: *ms");
11398
s = s.replace(/"updateGraphDurationMs":\s*\d+(?:\.\d+)?/g, `"updateGraphDurationMs": *`);
11499
s = s.replace(/"createAutoImportProviderProgramDurationMs":\s*\d+(?:\.\d+)?/g, `"createAutoImportProviderProgramDurationMs": *`);
@@ -138,7 +123,7 @@ function sanitizeHarnessLSException(s: string) {
138123
return s;
139124
}
140125

141-
export function sanitizeLibFileText(s: string): string {
126+
function sanitizeLibFileText(s: string): string {
142127
Compiler.libFileNameSourceFileMap?.forEach((lib, fileName) => {
143128
s = replaceAll(s, JSON.stringify(lib.text), `${fileName}-Text`);
144129
s = replaceAll(s, lib.text, `${fileName}-Text`);

src/harness/watchUtils.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@ import {
66
createMultiMap,
77
Debug,
88
FileWatcher,
9-
FileWatcherCallback,
109
GetCanonicalFileName,
1110
MultiMap,
12-
PollingInterval,
1311
} from "./_namespaces/ts";
1412

15-
export interface TestFileWatcher {
16-
cb: FileWatcherCallback;
17-
pollingInterval: PollingInterval;
18-
}
19-
20-
export interface TestFsWatcher<DirCallback> {
21-
cb: DirCallback;
22-
inode: number | undefined;
23-
}
24-
2513
export interface Watches<Data> {
2614
add(path: string, data: Data): void;
2715
remove(path: string, data: Data): void;
@@ -154,7 +142,7 @@ export function createWatchUtils<PollingWatcherData, FsWatcherData>(
154142
}
155143
}
156144

157-
export function serializeMultiMap<T>(baseline: string[], caption: string, multiMap: MultiMap<string, T>, serialized: Map<string, T[]> | undefined) {
145+
function serializeMultiMap<T>(baseline: string[], caption: string, multiMap: MultiMap<string, T>, serialized: Map<string, T[]> | undefined) {
158146
let hasChange = diffMap(baseline, caption, multiMap, serialized, /*deleted*/ false);
159147
hasChange = diffMap(baseline, caption, serialized, multiMap, /*deleted*/ true) || hasChange;
160148
if (hasChange) {

0 commit comments

Comments
 (0)