Skip to content

Commit 8590828

Browse files
Enable require-description-when-disabling lint rule on the vite plugin (#13741)
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
1 parent 1127114 commit 8590828

28 files changed

Lines changed: 141 additions & 118 deletions

File tree

.oxlintrc.jsonc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@
205205
"packages/local-explorer-ui/**",
206206
"packages/miniflare/**",
207207
"packages/quick-edit-extension/**",
208-
"packages/vite-plugin-cloudflare/**",
209208
"packages/vitest-pool-workers/**",
210209
"packages/workers-editor-shared/**",
211210
"packages/workers-shared/**",

packages/vite-plugin-cloudflare/e2e/fixtures/basic/src/main.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { createRoot } from "react-dom/client";
33
import "./index.css";
44
import App from "./App.tsx";
55

6-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
7-
createRoot(document.getElementById("root")!).render(
8-
<StrictMode>
9-
<App />
10-
</StrictMode>
11-
);
6+
const rootElement = document.getElementById("root");
7+
if (rootElement) {
8+
createRoot(rootElement).render(
9+
<StrictMode>
10+
<App />
11+
</StrictMode>
12+
);
13+
}

packages/vite-plugin-cloudflare/playground/containers/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class Container extends DurableObject<Env> {
1010

1111
constructor(ctx: DurableObjectState, env: Env) {
1212
super(ctx, env);
13-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we know that the container is defined on ctx
1414
this.container = ctx.container!;
1515
}
1616

packages/vite-plugin-cloudflare/playground/external-workers/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default {
8181
const stream = await (
8282
await fetch("https://thispersondoesnotexist.com/")
8383
).body;
84-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
84+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- we are sure that at this point there will be a stream
8585
const transform = await env.IMAGES.input(stream!)
8686
.transform({ blur: 250 })
8787
.output({ format: "image/avif" });

packages/vite-plugin-cloudflare/playground/module-resolution/src/third-party/discord-api-types.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import { RPCErrorCodes, Utils } from "discord-api-types/v10";
1+
import {
2+
RPCErrorCodes,
3+
Utils,
4+
type APIButtonComponent,
5+
} from "discord-api-types/v10";
26

37
// resolving discord-api-types/v10 (package which uses `require()`s without extensions
48
// can be problematic, see: https://github.com/dario-piotrowicz/vitest-pool-workers-ext-repro)
59
export default {
610
"(discord-api-types/v10) Utils.isLinkButton({})": Utils.isLinkButton(
7-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8-
{} as any
11+
{} as APIButtonComponent
912
),
1013
"(discord-api-types/v10) RPCErrorCodes.InvalidUser":
1114
RPCErrorCodes.InvalidUser,

packages/vite-plugin-cloudflare/playground/node-compat/__tests__/worker-postgres/serve.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export async function preServe() {
1212
mockPg = await createMockPostgresServer({
1313
rows: [{ id: "21", name: "mock-row" }],
1414
});
15-
// eslint-disable-next-line turbo/no-undeclared-env-vars
15+
// eslint-disable-next-line turbo/no-undeclared-env-vars -- internal to the test process: set here, read by vite.config.worker-postgres.ts in the same run
1616
process.env.MOCK_PG_PORT = String(mockPg.port);
1717
}
1818

packages/vite-plugin-cloudflare/playground/node-compat/vite.config.worker-postgres.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default defineConfig({
1010
configPath: "./worker-postgres/wrangler.jsonc",
1111
// Inject the mock Postgres server port set by serve.ts preServe()
1212
config: () => {
13-
// eslint-disable-next-line turbo/no-undeclared-env-vars
13+
// eslint-disable-next-line turbo/no-undeclared-env-vars -- internal to the test process: set by serve.ts preServe(), not an external input
1414
const mockPgPort = process.env.MOCK_PG_PORT;
1515
if (mockPgPort) {
1616
return {

packages/vite-plugin-cloudflare/playground/node-compat/worker-process-populated-env/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export default {
88

99
function testProcessBehaviour() {
1010
try {
11-
// eslint-disable-next-line turbo/no-undeclared-env-vars
11+
// eslint-disable-next-line turbo/no-undeclared-env-vars -- Worker runtime code: populated via Worker bindings, not a Node.js process env var
1212
assert(process.env.FOO === "foo value", "process.env.FOO not populated");
13-
// eslint-disable-next-line turbo/no-undeclared-env-vars
13+
// eslint-disable-next-line turbo/no-undeclared-env-vars -- Worker runtime code: populated via Worker bindings, not a Node.js process env var
1414
assert(process.env.BAR === "bar secret", "process.env.BAR not populated");
1515

1616
const processEnvKeys = Object.keys(process.env).sort();

packages/vite-plugin-cloudflare/playground/node-env/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
React.createElement(
1010
"p",
1111
null,
12-
// eslint-disable-next-line turbo/no-undeclared-env-vars
12+
// eslint-disable-next-line turbo/no-undeclared-env-vars -- Worker runtime code: build-time replaced by Vite, not a Node.js process env var
1313
`The value of process.env.NODE_ENV is "${process.env.NODE_ENV}"`
1414
),
1515
])

packages/vite-plugin-cloudflare/playground/partyserver/src/main.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { StrictMode } from "react";
22
import { createRoot } from "react-dom/client";
33
import App from "./App.tsx";
44

5-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
6-
createRoot(document.getElementById("root")!).render(
7-
<StrictMode>
8-
<App />
9-
</StrictMode>
10-
);
5+
const rootElement = document.getElementById("root");
6+
if (rootElement) {
7+
createRoot(rootElement).render(
8+
<StrictMode>
9+
<App />
10+
</StrictMode>
11+
);
12+
}

0 commit comments

Comments
 (0)