@sonsu-lee/oxlint-config 0.1.0 → 0.2.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 +15 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +29 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ Returns a complete Oxlint root config. Oxlint's `correctness`, `suspicious`, `pe
|
|
|
68
68
|
| `nextjs` | `false` | Next.js core-web-vitals rules; enables React |
|
|
69
69
|
| `tanstackQuery` | `false` | Enables React and two cache rules. Install the peer with `pnpm add -D @tanstack/eslint-plugin-query` |
|
|
70
70
|
| `xstate` | `false` | Five XState v5 machine rules; independent of React |
|
|
71
|
+
| `stylex` | `false` | StyleX rules; install the peer with `pnpm add -D @stylexjs/eslint-plugin` |
|
|
71
72
|
| `vitest` | `false` | Vitest plugin for `*.test.*`, `*.spec.*`, and `*.e2e-spec.*` files |
|
|
72
73
|
| `nestjs` | `false` | Allows code the NestJS CLI generates. Needs `typescript` and turns on `node` |
|
|
73
74
|
|
|
@@ -276,6 +277,20 @@ preset(
|
|
|
276
277
|
|
|
277
278
|
The profile does not impose this list: a project's root `no-restricted-imports` replaces the whole inherited rule.
|
|
278
279
|
|
|
280
|
+
### StyleX
|
|
281
|
+
|
|
282
|
+
**Failure it prevents.** A property or value that StyleX cannot compile never reaches the stylesheet, and nothing else reports it. A multi-value shorthand such as `padding: '10px 20px'` is one of those: StyleX wants one property per value. A `className` or `style` prop next to a `stylex.props()` spread competes with the compiled class, and which one wins depends on the order of the rules in the stylesheet.
|
|
283
|
+
|
|
284
|
+
**Reported:** `disply: 'flex'`, `padding: '10px 20px'`, and `<div {...stylex.props(styles.root)} className="row" />`.
|
|
285
|
+
|
|
286
|
+
**Allowed:** the supported property, `paddingTop` and `paddingBottom` in place of the shorthand, and the spread alone.
|
|
287
|
+
|
|
288
|
+
**Profile and severity.** `stylex` reports `valid-styles`, `valid-shorthands`, `no-conflicting-props`, `no-nonstandard-styles`, `no-legacy-contextual-styles`, and `no-unused` as errors. It warns about `no-lookahead-selectors`, which reports the browser support of `stylex.when.*` rather than a defect in the code. The profile loads `@stylexjs/eslint-plugin` as a JS plugin: that package is the official StyleX lint, and Oxlint has no built-in equivalent.
|
|
289
|
+
|
|
290
|
+
Two rules stay off. `sort-keys` orders the keys of a style object, which is the formatter's job and does not change the compiled output. `enforce-extension` requires every exported StyleX value to live in a `*.stylex.js` file: that is a project layout choice, and its options name the imports to track.
|
|
291
|
+
|
|
292
|
+
**What it cannot see.** A style object reached only through another file's import. `no-unused` treats an exported object as used, so the profile does not report that object as dead code.
|
|
293
|
+
|
|
279
294
|
## Import boundaries
|
|
280
295
|
|
|
281
296
|
Projects own their restricted paths. Use `paths` to prevent callers from bypassing an SDK wrapper or importing a retired package. Use `patterns` to keep another feature's internal modules private.
|
package/dist/index.d.mts
CHANGED
|
@@ -21,6 +21,8 @@ interface Options {
|
|
|
21
21
|
tanstackQuery?: boolean;
|
|
22
22
|
/** XState v5 machine rules. */
|
|
23
23
|
xstate?: boolean;
|
|
24
|
+
/** StyleX rules; needs @stylexjs/eslint-plugin. */
|
|
25
|
+
stylex?: boolean;
|
|
24
26
|
/** Vitest rules for test files. */
|
|
25
27
|
vitest?: boolean;
|
|
26
28
|
/** Adjusts the TypeScript rules for NestJS. Needs `typescript` and turns on `node`. */
|
package/dist/index.mjs
CHANGED
|
@@ -73,6 +73,33 @@ const react = {
|
|
|
73
73
|
"typescript/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }]
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
+
// src/configs/stylex.ts
|
|
77
|
+
function stylex() {
|
|
78
|
+
let specifier;
|
|
79
|
+
try {
|
|
80
|
+
specifier = import.meta.resolve("@stylexjs/eslint-plugin");
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new Error("stylex needs @stylexjs/eslint-plugin, but it is not installed.", { cause: error });
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
plugins: [],
|
|
86
|
+
jsPlugins: [{
|
|
87
|
+
name: "stylex",
|
|
88
|
+
specifier
|
|
89
|
+
}],
|
|
90
|
+
rules: {
|
|
91
|
+
"stylex/valid-styles": "error",
|
|
92
|
+
"stylex/valid-shorthands": "error",
|
|
93
|
+
"stylex/no-conflicting-props": "error",
|
|
94
|
+
"stylex/no-nonstandard-styles": "error",
|
|
95
|
+
"stylex/no-legacy-contextual-styles": "error",
|
|
96
|
+
"stylex/no-unused": "error",
|
|
97
|
+
"stylex/no-lookahead-selectors": "warn",
|
|
98
|
+
"stylex/sort-keys": "off",
|
|
99
|
+
"stylex/enforce-extension": "off"
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
76
103
|
// src/configs/tanstack-query.ts
|
|
77
104
|
function tanstackQuery() {
|
|
78
105
|
let specifier;
|
|
@@ -172,6 +199,7 @@ function selectProfiles(options, typeAwareOverride) {
|
|
|
172
199
|
nextjs: options.nextjs ?? false,
|
|
173
200
|
tanstackQuery: options.tanstackQuery ?? false,
|
|
174
201
|
xstate: options.xstate ?? false,
|
|
202
|
+
stylex: options.stylex ?? false,
|
|
175
203
|
vitest: options.vitest ?? false,
|
|
176
204
|
nestjs: options.nestjs ?? false
|
|
177
205
|
};
|
|
@@ -195,6 +223,7 @@ function preset(options = {}, userConfig = {}) {
|
|
|
195
223
|
[selected.nextjs, () => nextjs],
|
|
196
224
|
[selected.tanstackQuery, tanstackQuery],
|
|
197
225
|
[selected.xstate, () => xstate],
|
|
226
|
+
[selected.stylex, stylex],
|
|
198
227
|
[selected.vitest, () => vitest],
|
|
199
228
|
[selected.nestjs, () => nestjs]
|
|
200
229
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonsu-lee/oxlint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Oxlint preset with selectable profiles and @sonsu-lee/oxlint-plugin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,9 +22,10 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@sonsu-lee/oxlint-plugin": "^0.
|
|
25
|
+
"@sonsu-lee/oxlint-plugin": "^0.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@stylexjs/eslint-plugin": "0.19.2",
|
|
28
29
|
"@tanstack/eslint-plugin-query": "5.108.4",
|
|
29
30
|
"@types/node": "24.19.2",
|
|
30
31
|
"oxlint": "1.90.0",
|
|
@@ -34,11 +35,15 @@
|
|
|
34
35
|
"vitest": "5.0.5"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
38
|
+
"@stylexjs/eslint-plugin": "^0.19.0",
|
|
37
39
|
"@tanstack/eslint-plugin-query": "^5.108.0",
|
|
38
40
|
"oxlint": "^1.90.0",
|
|
39
41
|
"oxlint-tsgolint": "^7.0.0"
|
|
40
42
|
},
|
|
41
43
|
"peerDependenciesMeta": {
|
|
44
|
+
"@stylexjs/eslint-plugin": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
42
47
|
"@tanstack/eslint-plugin-query": {
|
|
43
48
|
"optional": true
|
|
44
49
|
}
|