Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 581ea40

Browse files
committed
Resolves #627
1 parent 98cb8c2 commit 581ea40

7 files changed

Lines changed: 435 additions & 9 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"ultracite": patch
3+
---
4+
5+
Add typed `ultracite/oxlint` exports for use in `oxlint.config.ts`.

apps/docs/provider/oxlint.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ Add framework presets as needed:
4949
}
5050
```
5151

52+
If you prefer `oxlint.config.ts`, use Ultracite's typed exports instead of importing the JSON presets directly:
53+
54+
```ts title="oxlint.config.ts"
55+
import { defineConfig } from "oxlint";
56+
57+
import { core, next, react } from "ultracite/oxlint";
58+
59+
export default defineConfig({
60+
extends: [core, react, next],
61+
});
62+
```
63+
5264
## Configuration Approach
5365

5466
Ultracite's Oxlint configuration uses an **opt-out** approach. This means we enable all rule categories at the `error` level, then selectively disable rules that are too strict or don't fit our opinionated defaults. This ensures maximum bug-catching coverage while avoiding noise.

packages/cli/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ npx ultracite init
1818

1919
The interactive setup will guide you through selecting your formatter/linter, framework, editor, and AI agents.
2020

21+
## Oxlint TypeScript Configs
22+
23+
If you're using `oxlint.config.ts`, import the typed presets instead of the raw JSON files:
24+
25+
```ts
26+
import { defineConfig } from "oxlint";
27+
28+
import { core, next, react } from "ultracite/oxlint";
29+
30+
export default defineConfig({
31+
extends: [core, react, next],
32+
});
33+
```
34+
2135
## Supported Tools
2236

2337
- **Biome** — All-in-one formatting and linting
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, expect, test } from "bun:test";
2+
import { join } from "node:path";
3+
import { parse } from "jsonc-parser";
4+
5+
import { configs, core, next, react } from "../src/oxlint";
6+
7+
const readOxlintConfig = async (name: string) => {
8+
const configPath = join(
9+
import.meta.dirname,
10+
`../config/oxlint/${name}/.oxlintrc.json`
11+
);
12+
const content = await Bun.file(configPath).text();
13+
const config = parse(content) as Record<string, unknown>;
14+
15+
delete config.$schema;
16+
17+
return config;
18+
};
19+
20+
describe("oxlint TypeScript exports", () => {
21+
for (const [name, config] of Object.entries(configs)) {
22+
test(`${name} matches the published JSON preset`, async () => {
23+
expect(config).toEqual(await readOxlintConfig(name));
24+
});
25+
}
26+
27+
test("core, react, and next compose in extends arrays", () => {
28+
expect([core, react, next]).toHaveLength(3);
29+
});
30+
});

packages/cli/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@
2424
},
2525
"files": [
2626
"config",
27-
"dist/index.js",
28-
"dist/index.d.ts",
27+
"dist",
2928
"README.md"
3029
],
3130
"type": "module",
3231
"exports": {
32+
"./oxlint": {
33+
"types": "./dist/oxlint.d.ts",
34+
"default": "./dist/oxlint.js"
35+
},
3336
"./biome/*": "./config/biome/*/biome.jsonc",
3437
"./eslint/*": "./config/eslint/*/eslint.config.mjs",
3538
"./oxlint/*": "./config/oxlint/*/.oxlintrc.json",

0 commit comments

Comments
 (0)