@oxlint-types/define-config 0.0.0 → 0.0.1
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 +56 -0
- package/dist/index.d.ts +2546 -3
- package/dist/index.js +1 -2
- package/package.json +21 -23
package/README.md
CHANGED
|
@@ -24,6 +24,62 @@ yarn add @oxlint-types/define-config
|
|
|
24
24
|
pnpm add @oxlint-types/define-config
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { defineConfig } from '@oxlint-types/define-config'
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
plugins: ['react', 'typescript', 'import'],
|
|
34
|
+
rules: {
|
|
35
|
+
eqeqeq: 'warn',
|
|
36
|
+
'import/no-cycle': 'error',
|
|
37
|
+
'react/self-closing-comp': ['error', { html: false }],
|
|
38
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`rules` keys are generated from `oxlint --rules`, so built-in rules have autocompletion and typo checks.
|
|
44
|
+
Rule options are parsed from Oxc Rust rule sources (`declare_oxc_lint!(..., config = ...)`) and generated into `BuiltinRuleOptionsByName`, then merged with your `RuleOptionsPatch` overrides.
|
|
45
|
+
|
|
46
|
+
## Regenerate Rules
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
pnpm rules:generate
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This command updates plugin-level generated files under [src/plugins](src/plugins):
|
|
53
|
+
|
|
54
|
+
- [src/plugins/index.generated.ts](src/plugins/index.generated.ts)
|
|
55
|
+
- [src/plugins/\*.generated.ts](src/plugins)
|
|
56
|
+
|
|
57
|
+
It also writes a compatibility re-export in [src/rules/generated.ts](src/rules/generated.ts).
|
|
58
|
+
The generator script is [scripts/generate-rules.ts](scripts/generate-rules.ts).
|
|
59
|
+
|
|
60
|
+
## Patch Rule Types (Persistent Across Updates)
|
|
61
|
+
|
|
62
|
+
To customize options for specific rules, augment `RuleOptionsPatch`:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
declare module '@oxlint-types/define-config' {
|
|
66
|
+
interface RuleOptionsPatch {
|
|
67
|
+
'react/self-closing-comp': {
|
|
68
|
+
html?: boolean
|
|
69
|
+
component?: boolean
|
|
70
|
+
}
|
|
71
|
+
'custom/my-rule': {
|
|
72
|
+
enabled: boolean
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The patch type lives in [src/rules/patch.ts](src/rules/patch.ts), and is never auto-generated.
|
|
79
|
+
When you run `pnpm rules:generate` later, your patch interfaces still apply.
|
|
80
|
+
|
|
81
|
+
When both generated and patched option types exist for a rule key, patch type takes precedence.
|
|
82
|
+
|
|
27
83
|
## Credits
|
|
28
84
|
|
|
29
85
|
- [eslint-define-config](https://github.com/eslint-types/eslint-define-config) create by [Shinigami92](https://github.com/Shinigami92)
|