Skip to content

Commit f6b9857

Browse files
chore: add example with oxlint (#83842)
### What? This PR adds an example on how to lint your app with Oxlint ### Why? As an example to user another linter than Biome or ESLint. --------- Co-authored-by: Joseph <[email protected]> Co-authored-by: Joseph <[email protected]>
1 parent a096e3e commit f6b9857

File tree

7 files changed

+167
-0
lines changed

7 files changed

+167
-0
lines changed

examples/with-oxlint/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "./node_modules/oxlint/configuration_schema.json",
3+
"plugins": ["react", "unicorn", "oxc", "typescript", "nextjs"]
4+
}

examples/with-oxlint/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Oxlint Example
2+
3+
This example shows how to configure [Oxlint](https://oxc.rs/docs/guide/usage/linter) to work with a Next.js application.
4+
5+
Linting via Oxlint in this example includes type-aware linting through the `oxlint-tsgolint` integration, which is [in technical preview](https://oxc.rs/blog/2025-08-17-oxlint-type-aware.html) at the time of writing.
6+
7+
In [`.oxlintrc.json`](./.oxlintrc.json), the plugins `react`, `unicorn`, `typescript`, `nextjs`, and `oxc` are enabled.
8+
9+
The first four are [Rust-based Oxlint plugins](https://oxc.rs/docs/guide/usage/linter/plugins.html#supported-plugins) that port rules from the corresponding ESLint plugins.
10+
11+
The `oxc` plugin provides Oxc-specific rules along with some rules ported from Deepscan.
12+
13+
## Deploy your own
14+
15+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-oxlint&project-name=with-oxlint&repository-name=with-oxlint)
16+
17+
## How to use
18+
19+
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
20+
21+
```bash
22+
npx create-next-app --example with-oxlint with-oxlint-app
23+
```
24+
25+
```bash
26+
yarn create next-app --example with-oxlint with-oxlint-app
27+
```
28+
29+
```bash
30+
pnpm create next-app --example with-oxlint with-oxlint-app
31+
```
32+
33+
## Linting the application
34+
35+
36+
```bash
37+
npm run lint
38+
```
39+
40+
```bash
41+
yarn lint
42+
```
43+
44+
```bash
45+
pnpm lint
46+
```
47+
48+
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Metadata } from "next";
2+
3+
export const metadata: Metadata = {
4+
title: "Create Next App",
5+
description: "Generated by create next app",
6+
};
7+
8+
export default function RootLayout({
9+
children,
10+
}: Readonly<{
11+
children: React.ReactNode;
12+
}>) {
13+
return (
14+
<html lang="en">
15+
<body>{children}</body>
16+
</html>
17+
);
18+
}

examples/with-oxlint/app/page.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function Home() {
2+
return (
3+
<main>
4+
<div>Hello world!</div>
5+
</main>
6+
);
7+
}

examples/with-oxlint/package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "next dev --turbopack",
5+
"build": "oxlint --type-aware && next build",
6+
"start": "next start",
7+
"lint": "oxlint --type-aware"
8+
},
9+
"dependencies": {
10+
"next": "latest",
11+
"react": "^19.0.0",
12+
"react-dom": "^19.0.0"
13+
},
14+
"devDependencies": {
15+
"@types/node": "^20",
16+
"@types/react": "^19",
17+
"@types/react-dom": "^19",
18+
"oxlint": "1.15.0",
19+
"oxlint-tsgolint": "0.2.0",
20+
"typescript": "^5"
21+
}
22+
}

examples/with-oxlint/tsconfig.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2017",
4+
"lib": ["dom", "dom.iterable", "esnext"],
5+
"allowJs": true,
6+
"skipLibCheck": true,
7+
"strict": true,
8+
"noEmit": true,
9+
"esModuleInterop": true,
10+
"module": "esnext",
11+
"moduleResolution": "bundler",
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"jsx": "react-jsx",
15+
"incremental": true,
16+
"plugins": [
17+
{
18+
"name": "next"
19+
}
20+
],
21+
"paths": {
22+
"@/*": ["./*"]
23+
}
24+
},
25+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26+
"exclude": ["node_modules"]
27+
}

0 commit comments

Comments
 (0)