@wistia/oxlint-config 1.5.0 → 1.6.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 +43 -0
- package/oxfmtConfig.d.mts +6 -0
- package/oxfmtConfig.mjs +27 -0
- package/package.json +14 -2
package/README.md
CHANGED
|
@@ -154,6 +154,49 @@ export default defineConfig({
|
|
|
154
154
|
}
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
+
## Formatting with oxfmt
|
|
158
|
+
|
|
159
|
+
This package also ships Wistia's shared [oxfmt](https://oxc.rs/docs/guide/usage/formatter) config as `oxfmtConfig`, exported from the `@wistia/oxlint-config/oxfmtConfig` subpath. It is only tangentially related to linting, so `oxfmt` is an **optional** peer dependency — install it only if you use the formatter:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
yarn add -D oxfmt
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Create an `oxfmt.config.mts` in your project root. Spread `oxfmtConfig` and override any field; use `satisfies OxfmtConfig` for type checking:
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
import type { OxfmtConfig } from 'oxfmt';
|
|
169
|
+
import { defineConfig } from 'oxfmt';
|
|
170
|
+
import { oxfmtConfig } from '@wistia/oxlint-config/oxfmtConfig';
|
|
171
|
+
|
|
172
|
+
// oxlint-disable-next-line import-x/no-default-export
|
|
173
|
+
export default defineConfig({
|
|
174
|
+
...oxfmtConfig,
|
|
175
|
+
printWidth: 120,
|
|
176
|
+
ignorePatterns: [...oxfmtConfig.ignorePatterns, 'dist/**'],
|
|
177
|
+
} satisfies OxfmtConfig);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Every field is overrideable. Because `oxfmtConfig` is a plain object, spread it and replace whichever keys you need — nested keys such as `sortImports` and `ignorePatterns` are replaced wholesale, so reference the base value (as above) when you only want to extend it.
|
|
181
|
+
|
|
182
|
+
To use the config as-is with no overrides, point oxfmt at the package's default export directly:
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
// oxfmt.config.mts
|
|
186
|
+
export { default } from '@wistia/oxlint-config/oxfmtConfig';
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Add a script to run it:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"scripts": {
|
|
194
|
+
"format": "oxfmt .",
|
|
195
|
+
"format:ci": "oxfmt --check ."
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
157
200
|
## Guidelines for adding new rules
|
|
158
201
|
|
|
159
202
|
1. Preference given for autofixable rules
|
package/oxfmtConfig.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineConfig } from 'oxfmt';
|
|
2
|
+
|
|
3
|
+
export const oxfmtConfig = {
|
|
4
|
+
printWidth: 100,
|
|
5
|
+
singleQuote: true,
|
|
6
|
+
trailingComma: 'all',
|
|
7
|
+
singleAttributePerLine: true,
|
|
8
|
+
sortImports: {
|
|
9
|
+
groups: [
|
|
10
|
+
'type-builtin',
|
|
11
|
+
'type-external',
|
|
12
|
+
['type-internal', 'type-parent', 'type-sibling', 'type-index'],
|
|
13
|
+
'value-builtin',
|
|
14
|
+
'value-external',
|
|
15
|
+
'value-internal',
|
|
16
|
+
'value-index',
|
|
17
|
+
['value-parent', 'value-sibling'],
|
|
18
|
+
'unknown',
|
|
19
|
+
],
|
|
20
|
+
newlinesBetween: false,
|
|
21
|
+
},
|
|
22
|
+
ignorePatterns: ['node_modules/**', '.yarn/**'],
|
|
23
|
+
sortPackageJson: false,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// oxlint-disable-next-line import-x/no-default-export
|
|
27
|
+
export default defineConfig(oxfmtConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wistia/oxlint-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Wistia's Oxlint configurations",
|
|
5
5
|
"packageManager": "yarn@4.17.0",
|
|
6
6
|
"type": "module",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"rules",
|
|
10
10
|
"plugins",
|
|
11
11
|
"index.mjs",
|
|
12
|
-
"index.d.mts"
|
|
12
|
+
"index.d.mts",
|
|
13
|
+
"oxfmtConfig.mjs",
|
|
14
|
+
"oxfmtConfig.d.mts"
|
|
13
15
|
],
|
|
14
16
|
"exports": {
|
|
15
17
|
"./package.json": "./package.json",
|
|
@@ -26,6 +28,10 @@
|
|
|
26
28
|
"./storybook": "./configs/storybook.mjs",
|
|
27
29
|
"./styled-components": "./configs/styled-components.mjs",
|
|
28
30
|
"./testing-library": "./configs/testing-library.mjs",
|
|
31
|
+
"./oxfmtConfig": {
|
|
32
|
+
"types": "./oxfmtConfig.d.mts",
|
|
33
|
+
"default": "./oxfmtConfig.mjs"
|
|
34
|
+
},
|
|
29
35
|
"./rules/barrel-files": "./rules/barrel-files.mjs",
|
|
30
36
|
"./rules/base": "./rules/base.mjs",
|
|
31
37
|
"./rules/custom": "./rules/custom.mjs",
|
|
@@ -54,9 +60,15 @@
|
|
|
54
60
|
},
|
|
55
61
|
"peerDependencies": {
|
|
56
62
|
"eslint": ">= 10.5.0",
|
|
63
|
+
"oxfmt": ">= 0.55.0",
|
|
57
64
|
"oxlint": ">= 1.71.0",
|
|
58
65
|
"oxlint-tsgolint": ">= 0.23.0"
|
|
59
66
|
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"oxfmt": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
60
72
|
"dependencies": {
|
|
61
73
|
"@eslint-react/eslint-plugin": "^5.9.0",
|
|
62
74
|
"@vitest/eslint-plugin": "^1.6.20",
|