@zgeoff/oxlint-config 0.0.1 → 0.0.3
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 +7 -3
- package/oxlintrc.json +2 -0
- package/package.json +1 -1
- package/plugin.js +13 -0
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@ Shareable [oxlint](https://oxc.rs/docs/guide/usage/linter.html) config: every ca
|
|
|
4
4
|
restriction-rule cherry-picks, comment-style enforcement via `@stylistic`, and a bundled JS plugin
|
|
5
5
|
(`zgeoff/*` rules) banning AST shapes no native oxlint rule can express — top-level arrows, nested
|
|
6
6
|
function declarations, bare named exports, destructured and inline-typed parameters, ternary and
|
|
7
|
-
await arguments.
|
|
7
|
+
await arguments, and awaits hidden inside a control-flow condition or a `&&`/`||`/`??` chain.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
bun add -d @zgeoff/oxlint-config oxlint
|
|
12
|
+
bun add -d @zgeoff/oxlint-config oxlint @stylistic/eslint-plugin
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Extend it from `.oxlintrc.json` — `extends` resolves file paths only, so point at the file inside
|
|
@@ -36,6 +36,10 @@ The plugin is addressable on its own at `@zgeoff/oxlint-config/plugin` for confi
|
|
|
36
36
|
## Notes
|
|
37
37
|
|
|
38
38
|
- The config enables the `typescript`, `unicorn`, `oxc`, `import`, and `promise` plugins and loads
|
|
39
|
-
`@stylistic/eslint-plugin`
|
|
39
|
+
`@stylistic/eslint-plugin` through `jsPlugins`. oxlint resolves `jsPlugins` specifiers from the
|
|
40
|
+
project root, not from the config file that names them — so `@stylistic/eslint-plugin` must be a
|
|
41
|
+
direct dependency of the consuming project. Hoisting package managers (bun's default linker, npm)
|
|
42
|
+
resolve it transitively anyway, but isolated layouts (pnpm, `bun install --linker isolated`) fail
|
|
43
|
+
with `Cannot find module '@stylistic/eslint-plugin'` unless it's installed directly.
|
|
40
44
|
- Type-aware rules activate under `oxlint --type-aware` (requires `oxlint-tsgolint`); the config
|
|
41
45
|
works without it.
|
package/oxlintrc.json
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
"zgeoff/no-pick-destructuring": "error",
|
|
24
24
|
"zgeoff/no-ternary-args": "error",
|
|
25
25
|
"zgeoff/no-await-args": "error",
|
|
26
|
+
"zgeoff/no-await-in-condition": "error",
|
|
27
|
+
"zgeoff/no-await-in-logical": "error",
|
|
26
28
|
|
|
27
29
|
// enforced comment style — line comments unless JSDoc or exclamation
|
|
28
30
|
"@stylistic/multiline-comment-style": [
|
package/package.json
CHANGED
package/plugin.js
CHANGED
|
@@ -75,6 +75,19 @@ const plugin = {
|
|
|
75
75
|
'Await into a named const instead of awaiting inside an argument list.',
|
|
76
76
|
['CallExpression > AwaitExpression.arguments', 'NewExpression > AwaitExpression.arguments'],
|
|
77
77
|
),
|
|
78
|
+
'no-await-in-condition': banSelectors(
|
|
79
|
+
'suggestion',
|
|
80
|
+
'Await into a named const before the statement instead of inside a control-flow condition.',
|
|
81
|
+
[
|
|
82
|
+
':matches(IfStatement, WhileStatement, DoWhileStatement, ForStatement, ConditionalExpression) > AwaitExpression.test',
|
|
83
|
+
'SwitchStatement > AwaitExpression.discriminant',
|
|
84
|
+
],
|
|
85
|
+
),
|
|
86
|
+
'no-await-in-logical': banSelectors(
|
|
87
|
+
'suggestion',
|
|
88
|
+
'Await into a named const instead of chaining it after a && / || / ?? operator.',
|
|
89
|
+
['LogicalExpression > AwaitExpression'],
|
|
90
|
+
),
|
|
78
91
|
},
|
|
79
92
|
};
|
|
80
93
|
|