@thaz/oxfmt-config 1.0.0-rc.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 thaz-collective
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # [@thaz/oxfmt-config](https://github.com/thaz-collective/oxfmt-config)
2
+
3
+ The purpose of this project is to have a common starting point for formatting configs for various projects types that thaz-collective projects use out of the box.
4
+
5
+ ---
6
+
7
+ ## Usage
8
+
9
+ - Install Vite+ or Oxfmt and config:
10
+
11
+ ```bash
12
+ vp add -D vite-plus oxfmt @thaz/oxfmt-config
13
+ ```
14
+
15
+ - Update your Vite+ config with the formatting section:
16
+
17
+ ```ts
18
+ import { defineConfig } from 'vite-plus';
19
+ import { oxfmtConfig } from '@thaz/oxfmt-config';
20
+
21
+ export default defineConfig({
22
+ // Recommended to have a staged step to run fixes
23
+ staged: {
24
+ '*.{js,ts,tsx}': 'vp check --fix',
25
+ },
26
+ run: {
27
+ tasks: {
28
+ // These can go in package.json or tasks depending on your preference
29
+ check: {
30
+ command: 'vp check',
31
+ },
32
+ // These can go in package.json or tasks depending on your preference
33
+ fmt: {
34
+ command: 'vp fmt',
35
+ },
36
+ },
37
+ },
38
+ // Config goes here. You can override parts and spread only items you want or whole config as is.
39
+ fmt: oxfmtConfig,
40
+ });
41
+ ```
42
+
43
+ ---
44
+
45
+ ## References
46
+
47
+ - [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) - The Oxfmt library used for formatting our code
@@ -0,0 +1,94 @@
1
+ //#region src/config.d.ts
2
+ /**
3
+ * Import-sorting pattern group for the `oxfmt` package.
4
+ */
5
+ declare const oxFmtConfigPatterns: {
6
+ elementNamePattern: string[];
7
+ groupName: string;
8
+ };
9
+ /**
10
+ * Import-sorting pattern group for `oxlint` and `oxlint-tsgolint`.
11
+ */
12
+ declare const oxLintConfigPatterns: {
13
+ elementNamePattern: string[];
14
+ groupName: string;
15
+ };
16
+ /**
17
+ * Import-sorting pattern group for bundler packages (tsdown, rolldown, rollup).
18
+ */
19
+ declare const bundlingConfigPatterns: {
20
+ elementNamePattern: string[];
21
+ groupName: string;
22
+ };
23
+ /**
24
+ * Import-sorting pattern group for Vite, Vitest and related packages
25
+ */
26
+ declare const viteConfigPatterns: {
27
+ elementNamePattern: string[];
28
+ groupName: string;
29
+ };
30
+ /**
31
+ * Import-sorting pattern group for `react` and `react-dom`.
32
+ */
33
+ declare const reactConfigPatterns: {
34
+ elementNamePattern: string[];
35
+ groupName: string;
36
+ };
37
+ /**
38
+ * Import-sorting pattern group for `@tanstack/*` packages.
39
+ */
40
+ declare const tanstackConfigPatterns: {
41
+ elementNamePattern: string[];
42
+ groupName: string;
43
+ };
44
+ /**
45
+ * Import-sorting pattern group for `@thaz/*` packages.
46
+ */
47
+ declare const thazConfigPatterns: {
48
+ elementNamePattern: string[];
49
+ groupName: string;
50
+ };
51
+ /**
52
+ * Shared Oxfmt configuration for thaz-collective projects: formatting style plus import sort order/grouping.
53
+ */
54
+ declare const oxfmtConfig: {
55
+ endOfLine: "lf";
56
+ printWidth: number;
57
+ tabWidth: number;
58
+ useTabs: false;
59
+ arrowParens: "always";
60
+ bracketSameLine: false;
61
+ bracketSpacing: true;
62
+ jsxSingleQuote: false;
63
+ quoteProps: "as-needed";
64
+ singleAttributePerLine: true;
65
+ singleQuote: true;
66
+ semi: true;
67
+ trailingComma: "all";
68
+ overrides: {
69
+ files: string[];
70
+ options: {
71
+ trailingComma: "none";
72
+ };
73
+ }[];
74
+ ignorePatterns: string[];
75
+ sortPackageJson: true;
76
+ sortImports: {
77
+ order: "asc";
78
+ newlinesBetween: false;
79
+ internalPattern: string[];
80
+ customGroups: ({
81
+ elementNamePattern: string[];
82
+ groupName: string;
83
+ } | {
84
+ selector: string;
85
+ groupName: string;
86
+ elementNamePattern: string[];
87
+ })[];
88
+ groups: (string[] | {
89
+ newlinesBetween: true;
90
+ })[];
91
+ };
92
+ };
93
+ //#endregion
94
+ export { bundlingConfigPatterns, oxFmtConfigPatterns, oxLintConfigPatterns, oxfmtConfig, reactConfigPatterns, tanstackConfigPatterns, thazConfigPatterns, viteConfigPatterns };
@@ -0,0 +1,204 @@
1
+ import { defineConfig } from "oxfmt";
2
+ //#region src/config.ts
3
+ /**
4
+ * Import-sorting pattern group for the `oxfmt` package.
5
+ */
6
+ const oxFmtConfigPatterns = {
7
+ elementNamePattern: ["oxfmt"],
8
+ groupName: "oxfmt"
9
+ };
10
+ /**
11
+ * Import-sorting pattern group for `oxlint` and `oxlint-tsgolint`.
12
+ */
13
+ const oxLintConfigPatterns = {
14
+ elementNamePattern: ["oxlint", "oxlint-tsgolint"],
15
+ groupName: "oxlint"
16
+ };
17
+ /**
18
+ * Import-sorting pattern group for bundler packages (tsdown, rolldown, rollup).
19
+ */
20
+ const bundlingConfigPatterns = {
21
+ elementNamePattern: [
22
+ "tsdown",
23
+ "rolldown",
24
+ "rollup-**",
25
+ "rolldown-**"
26
+ ],
27
+ groupName: "bundling"
28
+ };
29
+ /**
30
+ * Import-sorting pattern group for Vite, Vitest and related packages
31
+ */
32
+ const viteConfigPatterns = {
33
+ elementNamePattern: [
34
+ "vite-plus",
35
+ "vite",
36
+ "vitest",
37
+ "@vite/**",
38
+ "@vitest/**",
39
+ "@vitejs/**",
40
+ "vite-**",
41
+ "vitest-**"
42
+ ],
43
+ groupName: "vite"
44
+ };
45
+ /**
46
+ * Import-sorting pattern group for `react` and `react-dom`.
47
+ */
48
+ const reactConfigPatterns = {
49
+ elementNamePattern: ["react", "react-dom"],
50
+ groupName: "react"
51
+ };
52
+ /**
53
+ * Import-sorting pattern group for `@tanstack/*` packages.
54
+ */
55
+ const tanstackConfigPatterns = {
56
+ elementNamePattern: ["@tanstack/**"],
57
+ groupName: "tanstack"
58
+ };
59
+ /**
60
+ * Import-sorting pattern group for `@thaz/*` packages.
61
+ */
62
+ const thazConfigPatterns = {
63
+ elementNamePattern: ["@thaz/**"],
64
+ groupName: "thaz"
65
+ };
66
+ /**
67
+ * Shared Oxfmt configuration for thaz-collective projects: formatting style plus import sort order/grouping.
68
+ */
69
+ const oxfmtConfig = defineConfig({
70
+ endOfLine: "lf",
71
+ printWidth: 120,
72
+ tabWidth: 2,
73
+ useTabs: false,
74
+ arrowParens: "always",
75
+ bracketSameLine: false,
76
+ bracketSpacing: true,
77
+ jsxSingleQuote: false,
78
+ quoteProps: "as-needed",
79
+ singleAttributePerLine: true,
80
+ singleQuote: true,
81
+ semi: true,
82
+ trailingComma: "all",
83
+ overrides: [{
84
+ files: [
85
+ "*.json",
86
+ "*.jsonc",
87
+ "*.json5"
88
+ ],
89
+ options: { trailingComma: "none" }
90
+ }],
91
+ ignorePatterns: [
92
+ "build/**",
93
+ "dist/**",
94
+ ".output/**",
95
+ ".tanstack/**",
96
+ ".tanstack-start/**",
97
+ "pnpm-lock.yaml",
98
+ "pnpm-workspace.yaml",
99
+ "route-tree.gen.ts"
100
+ ],
101
+ sortPackageJson: true,
102
+ sortImports: {
103
+ order: "asc",
104
+ newlinesBetween: false,
105
+ internalPattern: [
106
+ "@src/",
107
+ "@test/",
108
+ "@mock/",
109
+ "#src/",
110
+ "#test/",
111
+ "#mock/"
112
+ ],
113
+ customGroups: [
114
+ oxFmtConfigPatterns,
115
+ {
116
+ ...oxFmtConfigPatterns,
117
+ selector: "type",
118
+ groupName: `type-${oxFmtConfigPatterns.groupName}`
119
+ },
120
+ oxLintConfigPatterns,
121
+ {
122
+ ...oxLintConfigPatterns,
123
+ selector: "type",
124
+ groupName: `type-${oxLintConfigPatterns.groupName}`
125
+ },
126
+ bundlingConfigPatterns,
127
+ {
128
+ ...bundlingConfigPatterns,
129
+ selector: "type",
130
+ groupName: `type-${bundlingConfigPatterns.groupName}`
131
+ },
132
+ viteConfigPatterns,
133
+ {
134
+ ...viteConfigPatterns,
135
+ selector: "type",
136
+ groupName: `type-${viteConfigPatterns.groupName}`
137
+ },
138
+ reactConfigPatterns,
139
+ {
140
+ ...reactConfigPatterns,
141
+ selector: "type",
142
+ groupName: `type-${reactConfigPatterns.groupName}`
143
+ },
144
+ tanstackConfigPatterns,
145
+ {
146
+ ...tanstackConfigPatterns,
147
+ selector: "type",
148
+ groupName: `type-${tanstackConfigPatterns.groupName}`
149
+ },
150
+ thazConfigPatterns,
151
+ {
152
+ ...thazConfigPatterns,
153
+ selector: "type",
154
+ groupName: `type-${thazConfigPatterns.groupName}`
155
+ }
156
+ ],
157
+ groups: [
158
+ ["type-builtin"],
159
+ ["builtin"],
160
+ { newlinesBetween: true },
161
+ [`type-${oxFmtConfigPatterns.groupName}`],
162
+ [oxFmtConfigPatterns.groupName],
163
+ [`type-${oxLintConfigPatterns.groupName}`],
164
+ [oxLintConfigPatterns.groupName],
165
+ { newlinesBetween: true },
166
+ [`type-${viteConfigPatterns.groupName}`],
167
+ [viteConfigPatterns.groupName],
168
+ [`type-${bundlingConfigPatterns.groupName}`],
169
+ [bundlingConfigPatterns.groupName],
170
+ { newlinesBetween: true },
171
+ [`type-${reactConfigPatterns.groupName}`],
172
+ [reactConfigPatterns.groupName],
173
+ { newlinesBetween: true },
174
+ [`type-${tanstackConfigPatterns.groupName}`],
175
+ [tanstackConfigPatterns.groupName],
176
+ { newlinesBetween: true },
177
+ [`type-${thazConfigPatterns.groupName}`],
178
+ [thazConfigPatterns.groupName],
179
+ { newlinesBetween: true },
180
+ ["type-external"],
181
+ ["external"],
182
+ { newlinesBetween: true },
183
+ ["type-internal", "type-subpath"],
184
+ ["internal", "subpath"],
185
+ { newlinesBetween: true },
186
+ [
187
+ "type-parent",
188
+ "type-sibling",
189
+ "type-index"
190
+ ],
191
+ [
192
+ "parent",
193
+ "sibling",
194
+ "index"
195
+ ],
196
+ { newlinesBetween: true },
197
+ ["style"],
198
+ { newlinesBetween: true },
199
+ ["unknown"]
200
+ ]
201
+ }
202
+ });
203
+ //#endregion
204
+ export { bundlingConfigPatterns, oxFmtConfigPatterns, oxLintConfigPatterns, oxfmtConfig, reactConfigPatterns, tanstackConfigPatterns, thazConfigPatterns, viteConfigPatterns };
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@thaz/oxfmt-config",
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Oxfmt configuration for applications and libraries in the thaz collective namespace",
5
+ "keywords": [
6
+ "config",
7
+ "format",
8
+ "oxfmt"
9
+ ],
10
+ "homepage": "https://github.com/thaz-collective/oxfmt-config#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/thaz-collective/oxfmt-config/issues"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Tim Hazlett",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/thaz-collective/oxfmt-config.git"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "src"
23
+ ],
24
+ "type": "module",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/config.d.mts",
28
+ "import": "./dist/config.mjs"
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public",
34
+ "tag": "latest"
35
+ },
36
+ "devDependencies": {
37
+ "@thaz/typescript-config": "1.0.0-rc.1",
38
+ "@types/node": "24.13.2",
39
+ "oxfmt": "0.57.0",
40
+ "typescript": "6.0.3",
41
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
42
+ "vite-plugin-externalize-deps": "0.10.0",
43
+ "vite-plus": "0.2.4"
44
+ },
45
+ "peerDependencies": {
46
+ "oxfmt": "^0.57.0"
47
+ },
48
+ "engines": {
49
+ "node": ">=24"
50
+ },
51
+ "scripts": {
52
+ "taze": "vpx taze@latest -Ilwr --maturity-period 3",
53
+ "taze:major": "vpx taze@latest major -Ilwr --maturity-period 3",
54
+ "taze:minor": "vpx taze@latest minor -Ilwr --maturity-period 3",
55
+ "taze:patch": "vpx taze@latest patch -Ilwr --maturity-period 3"
56
+ }
57
+ }
package/src/config.ts ADDED
@@ -0,0 +1,210 @@
1
+ import { defineConfig } from 'oxfmt';
2
+
3
+ /**
4
+ * Import-sorting pattern group for the `oxfmt` package.
5
+ */
6
+ export const oxFmtConfigPatterns = {
7
+ elementNamePattern: ['oxfmt'],
8
+ groupName: 'oxfmt',
9
+ };
10
+
11
+ /**
12
+ * Import-sorting pattern group for `oxlint` and `oxlint-tsgolint`.
13
+ */
14
+ export const oxLintConfigPatterns = {
15
+ elementNamePattern: ['oxlint', 'oxlint-tsgolint'],
16
+ groupName: 'oxlint',
17
+ };
18
+
19
+ /**
20
+ * Import-sorting pattern group for bundler packages (tsdown, rolldown, rollup).
21
+ */
22
+ export const bundlingConfigPatterns = {
23
+ elementNamePattern: ['tsdown', 'rolldown', 'rollup-**', 'rolldown-**'],
24
+ groupName: 'bundling',
25
+ };
26
+
27
+ /**
28
+ * Import-sorting pattern group for Vite, Vitest and related packages
29
+ */
30
+ export const viteConfigPatterns = {
31
+ elementNamePattern: ['vite-plus', 'vite', 'vitest', '@vite/**', '@vitest/**', '@vitejs/**', 'vite-**', 'vitest-**'],
32
+ groupName: 'vite',
33
+ };
34
+
35
+ /**
36
+ * Import-sorting pattern group for `react` and `react-dom`.
37
+ */
38
+ export const reactConfigPatterns = {
39
+ elementNamePattern: ['react', 'react-dom'],
40
+ groupName: 'react',
41
+ };
42
+
43
+ /**
44
+ * Import-sorting pattern group for `@tanstack/*` packages.
45
+ */
46
+ export const tanstackConfigPatterns = {
47
+ elementNamePattern: ['@tanstack/**'],
48
+ groupName: 'tanstack',
49
+ };
50
+
51
+ /**
52
+ * Import-sorting pattern group for `@thaz/*` packages.
53
+ */
54
+ export const thazConfigPatterns = {
55
+ elementNamePattern: ['@thaz/**'],
56
+ groupName: 'thaz',
57
+ };
58
+
59
+ /**
60
+ * Shared Oxfmt configuration for thaz-collective projects: formatting style plus import sort order/grouping.
61
+ */
62
+ export const oxfmtConfig = defineConfig({
63
+ // These values can clash with editorconfig so keep in sync
64
+ endOfLine: 'lf',
65
+ printWidth: 120,
66
+ tabWidth: 2,
67
+ useTabs: false,
68
+
69
+ // Everything else after
70
+ arrowParens: 'always',
71
+ bracketSameLine: false,
72
+ bracketSpacing: true,
73
+ jsxSingleQuote: false,
74
+ quoteProps: 'as-needed',
75
+ singleAttributePerLine: true,
76
+ singleQuote: true,
77
+ semi: true,
78
+ trailingComma: 'all',
79
+
80
+ overrides: [
81
+ {
82
+ files: ['*.json', '*.jsonc', '*.json5'],
83
+ options: {
84
+ trailingComma: 'none',
85
+ },
86
+ },
87
+ ],
88
+
89
+ ignorePatterns: [
90
+ 'build/**',
91
+ 'dist/**',
92
+ '.output/**',
93
+ '.tanstack/**',
94
+ '.tanstack-start/**',
95
+
96
+ 'pnpm-lock.yaml',
97
+ 'pnpm-workspace.yaml',
98
+
99
+ 'route-tree.gen.ts',
100
+ ],
101
+
102
+ sortPackageJson: true,
103
+
104
+ sortImports: {
105
+ order: 'asc',
106
+ newlinesBetween: false,
107
+ internalPattern: ['@src/', '@test/', '@mock/', '#src/', '#test/', '#mock/'],
108
+
109
+ customGroups: [
110
+ oxFmtConfigPatterns,
111
+ {
112
+ ...oxFmtConfigPatterns,
113
+ selector: 'type',
114
+ groupName: `type-${oxFmtConfigPatterns.groupName}`,
115
+ },
116
+ oxLintConfigPatterns,
117
+ {
118
+ ...oxLintConfigPatterns,
119
+ selector: 'type',
120
+ groupName: `type-${oxLintConfigPatterns.groupName}`,
121
+ },
122
+ bundlingConfigPatterns,
123
+ {
124
+ ...bundlingConfigPatterns,
125
+ selector: 'type',
126
+ groupName: `type-${bundlingConfigPatterns.groupName}`,
127
+ },
128
+ viteConfigPatterns,
129
+ {
130
+ ...viteConfigPatterns,
131
+ selector: 'type',
132
+ groupName: `type-${viteConfigPatterns.groupName}`,
133
+ },
134
+ reactConfigPatterns,
135
+ {
136
+ ...reactConfigPatterns,
137
+ selector: 'type',
138
+ groupName: `type-${reactConfigPatterns.groupName}`,
139
+ },
140
+ tanstackConfigPatterns,
141
+ {
142
+ ...tanstackConfigPatterns,
143
+ selector: 'type',
144
+ groupName: `type-${tanstackConfigPatterns.groupName}`,
145
+ },
146
+ thazConfigPatterns,
147
+ {
148
+ ...thazConfigPatterns,
149
+ selector: 'type',
150
+ groupName: `type-${thazConfigPatterns.groupName}`,
151
+ },
152
+ ],
153
+ groups: [
154
+ ['type-builtin'],
155
+ ['builtin'],
156
+
157
+ { newlinesBetween: true },
158
+
159
+ [`type-${oxFmtConfigPatterns.groupName}`],
160
+ [oxFmtConfigPatterns.groupName],
161
+ [`type-${oxLintConfigPatterns.groupName}`],
162
+ [oxLintConfigPatterns.groupName],
163
+
164
+ { newlinesBetween: true },
165
+
166
+ [`type-${viteConfigPatterns.groupName}`],
167
+ [viteConfigPatterns.groupName],
168
+ [`type-${bundlingConfigPatterns.groupName}`],
169
+ [bundlingConfigPatterns.groupName],
170
+
171
+ { newlinesBetween: true },
172
+
173
+ [`type-${reactConfigPatterns.groupName}`],
174
+ [reactConfigPatterns.groupName],
175
+
176
+ { newlinesBetween: true },
177
+
178
+ [`type-${tanstackConfigPatterns.groupName}`],
179
+ [tanstackConfigPatterns.groupName],
180
+
181
+ { newlinesBetween: true },
182
+
183
+ [`type-${thazConfigPatterns.groupName}`],
184
+ [thazConfigPatterns.groupName],
185
+
186
+ { newlinesBetween: true },
187
+
188
+ ['type-external'],
189
+ ['external'],
190
+
191
+ { newlinesBetween: true },
192
+
193
+ ['type-internal', 'type-subpath'],
194
+ ['internal', 'subpath'],
195
+
196
+ { newlinesBetween: true },
197
+
198
+ ['type-parent', 'type-sibling', 'type-index'],
199
+ ['parent', 'sibling', 'index'],
200
+
201
+ { newlinesBetween: true },
202
+
203
+ ['style'],
204
+
205
+ { newlinesBetween: true },
206
+
207
+ ['unknown'],
208
+ ],
209
+ },
210
+ });