@standard-config/oxlint 1.9.0 → 2.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 +122 -17
- package/dist/index.d.mts +57 -19
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +201 -167
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -12
package/README.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/standard-config/oxlint">
|
|
3
|
+
<img
|
|
4
|
+
src="https://github.com/standard-config/.github/blob/main/.github/assets/standard-config-oxlint@3x.png?raw=true"
|
|
5
|
+
width="500"
|
|
6
|
+
alt=""
|
|
7
|
+
/>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<h1 align="center">@standard‑config/oxlint</h1>
|
|
12
|
+
|
|
13
|
+
<p align="center">Curated Oxlint config with sensible defaults.</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://npmx.dev/package/@standard-config/oxlint"
|
|
17
|
+
><img
|
|
18
|
+
src="https://img.shields.io/npm/v/%40standard-config%2Foxlint?style=flat-square"
|
|
19
|
+
alt=""
|
|
20
|
+
/></a>
|
|
21
|
+
<a href="https://github.com/standard-config/oxlint/actions/workflows/test.yaml"
|
|
22
|
+
><img
|
|
23
|
+
src="https://img.shields.io/github/actions/workflow/status/standard-config/oxlint/test.yaml?style=flat-square"
|
|
24
|
+
alt=""
|
|
25
|
+
/></a>
|
|
26
|
+
<a href="https://codecov.io/github/standard-config/oxlint"
|
|
27
|
+
><img
|
|
28
|
+
src="https://img.shields.io/codecov/c/github/standard-config/oxlint?style=flat-square"
|
|
29
|
+
alt=""
|
|
30
|
+
/></a>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
<div> </div>
|
|
34
|
+
|
|
35
|
+
## Overview
|
|
36
|
+
|
|
37
|
+
Curated Oxlint config with sensible defaults. Designed as a careful, environment-agnostic baseline for writing better TypeScript. Comes with [supplemental configs](#supplemental-configs) that extend the core ruleset.
|
|
38
|
+
|
|
39
|
+
If you’re migrating from [**xo**](https://github.com/xojs/xo), you’ll feel right at home.
|
|
10
40
|
|
|
11
41
|
## Install
|
|
12
42
|
|
|
@@ -18,7 +48,7 @@ npm install --save-dev @standard-config/oxlint
|
|
|
18
48
|
pnpm add --save-dev @standard-config/oxlint
|
|
19
49
|
```
|
|
20
50
|
|
|
21
|
-
For [type-aware linting](https://oxc.rs/docs/guide/usage/linter/type-aware.html), make sure
|
|
51
|
+
For [type-aware linting](https://oxc.rs/docs/guide/usage/linter/type-aware.html), make sure `oxlint` and `oxlint-tsgolint` are both installed.
|
|
22
52
|
|
|
23
53
|
## Usage
|
|
24
54
|
|
|
@@ -44,19 +74,96 @@ export default defineConfig({
|
|
|
44
74
|
});
|
|
45
75
|
```
|
|
46
76
|
|
|
47
|
-
###
|
|
77
|
+
### Supplemental Configs
|
|
78
|
+
|
|
79
|
+
While **@standard-config/oxlint** relies only on Oxlint’s core rules, the supplemental config packages extend the baseline rule coverage with additional plugins, including [JS plugins](https://oxc.rs/docs/guide/usage/linter/js-plugins.html).
|
|
80
|
+
|
|
81
|
+
<table>
|
|
82
|
+
<thead>
|
|
83
|
+
<tr>
|
|
84
|
+
<th
|
|
85
|
+
align="left"
|
|
86
|
+
width="450"
|
|
87
|
+
>
|
|
88
|
+
Package
|
|
89
|
+
</th>
|
|
90
|
+
<th
|
|
91
|
+
align="left"
|
|
92
|
+
width="300"
|
|
93
|
+
>
|
|
94
|
+
Core Plugins
|
|
95
|
+
</th>
|
|
96
|
+
<th
|
|
97
|
+
align="left"
|
|
98
|
+
width="300"
|
|
99
|
+
>
|
|
100
|
+
JS Plugins
|
|
101
|
+
</th>
|
|
102
|
+
</tr>
|
|
103
|
+
</thead>
|
|
104
|
+
<tbody>
|
|
105
|
+
<tr>
|
|
106
|
+
<th align="left">
|
|
107
|
+
<a href="https://github.com/standard-config/oxlint/tree/main/packages/oxlint-react">@standard‑config/oxlint‑react</a>
|
|
108
|
+
</th>
|
|
109
|
+
<td>
|
|
110
|
+
<code>react</code>
|
|
111
|
+
<br />
|
|
112
|
+
<code>react‑perf</code>
|
|
113
|
+
<br />
|
|
114
|
+
<code>jsx‑a11y</code>
|
|
115
|
+
</td>
|
|
116
|
+
<td>
|
|
117
|
+
<a href="https://eslint-react.xyz"><code>react‑x</code></a>
|
|
118
|
+
</td>
|
|
119
|
+
</tr>
|
|
120
|
+
<tr>
|
|
121
|
+
<th align="left">
|
|
122
|
+
<a href="https://github.com/standard-config/oxlint/tree/main/packages/oxlint-stylistic">@standard‑config/oxlint‑stylistic</a>
|
|
123
|
+
</th>
|
|
124
|
+
<td>—</td>
|
|
125
|
+
<td>
|
|
126
|
+
<a href="https://eslint.style"><code>stylistic</code></a>
|
|
127
|
+
<br />
|
|
128
|
+
<a href="https://perfectionist.dev"><code>perfectionist</code></a>
|
|
129
|
+
</td>
|
|
130
|
+
</tr>
|
|
131
|
+
</tbody>
|
|
132
|
+
</table>
|
|
133
|
+
|
|
134
|
+
## FAQ
|
|
48
135
|
|
|
49
|
-
|
|
136
|
+
### Does this config require any specific TypeScript configuration?
|
|
137
|
+
|
|
138
|
+
No, it works with any `tsconfig.json`. For matching compiler defaults, pair it with [**@standard-config/tsconfig**](https://github.com/standard-config/tsconfig), though it is not required.
|
|
139
|
+
|
|
140
|
+
### Does this config enable any rule categories?
|
|
141
|
+
|
|
142
|
+
No. The config explicitly defines every enabled and disabled rule for each core plugin used. Any [`categories`](https://oxc.rs/docs/guide/usage/linter/config-file-reference.html#categories) you set will only apply to the plugins you enable.
|
|
50
143
|
|
|
51
144
|
```ts
|
|
52
145
|
import { defineConfig } from '@standard-config/oxlint';
|
|
53
146
|
|
|
54
147
|
export default defineConfig({
|
|
55
|
-
|
|
148
|
+
plugins: ['nextjs'],
|
|
149
|
+
categories: {
|
|
150
|
+
// Only applies to `next/*` rules
|
|
151
|
+
correctness: 'error',
|
|
152
|
+
suspicious: 'warn',
|
|
153
|
+
},
|
|
56
154
|
});
|
|
57
155
|
```
|
|
58
156
|
|
|
59
|
-
|
|
157
|
+
### How do I enable a supplemental config package?
|
|
158
|
+
|
|
159
|
+
If you already [use the core config](#usage), there’s no need to modify `oxlint.config.ts`. Installed supplemental config packages are detected and applied automatically.
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { defineConfig } from '@standard-config/oxlint';
|
|
163
|
+
|
|
164
|
+
// Will automatically include any installed supplemental configs
|
|
165
|
+
export default defineConfig();
|
|
166
|
+
```
|
|
60
167
|
|
|
61
168
|
### Can I use this config with Vite+?
|
|
62
169
|
|
|
@@ -68,9 +175,8 @@ import { defineConfig } from 'vite-plus';
|
|
|
68
175
|
|
|
69
176
|
export default defineConfig({
|
|
70
177
|
lint: defineOxlintConfig({
|
|
71
|
-
react: true,
|
|
72
178
|
rules: {
|
|
73
|
-
|
|
179
|
+
// Optional overrides
|
|
74
180
|
},
|
|
75
181
|
}),
|
|
76
182
|
});
|
|
@@ -78,7 +184,6 @@ export default defineConfig({
|
|
|
78
184
|
|
|
79
185
|
## Related
|
|
80
186
|
|
|
81
|
-
- [**@standard-config/eslint**](https://github.com/standard-config/eslint)
|
|
82
187
|
- [**@standard-config/prettier**](https://github.com/standard-config/prettier)
|
|
83
188
|
- [**@standard-config/tsconfig**](https://github.com/standard-config/tsconfig)
|
|
84
189
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,39 +1,77 @@
|
|
|
1
|
-
import { OxlintConfig, OxlintOverride } from "oxlint";
|
|
1
|
+
import { ExternalPluginEntry, OxlintConfig, OxlintOverride } from "oxlint";
|
|
2
2
|
|
|
3
3
|
//#region ../utilities/src/types/index.d.ts
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
* Enable React-specific rules.
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
react?: boolean;
|
|
12
|
-
};
|
|
4
|
+
type OxlintConfigBaseEntry = Omit<OxlintConfig, 'categories' | 'files' | 'ignorePatterns' | 'overrides'>;
|
|
5
|
+
type OxlintConfigCoreBaseEntry = Omit<OxlintConfigBaseEntry, 'jsPlugins'>;
|
|
6
|
+
type OxlintConfigOverrideEntry = Omit<OxlintOverride, 'categories' | 'files' | 'jsPlugins' | 'plugins'>;
|
|
7
|
+
type OxlintConfigPluginEntry = Exclude<ExternalPluginEntry, string>;
|
|
13
8
|
//#endregion
|
|
14
9
|
//#region src/config-base/index.d.ts
|
|
15
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Base config entry containing core rules. No overrides included.
|
|
12
|
+
*/
|
|
13
|
+
declare const config: OxlintConfigCoreBaseEntry;
|
|
16
14
|
//#endregion
|
|
17
15
|
//#region src/config-config-files/index.d.ts
|
|
18
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Optional config entry containing core rules that target config files.
|
|
18
|
+
* Intended for explicit overrides.
|
|
19
|
+
*/
|
|
20
|
+
declare const config$1: OxlintConfigOverrideEntry;
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/config-default/index.d.ts
|
|
23
|
+
/**
|
|
24
|
+
* Resolved Standard Config core entry.
|
|
25
|
+
*/
|
|
26
|
+
declare const config$4: OxlintConfig;
|
|
19
27
|
//#endregion
|
|
20
28
|
//#region src/config-test-files/index.d.ts
|
|
21
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Optional config entry containing core rules that target test files. Intended
|
|
31
|
+
* for explicit overrides.
|
|
32
|
+
*/
|
|
33
|
+
declare const config$2: OxlintConfigOverrideEntry;
|
|
22
34
|
//#endregion
|
|
23
35
|
//#region src/config-type-definitions/index.d.ts
|
|
24
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Optional config entry containing core rules that target type definition
|
|
38
|
+
* files. Intended for explicit overrides.
|
|
39
|
+
*/
|
|
40
|
+
declare const config$3: OxlintConfigOverrideEntry;
|
|
25
41
|
//#endregion
|
|
26
42
|
//#region src/define-config/index.d.ts
|
|
27
|
-
declare function defineConfig(...configs:
|
|
43
|
+
declare function defineConfig(...configs: OxlintConfig[]): OxlintConfig;
|
|
28
44
|
//#endregion
|
|
29
45
|
//#region src/define-oxlint-config/index.d.ts
|
|
30
46
|
/**
|
|
31
47
|
* Alias for `defineConfig`.
|
|
32
48
|
*/
|
|
33
|
-
declare function defineOxlintConfig(...configs:
|
|
49
|
+
declare function defineOxlintConfig(...configs: OxlintConfig[]): OxlintConfig;
|
|
34
50
|
//#endregion
|
|
35
|
-
//#region ../
|
|
36
|
-
|
|
51
|
+
//#region ../utilities/src/resolve-plugin/index.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* Resolve an external plugin specifier to a file path.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
*
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { resolvePlugin } from '@standard-config/oxlint';
|
|
59
|
+
* import { defineConfig } from 'oxlint';
|
|
60
|
+
*
|
|
61
|
+
* const config = defineConfig({
|
|
62
|
+
* jsPlugins: [
|
|
63
|
+
* resolvePlugin(
|
|
64
|
+
* 'react-x',
|
|
65
|
+
* '@eslint-react/eslint-plugin',
|
|
66
|
+
* ),
|
|
67
|
+
* ],
|
|
68
|
+
* rules: {
|
|
69
|
+
* 'react-x/refs': 'error',
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare function resolvePlugin(name: string, specifier: string): OxlintConfigPluginEntry;
|
|
37
75
|
//#endregion
|
|
38
|
-
export { config as
|
|
76
|
+
export { config as configCoreBase, config$1 as configCoreConfigFiles, config$2 as configCoreTestFiles, config$3 as configCoreTypeDefinitions, config$4 as default, defineConfig, defineOxlintConfig, resolvePlugin };
|
|
39
77
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["OxlintConfig","OxlintOverride","
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["ExternalPluginEntry","OxlintConfig","OxlintOverride","OxlintConfigBaseEntry","Omit","OxlintConfigCoreBaseEntry","OxlintConfigOverrideEntry","OxlintConfigGlobSet","OxlintConfigPluginEntry","Exclude"],"sources":["../../utilities/src/types/index.d.ts","../src/config-base/index.ts","../src/config-config-files/index.ts","../src/config-default/index.ts","../src/config-test-files/index.ts","../src/config-type-definitions/index.ts","../src/define-config/index.ts","../src/define-oxlint-config/index.ts","../../utilities/src/resolve-plugin/index.ts"],"mappings":";;;KAEYG,qBAAAA,GAAwBC,IAAI,CACvCH,YAAAA;AAAAA,KAIWI,yBAAAA,GAA4BD,IAAI,CAC3CD,qBAAAA;AAAAA,KAIWG,yBAAAA,GAA4BF,IAAI,CAC3CF,cAAAA;AAAAA,KAMWM,uBAAAA,GAA0BC,OAAO,CAACT,mBAAAA;;;;;AAjB9C;cCGM,MAAA,EAAQ,yBA4vBb;;;;;AD/vBD;;cEIM,QAAA,EAAQ,yBAQb;;;;;AFZD;cGaM,QAAA,EAAQ,YAeZ;;;;;AH5BF;;cIIM,QAAA,EAAQ,yBAsIb;;;;;AJ1ID;;cKIM,QAAA,EAAQ,yBAWb;;;iBCQuB,YAAA,CAAA,GAAgB,OAAA,EAAS,YAAA,KAAiB,YAAY;;;;;ANvB9E;iBOIwB,kBAAA,CAAA,GACpB,OAAA,EAAS,YAAA,KACV,YAAY;;;;;APNf;;;;AACa;AAIb;;;;AACsB;AAItB;;;;AACe;AAMf;;;;AAAiE;iBQMzC,aAAA,CACvB,IAAA,UACA,SAAA,WACE,uBAAuB"}
|