@wistia/oxlint-config 1.5.0 → 1.6.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 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
@@ -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.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Wistia's Oxlint configurations",
5
5
  "packageManager": "yarn@4.17.0",
6
6
  "type": "module",
@@ -9,7 +9,8 @@
9
9
  "rules",
10
10
  "plugins",
11
11
  "index.mjs",
12
- "index.d.mts"
12
+ "index.d.mts",
13
+ "oxfmtConfig.mjs"
13
14
  ],
14
15
  "exports": {
15
16
  "./package.json": "./package.json",
@@ -26,6 +27,7 @@
26
27
  "./storybook": "./configs/storybook.mjs",
27
28
  "./styled-components": "./configs/styled-components.mjs",
28
29
  "./testing-library": "./configs/testing-library.mjs",
30
+ "./oxfmtConfig": "./oxfmtConfig.mjs",
29
31
  "./rules/barrel-files": "./rules/barrel-files.mjs",
30
32
  "./rules/base": "./rules/base.mjs",
31
33
  "./rules/custom": "./rules/custom.mjs",
@@ -54,9 +56,15 @@
54
56
  },
55
57
  "peerDependencies": {
56
58
  "eslint": ">= 10.5.0",
59
+ "oxfmt": ">= 0.55.0",
57
60
  "oxlint": ">= 1.71.0",
58
61
  "oxlint-tsgolint": ">= 0.23.0"
59
62
  },
63
+ "peerDependenciesMeta": {
64
+ "oxfmt": {
65
+ "optional": true
66
+ }
67
+ },
60
68
  "dependencies": {
61
69
  "@eslint-react/eslint-plugin": "^5.9.0",
62
70
  "@vitest/eslint-plugin": "^1.6.20",