@letstri/oxc-config 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -34
- package/dist/index.d.mts +18 -6
- package/dist/index.mjs +15 -13
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -29,8 +29,12 @@ npx oxc-config init --vscode --zed # just the editor settings
|
|
|
29
29
|
|
|
30
30
|
With flags, only the chosen targets run; with none in a non-interactive shell,
|
|
31
31
|
all four run. Config files are skipped if they already exist (`--force` to
|
|
32
|
-
overwrite); editor settings are deep-merged into any existing
|
|
33
|
-
|
|
32
|
+
overwrite); editor settings (VS Code + Zed) are deep-merged into any existing
|
|
33
|
+
files, so your other settings are kept.
|
|
34
|
+
|
|
35
|
+
VS Code also needs the [`oxc.oxc-vscode`](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode)
|
|
36
|
+
extension (the CLI adds it to `.vscode/extensions.json`). Zed has the oxc
|
|
37
|
+
language servers built in.
|
|
34
38
|
|
|
35
39
|
## Usage
|
|
36
40
|
|
|
@@ -89,7 +93,7 @@ export default oxlintConfig({ rules: { 'no-console': 'off' } }, { plugins: ['vue
|
|
|
89
93
|
### Tailwind
|
|
90
94
|
|
|
91
95
|
`tailwindPlugin({ entryPoint })` returns a config chunk for
|
|
92
|
-
[`
|
|
96
|
+
[`oxlint-tailwindcss`](https://github.com/sergioazoc/oxlint-tailwindcss) (Tailwind v4).
|
|
93
97
|
Pass it as an argument to `oxlintConfig`:
|
|
94
98
|
|
|
95
99
|
```ts
|
|
@@ -107,7 +111,18 @@ ones above rather than overwriting them.
|
|
|
107
111
|
Options:
|
|
108
112
|
|
|
109
113
|
- `entryPoint` (required) — your Tailwind entry CSS, so the plugin can resolve
|
|
110
|
-
class names.
|
|
114
|
+
class names. In a monorepo, pass an array of glob → CSS mappings (last match
|
|
115
|
+
wins, so end with a `'**'` catch-all):
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
tailwindPlugin({
|
|
119
|
+
entryPoint: [
|
|
120
|
+
{ files: 'packages/ui/**', use: 'packages/ui/src/styles.css' },
|
|
121
|
+
{ files: '**', use: 'src/global.css' },
|
|
122
|
+
],
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
111
126
|
- `ignoreClasses` — class names to exempt from `no-unknown-classes` (e.g. classes
|
|
112
127
|
a component library generates that the plugin can't resolve):
|
|
113
128
|
|
|
@@ -118,36 +133,7 @@ Options:
|
|
|
118
133
|
The plugin is an **optional peer dependency** — install it yourself:
|
|
119
134
|
|
|
120
135
|
```bash
|
|
121
|
-
pnpm add -D
|
|
136
|
+
pnpm add -D oxlint-tailwindcss
|
|
122
137
|
```
|
|
123
138
|
|
|
124
139
|
If the plugin is missing, `tailwindPlugin()` throws with an install hint.
|
|
125
|
-
|
|
126
|
-
## Editor setup
|
|
127
|
-
|
|
128
|
-
Both editors use the official [oxc](https://oxc.rs) tooling — `oxlint` for
|
|
129
|
-
linting and `oxfmt` for formatting — replacing ESLint and Prettier.
|
|
130
|
-
|
|
131
|
-
`oxc-config init` writes (or updates) the editor configs for you, deep-merging
|
|
132
|
-
into any existing files so your other settings are kept:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
# both editors
|
|
136
|
-
pnpm exec oxc-config init --vscode --zed
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
It's idempotent — safe to re-run to pull the latest recommended settings.
|
|
140
|
-
|
|
141
|
-
### VS Code
|
|
142
|
-
|
|
143
|
-
Install the [`oxc.oxc-vscode`](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode)
|
|
144
|
-
extension (`init --vscode` also adds it to `.vscode/extensions.json`). It writes
|
|
145
|
-
`.vscode/settings.json` — oxlint as linter, oxfmt as the default formatter with
|
|
146
|
-
format-on-save, and Prettier's import organization turned off.
|
|
147
|
-
|
|
148
|
-
### Zed
|
|
149
|
-
|
|
150
|
-
Zed ships with the oxc language servers built in, so no extension is needed.
|
|
151
|
-
`init --zed` writes `.zed/settings.json` — oxfmt as the formatter (with
|
|
152
|
-
`source.fixAll.oxc` on save for JS/TS) and Prettier disabled, across the file
|
|
153
|
-
types oxfmt supports.
|
package/dist/index.d.mts
CHANGED
|
@@ -60,10 +60,23 @@ declare function oxfmtConfig(...overrides: OxfmtOptions[]): OxfmtOptions;
|
|
|
60
60
|
//#region src/tailwind.d.ts
|
|
61
61
|
interface TailwindOptions {
|
|
62
62
|
/**
|
|
63
|
-
* Path to the Tailwind entry CSS
|
|
64
|
-
*
|
|
63
|
+
* Path to the Tailwind entry CSS, so the plugin can resolve class names.
|
|
64
|
+
* Required. In a monorepo, pass an array of glob → CSS mappings; the last
|
|
65
|
+
* matching entry wins, so end with a `'**'` catch-all.
|
|
66
|
+
*
|
|
67
|
+
* @example 'src/global.css'
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* [
|
|
71
|
+
* { files: 'packages/ui/**', use: 'packages/ui/src/styles.css' },
|
|
72
|
+
* { files: '**', use: 'src/global.css' },
|
|
73
|
+
* ]
|
|
74
|
+
* ```
|
|
65
75
|
*/
|
|
66
|
-
entryPoint: string
|
|
76
|
+
entryPoint: string | {
|
|
77
|
+
files: string;
|
|
78
|
+
use: string;
|
|
79
|
+
}[];
|
|
67
80
|
/**
|
|
68
81
|
* Class names to exempt from `no-unknown-classes` — e.g. classes generated by
|
|
69
82
|
* component libraries that the plugin can't resolve from the entry CSS.
|
|
@@ -77,7 +90,7 @@ interface TailwindOptions {
|
|
|
77
90
|
cwd?: string;
|
|
78
91
|
}
|
|
79
92
|
/**
|
|
80
|
-
* Tailwind linting via [`
|
|
93
|
+
* Tailwind v4 linting via [`oxlint-tailwindcss`](https://github.com/sergioazoc/oxlint-tailwindcss).
|
|
81
94
|
* Pass the result as an argument to `oxlintConfig`:
|
|
82
95
|
*
|
|
83
96
|
* ```ts
|
|
@@ -88,8 +101,7 @@ interface TailwindOptions {
|
|
|
88
101
|
* ```
|
|
89
102
|
*
|
|
90
103
|
* The plugin is an optional peer dependency — install it yourself
|
|
91
|
-
* (`pnpm add -D
|
|
92
|
-
* is thrown.
|
|
104
|
+
* (`pnpm add -D oxlint-tailwindcss`). If it is missing, an error is thrown.
|
|
93
105
|
*/
|
|
94
106
|
declare function tailwindPlugin({ entryPoint, ignoreClasses, cwd }: TailwindOptions): OxlintConfig;
|
|
95
107
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -583,9 +583,9 @@ function oxfmtConfig(...overrides) {
|
|
|
583
583
|
}
|
|
584
584
|
//#endregion
|
|
585
585
|
//#region src/tailwind.ts
|
|
586
|
-
const TAILWIND_PLUGIN = "
|
|
586
|
+
const TAILWIND_PLUGIN = "oxlint-tailwindcss";
|
|
587
587
|
/**
|
|
588
|
-
* Tailwind linting via [`
|
|
588
|
+
* Tailwind v4 linting via [`oxlint-tailwindcss`](https://github.com/sergioazoc/oxlint-tailwindcss).
|
|
589
589
|
* Pass the result as an argument to `oxlintConfig`:
|
|
590
590
|
*
|
|
591
591
|
* ```ts
|
|
@@ -596,23 +596,25 @@ const TAILWIND_PLUGIN = "eslint-plugin-better-tailwindcss";
|
|
|
596
596
|
* ```
|
|
597
597
|
*
|
|
598
598
|
* The plugin is an optional peer dependency — install it yourself
|
|
599
|
-
* (`pnpm add -D
|
|
600
|
-
* is thrown.
|
|
599
|
+
* (`pnpm add -D oxlint-tailwindcss`). If it is missing, an error is thrown.
|
|
601
600
|
*/
|
|
602
601
|
function tailwindPlugin({ entryPoint, ignoreClasses = [], cwd = process.cwd() }) {
|
|
603
602
|
if (!getInstalledPackages(cwd).has(TAILWIND_PLUGIN)) throw new Error(`[@letstri/oxc-config] Tailwind linting needs "${TAILWIND_PLUGIN}". Install it: pnpm add -D ${TAILWIND_PLUGIN}`);
|
|
604
603
|
return defineConfig({
|
|
605
604
|
jsPlugins: [TAILWIND_PLUGIN],
|
|
606
|
-
settings: {
|
|
605
|
+
settings: { tailwindcss: { entryPoint } },
|
|
607
606
|
rules: {
|
|
608
|
-
"
|
|
609
|
-
"
|
|
610
|
-
"
|
|
611
|
-
"
|
|
612
|
-
"
|
|
613
|
-
"
|
|
614
|
-
"
|
|
615
|
-
"
|
|
607
|
+
"tailwindcss/enforce-sort-order": "error",
|
|
608
|
+
"tailwindcss/enforce-consistent-line-wrapping": "off",
|
|
609
|
+
"tailwindcss/no-unnecessary-whitespace": "off",
|
|
610
|
+
"tailwindcss/enforce-canonical": "error",
|
|
611
|
+
"tailwindcss/consistent-variant-order": "error",
|
|
612
|
+
"tailwindcss/enforce-consistent-important-position": "error",
|
|
613
|
+
"tailwindcss/no-conflicting-classes": "error",
|
|
614
|
+
"tailwindcss/no-deprecated-classes": "error",
|
|
615
|
+
"tailwindcss/no-duplicate-classes": "error",
|
|
616
|
+
"tailwindcss/no-unnecessary-arbitrary-value": "warn",
|
|
617
|
+
"tailwindcss/no-unknown-classes": ["error", { allowlist: ignoreClasses }]
|
|
616
618
|
}
|
|
617
619
|
});
|
|
618
620
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@letstri/oxc-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Opinionated Oxlint and Oxfmt configs",
|
|
5
5
|
"homepage": "https://github.com/letstri/oxc-config#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"typescript": "^6.0.3"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"eslint-plugin-better-tailwindcss": ">=4",
|
|
50
49
|
"oxfmt": ">=0.58.0",
|
|
51
|
-
"oxlint": ">=1.73.0"
|
|
50
|
+
"oxlint": ">=1.73.0",
|
|
51
|
+
"oxlint-tailwindcss": ">=1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
|
-
"
|
|
54
|
+
"oxlint-tailwindcss": {
|
|
55
55
|
"optional": true
|
|
56
56
|
}
|
|
57
57
|
},
|