Skip to content

Add oxlint and oxfmt#5

Merged
mmkal merged 5 commits into
mainfrom
mmkal/26/05/19/add-oxlint-oxfmt
May 20, 2026
Merged

Add oxlint and oxfmt#5
mmkal merged 5 commits into
mainfrom
mmkal/26/05/19/add-oxlint-oxfmt

Conversation

@mmkal
Copy link
Copy Markdown
Contributor

@mmkal mmkal commented May 19, 2026

Summary

Adds oxlint and oxfmt to Captun's local workflow:

  • wires format, format:check, lint, lint:check, and lint:fix scripts into package.json
  • adds .oxlintrc.json with Captun-scoped ignores, correctness rules, and test-file overrides
  • updates the existing code and tests to pass oxlint/oxfmt without changing runtime behavior
  • adds oxlint-plugin-captun.js, a local JS plugin with captun/* rules for the project's preferred test style

The custom test rules reject lifecycle hooks, describe wrappers, vi.mock/vi.doMock, helpers declared above tests, and property-level equality checks where toMatchObject is clearer. The rules are scoped to test files through oxlint override globs, so the plugin can grow later without carrying test-file path checks in every rule.

Example

Before:

import { afterEach, beforeEach, describe, expect, test } from "vitest";

let server: Awaited<ReturnType<typeof startServer>>;

describe("weather API", () => {
  beforeEach(async () => {
    server = await startServer({ fixtures: ["rain"] });
  });

  afterEach(async () => {
    await shutDownServer(server);
  });

  test("returns the current forecast", async () => {
    const response = await fetchWeather(server.url, "london");

    expect(response.status).toBe(200);
  });
});

After:

import { expect, test } from "vitest";

test("weather API returns the current forecast", async () => {
  await using server = await startServerFixture({ fixtures: ["rain"] });

  const response = await fetchWeather(server.url, "london");

  expect(response).toMatchObject({ status: 200 });
});

async function startServerFixture(options: { fixtures: string[] }) {
  const server = await startServer(options);
  return {
    url: server.url,
    async [Symbol.asyncDispose]() {
      await shutDownServer(server);
    },
  };
}

Verification

  • pnpm run check
  • pnpm test

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 19, 2026

Open in StackBlitz

npm i https://pkg.pr.new/captun@5

commit: 510e916

Comment thread oxlint-plugin-captun.js
Comment thread test/oxlint-plugin-captun-test.test.ts Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 67d9f06. Configure here.

Comment thread oxlint-plugin-captun-test.js Outdated
Comment thread oxlint-plugin-captun-test.js Outdated
Comment thread .oxlintrc.json Outdated
Comment thread oxlint-plugin-captun-test.js Outdated
Comment thread oxlint-plugin-captun.js
@mmkal mmkal merged commit aa6af7c into main May 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant