Skip to content

Commit 31b14ac

Browse files
Enable require-description-when-disabling lint rule on create-cloudflare (#13710)
1 parent c5bcdfa commit 31b14ac

9 files changed

Lines changed: 30 additions & 32 deletions

File tree

.oxlintrc.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@
202202
// TODO: Remove the following overrides.
203203
{
204204
"files": [
205-
"packages/create-cloudflare/**",
206205
"packages/local-explorer-ui/**",
207206
"packages/miniflare/**",
208207
"packages/quick-edit-extension/**",

packages/create-cloudflare/e2e/helpers/framework-helpers.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function runC3ForFrameworkTest(
7676

7777
const match = output.replaceAll("\n", "").match(deployedUrlRe);
7878
if (!match || !match[1]) {
79-
// eslint-disable-next-line no-console
79+
// eslint-disable-next-line no-console -- we dump raw C3 output for tests debugging
8080
console.error(output);
8181
expect(false, "Couldn't find deployment url in C3 output").toBe(true);
8282
return "";
@@ -87,8 +87,7 @@ export async function runC3ForFrameworkTest(
8787

8888
export function updateWranglerConfig(
8989
projectPath: string,
90-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
91-
handleUpdate: <T extends Record<string, any>>(config: T) => T
90+
handleUpdate: <T extends Record<string, unknown>>(config: T) => T
9291
) {
9392
const wranglerTomlPath = join(projectPath, "wrangler.toml");
9493
const wranglerJsoncPath = join(projectPath, "wrangler.jsonc");
@@ -131,7 +130,7 @@ export async function addTestVarsToWranglerToml(projectPath: string) {
131130
return {
132131
...config,
133132
vars: {
134-
...config.vars,
133+
...(config.vars as Record<string, unknown>),
135134
TEST: "C3_TEST",
136135
},
137136
};
@@ -223,7 +222,7 @@ export async function verifyDevScript(
223222
restoreConfig = updateWranglerConfig(projectPath, (config) => ({
224223
...config,
225224
vars: {
226-
...config.vars,
225+
...(config.vars as Record<string, unknown>),
227226
...updatedVars,
228227
},
229228
}));

packages/create-cloudflare/e2e/helpers/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,15 @@ export const test = originalTest.extend<{
9191
const { logPath, logStream } = createTestLogStream(task);
9292

9393
onTestFailed(() => {
94-
// eslint-disable-next-line no-console
94+
// eslint-disable no-console -- raw console outputs for testing logs
9595
console.error("##[group]Logs from failed test:", logPath);
9696
try {
97-
// eslint-disable-next-line no-console
9897
console.error(readFileSync(logPath, "utf8"));
9998
} catch {
100-
// eslint-disable-next-line no-console
10199
console.error("Unable to read log file");
102100
}
103-
// eslint-disable-next-line no-console
104101
console.error("##[endgroup]");
102+
// eslint-enable no-console
105103
});
106104

107105
await use(logStream);

packages/create-cloudflare/e2e/helpers/log-stream.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ export function createTestLogStream(task: RunnerTask) {
2020

2121
export function recreateLogFolder(suite: RunnerTestSuite) {
2222
// Clean the old folder if exists (useful for dev)
23-
//
24-
// Note: this is intentionally inlined rather than importing `removeDirSync`
25-
// from `@cloudflare/workers-utils`. That package's barrel export pulls in CJS
26-
// dependencies (e.g. `xdg-app-paths`) that break when Vite bundles the vitest
27-
// config (which imports this file) into ESM — the shimmed `require()` calls
28-
// throw "Dynamic require of 'path' is not supported".
29-
// Keep aligned with `removeDirSync()` in `packages/workers-utils/src/fs-helpers.ts`.
30-
// eslint-disable-next-line workers-sdk/no-direct-recursive-rm
23+
24+
/* eslint-disable-next-line workers-sdk/no-direct-recursive-rm --
25+
Note: this is intentionally inlined rather than importing `removeDirSync`
26+
from `@cloudflare/workers-utils`. That package's barrel export pulls in CJS
27+
dependencies (e.g. `xdg-app-paths`) that break when Vite bundles the vitest
28+
config (which imports this file) into ESM — the shimmed `require()` calls
29+
throw "Dynamic require of 'path' is not supported".
30+
Keep aligned with `removeDirSync()` in `packages/workers-utils/src/fs-helpers.ts`.
31+
*/
3132
rmSync(getLogPath(suite), {
3233
recursive: true,
3334
force: true,

packages/create-cloudflare/e2e/helpers/to-exist.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ declare module "vitest" {
66
interface CustomMatchers<R = unknown> {
77
toExist(): R;
88
}
9-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
9+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- required by vitest's module augmentation pattern
1010
interface Assertion<T> extends CustomMatchers<T> {}
11-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
11+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- required by vitest's module augmentation pattern
1212
interface AsymmetricMatchersContaining extends CustomMatchers {}
1313
}
1414

packages/create-cloudflare/e2e/tests/cli/cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ describe("Create Cloudflare CLI", () => {
509509
throw new Error("Remote worker not found");
510510
}
511511
} catch {
512-
// eslint-disable-next-line no-console
512+
// eslint-disable-next-line no-console -- e2e setup logging for worker redeployment
513513
console.log(
514514
"Redeploying the existing-script-test-do-not-delete worker"
515515
);

packages/create-cloudflare/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const main = async (argv: string[]) => {
5252
}
5353

5454
if (result.errorMessage) {
55-
// eslint-disable-next-line no-console
55+
// eslint-disable-next-line no-console -- display raw error message before exit
5656
console.error(`\n${result.errorMessage}`);
5757
}
5858

packages/create-cloudflare/src/helpers/packageManagers.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,15 @@ export const rectifyPmMismatch = async (ctx: C3Context) => {
105105

106106
const nodeModulesPath = nodePath.join(ctx.project.path, "node_modules");
107107
if (existsSync(nodeModulesPath)) {
108-
// Note: this is intentionally inlined rather than importing `removeDirSync`
109-
// from `@cloudflare/workers-utils`. That package's barrel export pulls in CJS
110-
// dependencies (e.g. `xdg-app-paths`) that break when Vite bundles code into
111-
// ESM — the shimmed `require()` calls throw "Dynamic require of 'path' is not
112-
// supported". While the production build (esbuild → CJS) would handle this
113-
// fine, the e2e tests import this file through Vitest which uses Vite's bundler.
114-
// Keep aligned with `removeDirSync()` in `packages/workers-utils/src/fs-helpers.ts`.
115-
// eslint-disable-next-line workers-sdk/no-direct-recursive-rm
108+
/* eslint-disable-next-line workers-sdk/no-direct-recursive-rm --
109+
Note: this is intentionally inlined rather than importing `removeDirSync`
110+
from `@cloudflare/workers-utils`. That package's barrel export pulls in CJS
111+
dependencies (e.g. `xdg-app-paths`) that break when Vite bundles code into
112+
ESM — the shimmed `require()` calls throw "Dynamic require of 'path' is not
113+
supported". While the production build (esbuild → CJS) would handle this
114+
fine, the e2e tests import this file through Vitest which uses Vite's bundler.
115+
Keep aligned with `removeDirSync()` in `packages/workers-utils/src/fs-helpers.ts`.
116+
*/
116117
rmSync(nodeModulesPath, {
117118
recursive: true,
118119
force: true,

packages/create-cloudflare/src/helpers/sparrow.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function hasSparrowSourceKey() {
1818

1919
export async function sendEvent(payload: EventPayload, enableLog?: boolean) {
2020
if (enableLog) {
21-
// eslint-disable-next-line no-console
21+
// eslint-disable-next-line no-console -- intentional raw debug logging for telemetry diagnostics
2222
console.log("[telemetry]", JSON.stringify(payload, null, 2));
2323
}
2424

@@ -34,7 +34,7 @@ export async function sendEvent(payload: EventPayload, enableLog?: boolean) {
3434
} catch (error) {
3535
// Ignore any network errors
3636
if (enableLog) {
37-
// eslint-disable-next-line no-console
37+
// eslint-disable-next-line no-console -- intentional raw debug logging for telemetry diagnostics
3838
console.log("[telemetry]", error);
3939
}
4040
}

0 commit comments

Comments
 (0)