Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Keep URL parsing and builders in a feature's `*-params.ts`. A shared URL belongs

Parse page search parameters on the server and pass the values to client components. When a persistent layout needs the current query after client navigation, import Next.js `useSearchParams` from within `src/lib/next-route-params.ts` and expose a hook from that module.

Use Next Image for page images. The shared `src/components/ui/image.tsx` and `src/components/ui/icon.tsx` primitives may use a native image for intrinsic sizing, load or error state, or a CSS mask. In `src/lib/navigation-link.tsx`, a disabled link may use a span with `role="link"` and `aria-disabled="true"` so it keeps its accessible role without a navigable URL.

Keep HTTP work in the API or a Server Action. Next permits `src/app/health/route.ts` exporting only `GET`, and `src/app/mcp/route.ts` for MCP. A streaming handler under `src/app/api/**/route.ts` must contain `text/event-stream`, call a `.to*StreamResponse()` helper, or have a static value import from a module named `<feature>-stream.server.ts` (the `.ts` extension may be omitted). Type-only imports do not mark a route as streaming. Forward the stream from that module; a cancellable JSON response alone does not qualify.

API tests, test utilities and fixtures may use `fetch` when the same file starts a local server with `.listen(<numeric port>)`, including `.listen(0)`. MSW's `.listen({ ... })` still requires `onUnhandledRequest: "error"` (or `onUnhandledFrame: "error"` in MSW 3). Use `testClient()` for `/api` paths; direct `app.request(...)` or `createApp().request(...)` is allowed for literal paths outside `/api`, including static template literals.
Expand Down
12 changes: 12 additions & 0 deletions oxlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,18 @@
"unicorn/prefer-code-point": "off"
},
"overrides": [
{
"files": ["apps/web/src/components/ui/image.tsx", "apps/web/src/components/ui/icon.tsx"],
"rules": {
"nextjs/no-img-element": "off"
}
},
{
"files": ["apps/web/src/lib/navigation-link.tsx"],
"rules": {
"jsx-a11y/prefer-tag-over-role": "off"
}
},
{
"files": ["**/src/app/**", "**/src/pages/**", "**/*.config.*"],
"rules": {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mapringg/standard",
"version": "1.2.5",
"version": "1.2.6",
"description": "One oxlint config and plugin for every repository.",
"license": "MIT",
"repository": "github:mapringg/standard",
Expand Down
19 changes: 19 additions & 0 deletions test/builtin-options.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ import { test } from "node:test";

import { lint } from "./lint.mjs";

test("native image and disabled link exceptions are scoped to their shared primitives", (t) => {
const image = 'export function Picture() { return <img src="/sample.png" alt="" />; }\n';
const disabled = 'export function Link() { return <span role="link" aria-disabled="true" />; }\n';
const diagnostics = lint(t, {
"apps/web/src/components/ui/image.tsx": image,
"apps/web/src/components/ui/icon.tsx": image,
"apps/web/src/features/search/search-card.tsx": image,
"apps/web/src/lib/navigation-link.tsx": disabled,
"apps/web/src/features/search/search-link.tsx": disabled,
});
deepEqual(
diagnostics
.filter(({ rule }) => rule === "next(no-img-element)" || rule === "jsx-a11y(prefer-tag-over-role)")
.map(({ file }) => file)
.sort(),
["apps/web/src/features/search/search-card.tsx", "apps/web/src/features/search/search-link.tsx"],
);
});

const RULES = new Set([
"typescript(promise-function-async)",
"eslint(class-methods-use-this)",
Expand Down
Loading