@destination/oxc-config 0.0.0-stage → 0.1.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,19 @@
1
+ Copyright (c) 2025-present, DestinationCMS Ltd
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,82 @@
1
- # Temporary Holding Version
1
+ # Destination Oxc Config
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Shared config for [Oxlint](https://oxc.rs/docs/guide/usage/linter.html) and
4
+ [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) that enforces our JS/TS coding standards.
5
+
6
+ The Oxlint rules are generated from [`@destination/eslint-config`](https://github.com/wearedestination/eslint-config),
7
+ so both packages enforce the same rules wherever Oxlint supports them. Oxlint doesn't support every rule in that
8
+ config, most of them from `eslint-plugin-unicorn`. Run `npx @oxlint/migrate --details` against the ESLint config to
9
+ list them.
10
+
11
+ Oxlint lints only the `<script>` blocks of Vue single-file components, not their templates, so Vue projects should
12
+ keep using [`@destination/eslint-config-vue`](https://github.com/wearedestination/eslint-config-vue). They can still
13
+ use the Oxfmt config.
14
+
15
+ ## Installation
16
+
17
+ Install the tools you want alongside the config:
18
+
19
+ ```console
20
+ npm install @destination/oxc-config oxlint oxlint-tsgolint oxfmt --save-dev
21
+ ```
22
+
23
+ `oxlint-tsgolint` runs the type-aware rules, such as `typescript/no-floating-promises`, and needs a `tsconfig.json`.
24
+
25
+ ## Usage
26
+
27
+ ### Oxlint
28
+
29
+ Your `oxlint.config.ts` file should look something like this:
30
+
31
+ ```ts
32
+ import destination from "@destination/oxc-config/oxlint";
33
+ import { defineConfig } from "oxlint";
34
+
35
+ export default defineConfig({ extends: [destination] });
36
+ ```
37
+
38
+ Or, if you need to specify additional configuration:
39
+
40
+ ```ts
41
+ import destination from "@destination/oxc-config/oxlint";
42
+ import { defineConfig } from "oxlint";
43
+
44
+ export default defineConfig({
45
+ extends: [destination],
46
+ ignorePatterns: ["assets/some-ignored-file.ts"],
47
+ globals: {
48
+ google: "readonly",
49
+ },
50
+ });
51
+ ```
52
+
53
+ ### Oxfmt
54
+
55
+ Your `oxfmt.config.ts` file should look something like this:
56
+
57
+ ```ts
58
+ import destination from "@destination/oxc-config/oxfmt";
59
+ import { defineConfig } from "oxfmt";
60
+
61
+ export default defineConfig({ ...destination });
62
+ ```
63
+
64
+ Oxfmt has no `extends`, so override options by setting them after the spread.
65
+
66
+ The config matches [`@destination/prettier-config`](https://github.com/wearedestination/prettier-config) (4-space
67
+ indentation, 120-character lines) and sorts imports into the groups `@destination/eslint-config` enforces with
68
+ `import-x/order`. Oxfmt doesn't format Twig, so projects with Twig templates still need Prettier and
69
+ `@destination/prettier-plugin-twig` for those.
70
+
71
+ ### Running
72
+
73
+ ```console
74
+ npx oxlint
75
+ npx oxfmt
76
+ ```
77
+
78
+ Both config files are TypeScript, which needs Node.js 22.18.0 or later.
79
+
80
+ ## License
81
+
82
+ Released under the [MIT license](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@destination/oxc-config",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Oxlint and Oxfmt config used by Destination",
5
+ "keywords": [
6
+ "oxc",
7
+ "oxfmt",
8
+ "oxlint"
9
+ ],
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/wearedestination/oxc-config.git"
14
+ },
15
+ "files": [
16
+ "src"
17
+ ],
18
+ "type": "module",
19
+ "exports": {
20
+ "./oxlint": {
21
+ "types": "./src/oxlint.d.ts",
22
+ "default": "./src/oxlint.js"
23
+ },
24
+ "./oxfmt": {
25
+ "types": "./src/oxfmt.d.ts",
26
+ "default": "./src/oxfmt.js"
27
+ }
28
+ },
29
+ "scripts": {
30
+ "generate": "node scripts/generate.js && oxfmt src/oxlintrc.json",
31
+ "check": "oxlint && oxfmt --check"
32
+ },
33
+ "devDependencies": {
34
+ "@destination/eslint-config": "^3.2.0",
35
+ "@oxlint/migrate": "^1.95.0",
36
+ "eslint": "^10.15.0",
37
+ "oxfmt": "^0.80.0",
38
+ "oxlint": "^1.95.0",
39
+ "oxlint-tsgolint": "^7.0.2008"
40
+ },
41
+ "peerDependencies": {
42
+ "oxfmt": ">=0.80.0",
43
+ "oxlint": ">=1.95.0",
44
+ "oxlint-tsgolint": "*"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "oxfmt": {
48
+ "optional": true
49
+ },
50
+ "oxlint": {
51
+ "optional": true
52
+ },
53
+ "oxlint-tsgolint": {
54
+ "optional": true
55
+ }
56
+ },
57
+ "engines": {
58
+ "node": ">=22.18.0"
59
+ }
60
+ }
package/src/oxfmt.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { OxfmtConfig } from "oxfmt";
2
+
3
+ declare const config: OxfmtConfig;
4
+
5
+ export default config;
package/src/oxfmt.js ADDED
@@ -0,0 +1,8 @@
1
+ export default {
2
+ printWidth: 120,
3
+ tabWidth: 2,
4
+ sortImports: {
5
+ groups: ["builtin", "external", ["internal", "subpath"], "parent", "sibling", "index", "style", "unknown"],
6
+ newlinesBetween: false,
7
+ },
8
+ };
@@ -0,0 +1,5 @@
1
+ import type { OxlintConfig } from "oxlint";
2
+
3
+ declare const config: OxlintConfig;
4
+
5
+ export default config;
package/src/oxlint.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from "./oxlintrc.json" with { type: "json" };
@@ -0,0 +1,296 @@
1
+ {
2
+ "plugins": ["typescript", "import", "unicorn"],
3
+ "categories": {
4
+ "correctness": "off"
5
+ },
6
+ "options": {
7
+ "typeAware": true
8
+ },
9
+ "env": {
10
+ "builtin": true,
11
+ "es2026": true,
12
+ "browser": true
13
+ },
14
+ "rules": {
15
+ "constructor-super": "error",
16
+ "for-direction": "error",
17
+ "getter-return": "error",
18
+ "no-async-promise-executor": "error",
19
+ "no-case-declarations": "error",
20
+ "no-class-assign": "error",
21
+ "no-compare-neg-zero": "error",
22
+ "no-cond-assign": "error",
23
+ "no-const-assign": "error",
24
+ "no-constant-binary-expression": "error",
25
+ "no-constant-condition": "error",
26
+ "no-control-regex": "error",
27
+ "no-debugger": "error",
28
+ "no-delete-var": "error",
29
+ "no-dupe-class-members": "error",
30
+ "no-dupe-else-if": "error",
31
+ "no-dupe-keys": "error",
32
+ "no-duplicate-case": "error",
33
+ "no-empty": "error",
34
+ "no-empty-character-class": "error",
35
+ "no-empty-pattern": "error",
36
+ "no-empty-static-block": "error",
37
+ "no-ex-assign": "error",
38
+ "no-extra-boolean-cast": "error",
39
+ "no-fallthrough": "error",
40
+ "no-func-assign": "error",
41
+ "no-global-assign": "error",
42
+ "no-import-assign": "error",
43
+ "no-invalid-regexp": "error",
44
+ "no-irregular-whitespace": "error",
45
+ "no-loss-of-precision": "error",
46
+ "no-misleading-character-class": "error",
47
+ "no-new-native-nonconstructor": "error",
48
+ "no-nonoctal-decimal-escape": "error",
49
+ "no-obj-calls": "error",
50
+ "no-prototype-builtins": "error",
51
+ "no-redeclare": "error",
52
+ "no-regex-spaces": "error",
53
+ "no-self-assign": "error",
54
+ "no-setter-return": "error",
55
+ "no-shadow-restricted-names": "error",
56
+ "no-sparse-arrays": "error",
57
+ "no-this-before-super": "error",
58
+ "no-unassigned-vars": "error",
59
+ "no-unreachable": "error",
60
+ "no-unsafe-finally": "error",
61
+ "no-unsafe-negation": "error",
62
+ "no-unsafe-optional-chaining": "error",
63
+ "no-unused-labels": "error",
64
+ "no-unused-private-class-members": "error",
65
+ "no-unused-vars": [
66
+ "error",
67
+ {
68
+ "argsIgnorePattern": "^_",
69
+ "varsIgnorePattern": "^_"
70
+ }
71
+ ],
72
+ "no-useless-backreference": "error",
73
+ "no-useless-catch": "error",
74
+ "no-useless-escape": "error",
75
+ "no-with": "error",
76
+ "preserve-caught-error": "error",
77
+ "require-yield": "error",
78
+ "use-isnan": "error",
79
+ "valid-typeof": "error",
80
+ "no-array-constructor": "error",
81
+ "no-unused-expressions": "error",
82
+ "unicorn/catch-error-name": "error",
83
+ "unicorn/consistent-assert": "error",
84
+ "unicorn/consistent-date-clone": "error",
85
+ "unicorn/consistent-empty-array-spread": "error",
86
+ "unicorn/consistent-existence-index-check": "error",
87
+ "unicorn/consistent-function-scoping": "error",
88
+ "unicorn/consistent-template-literal-escape": "error",
89
+ "unicorn/error-message": "error",
90
+ "unicorn/escape-case": "error",
91
+ "unicorn/explicit-length-check": "error",
92
+ "unicorn/explicit-timer-delay": "error",
93
+ "unicorn/filename-case": [
94
+ "error",
95
+ {
96
+ "cases": {
97
+ "kebabCase": true,
98
+ "pascalCase": true
99
+ }
100
+ }
101
+ ],
102
+ "unicorn/import-style": "error",
103
+ "unicorn/max-nested-calls": "error",
104
+ "unicorn/new-for-builtins": "error",
105
+ "unicorn/no-abusive-eslint-disable": "error",
106
+ "unicorn/no-accessor-recursion": "error",
107
+ "unicorn/no-anonymous-default-export": "error",
108
+ "unicorn/no-array-callback-reference": "error",
109
+ "unicorn/no-array-fill-with-reference-type": "error",
110
+ "unicorn/no-array-method-this-argument": "error",
111
+ "unicorn/no-array-reduce": "error",
112
+ "unicorn/no-array-reverse": "error",
113
+ "unicorn/no-array-sort": "error",
114
+ "unicorn/no-await-expression-member": "error",
115
+ "unicorn/no-await-in-promise-methods": "error",
116
+ "unicorn/no-confusing-array-with": "error",
117
+ "unicorn/no-console-spaces": "error",
118
+ "unicorn/no-document-cookie": "error",
119
+ "unicorn/no-empty-file": "error",
120
+ "unicorn/no-immediate-mutation": "error",
121
+ "unicorn/no-instanceof-builtins": "error",
122
+ "unicorn/no-invalid-fetch-options": "error",
123
+ "unicorn/no-invalid-remove-event-listener": "error",
124
+ "unicorn/no-lonely-if": "error",
125
+ "unicorn/no-magic-array-flat-depth": "error",
126
+ "unicorn/no-negated-condition": "error",
127
+ "unicorn/no-negation-in-equality-check": "error",
128
+ "unicorn/no-new-array": "error",
129
+ "unicorn/no-new-buffer": "error",
130
+ "unicorn/no-null": "error",
131
+ "unicorn/no-object-as-default-parameter": "error",
132
+ "unicorn/no-process-exit": "error",
133
+ "unicorn/no-single-promise-in-promise-methods": "error",
134
+ "unicorn/no-static-only-class": "error",
135
+ "unicorn/no-thenable": "error",
136
+ "unicorn/no-this-assignment": "error",
137
+ "unicorn/no-typeof-undefined": "error",
138
+ "unicorn/no-unnecessary-array-flat-depth": "error",
139
+ "unicorn/no-unnecessary-array-splice-count": "error",
140
+ "unicorn/no-unnecessary-await": "error",
141
+ "unicorn/no-unnecessary-slice-end": "error",
142
+ "unicorn/no-unreadable-array-destructuring": "error",
143
+ "unicorn/no-unreadable-iife": "error",
144
+ "unicorn/no-useless-collection-argument": "error",
145
+ "unicorn/no-useless-error-capture-stack-trace": "error",
146
+ "unicorn/no-useless-fallback-in-spread": "error",
147
+ "unicorn/no-useless-length-check": "error",
148
+ "unicorn/no-useless-promise-resolve-reject": "error",
149
+ "unicorn/no-useless-spread": "error",
150
+ "unicorn/no-useless-switch-case": "error",
151
+ "unicorn/no-useless-undefined": "error",
152
+ "unicorn/no-zero-fractions": "error",
153
+ "unicorn/numeric-separators-style": "error",
154
+ "unicorn/prefer-add-event-listener": "error",
155
+ "unicorn/prefer-array-find": "error",
156
+ "unicorn/prefer-array-flat": "error",
157
+ "unicorn/prefer-array-flat-map": "error",
158
+ "unicorn/prefer-array-index-of": "error",
159
+ "unicorn/prefer-array-some": "error",
160
+ "unicorn/prefer-at": "error",
161
+ "unicorn/prefer-bigint-literals": "error",
162
+ "unicorn/prefer-blob-reading-methods": "error",
163
+ "unicorn/prefer-class-fields": "error",
164
+ "unicorn/prefer-classlist-toggle": "error",
165
+ "unicorn/prefer-code-point": "error",
166
+ "unicorn/prefer-date-now": "error",
167
+ "unicorn/prefer-default-parameters": "error",
168
+ "unicorn/prefer-dom-node-append": "error",
169
+ "unicorn/prefer-dom-node-remove": "error",
170
+ "unicorn/prefer-dom-node-text-content": "error",
171
+ "unicorn/prefer-event-target": "error",
172
+ "unicorn/prefer-export-from": "error",
173
+ "unicorn/prefer-includes": "error",
174
+ "unicorn/prefer-keyboard-event-key": "error",
175
+ "unicorn/prefer-logical-operator-over-ternary": "error",
176
+ "unicorn/prefer-math-min-max": "error",
177
+ "unicorn/prefer-math-trunc": "error",
178
+ "unicorn/prefer-modern-dom-apis": "error",
179
+ "unicorn/prefer-modern-math-apis": "error",
180
+ "unicorn/prefer-module": "error",
181
+ "unicorn/prefer-native-coercion-functions": "error",
182
+ "unicorn/prefer-negative-index": "error",
183
+ "unicorn/prefer-node-protocol": "error",
184
+ "unicorn/prefer-number-coercion": "error",
185
+ "unicorn/prefer-number-properties": "error",
186
+ "unicorn/prefer-object-from-entries": "error",
187
+ "unicorn/prefer-optional-catch-binding": "error",
188
+ "unicorn/prefer-prototype-methods": "error",
189
+ "unicorn/prefer-query-selector": "error",
190
+ "unicorn/prefer-reflect-apply": "error",
191
+ "unicorn/prefer-regexp-test": "error",
192
+ "unicorn/prefer-response-static-json": "error",
193
+ "unicorn/prefer-set-has": "error",
194
+ "unicorn/prefer-set-size": "error",
195
+ "unicorn/prefer-single-call": "error",
196
+ "unicorn/prefer-spread": "error",
197
+ "unicorn/prefer-string-raw": "error",
198
+ "unicorn/prefer-string-replace-all": "error",
199
+ "unicorn/prefer-string-slice": "error",
200
+ "unicorn/prefer-string-starts-ends-with": "error",
201
+ "unicorn/prefer-string-trim-start-end": "error",
202
+ "unicorn/prefer-structured-clone": "error",
203
+ "unicorn/prefer-ternary": "error",
204
+ "unicorn/prefer-top-level-await": "error",
205
+ "unicorn/prefer-type-error": "error",
206
+ "unicorn/relative-url-style": "error",
207
+ "unicorn/require-array-join-separator": "error",
208
+ "unicorn/require-module-attributes": "error",
209
+ "unicorn/require-module-specifiers": "error",
210
+ "unicorn/require-number-to-fixed-digits-argument": "error",
211
+ "unicorn/switch-case-braces": "error",
212
+ "unicorn/switch-case-break-position": "error",
213
+ "unicorn/text-encoding-identifier-case": "error",
214
+ "unicorn/throw-new-error": "error",
215
+ "no-console": [
216
+ "error",
217
+ {
218
+ "allow": ["warn", "error", "info"]
219
+ }
220
+ ],
221
+ "curly": ["error", "all"],
222
+ "import/namespace": "error",
223
+ "import/default": "error",
224
+ "import/no-named-as-default": "warn",
225
+ "import/no-named-as-default-member": "warn",
226
+ "import/no-duplicates": "warn",
227
+ "typescript/await-thenable": "error",
228
+ "typescript/ban-ts-comment": "error",
229
+ "typescript/no-array-delete": "error",
230
+ "typescript/no-base-to-string": "error",
231
+ "typescript/no-duplicate-enum-values": "error",
232
+ "typescript/no-duplicate-type-constituents": "error",
233
+ "typescript/no-empty-object-type": "error",
234
+ "typescript/no-explicit-any": "error",
235
+ "typescript/no-extra-non-null-assertion": "error",
236
+ "typescript/no-floating-promises": "error",
237
+ "typescript/no-for-in-array": "error",
238
+ "typescript/no-implied-eval": "error",
239
+ "typescript/no-misused-new": "error",
240
+ "typescript/no-misused-promises": [
241
+ "error",
242
+ {
243
+ "checksVoidReturn": false
244
+ }
245
+ ],
246
+ "typescript/no-namespace": "error",
247
+ "typescript/no-non-null-asserted-optional-chain": "error",
248
+ "typescript/no-redundant-type-constituents": "error",
249
+ "typescript/no-require-imports": "error",
250
+ "typescript/no-this-alias": "error",
251
+ "typescript/no-unnecessary-type-assertion": "error",
252
+ "typescript/no-unnecessary-type-constraint": "error",
253
+ "typescript/no-unsafe-declaration-merging": "error",
254
+ "typescript/no-unsafe-enum-comparison": "error",
255
+ "typescript/no-unsafe-function-type": "error",
256
+ "typescript/no-unsafe-return": "error",
257
+ "typescript/no-unsafe-unary-minus": "error",
258
+ "typescript/no-wrapper-object-types": "error",
259
+ "typescript/only-throw-error": "error",
260
+ "typescript/prefer-as-const": "error",
261
+ "typescript/prefer-namespace-keyword": "error",
262
+ "typescript/prefer-promise-reject-errors": "error",
263
+ "typescript/require-await": "error",
264
+ "typescript/restrict-plus-operands": "error",
265
+ "typescript/restrict-template-expressions": "error",
266
+ "typescript/triple-slash-reference": "error",
267
+ "typescript/unbound-method": "error"
268
+ },
269
+ "overrides": [
270
+ {
271
+ "files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
272
+ "rules": {
273
+ "constructor-super": "off",
274
+ "getter-return": "off",
275
+ "no-class-assign": "off",
276
+ "no-const-assign": "off",
277
+ "no-dupe-class-members": "off",
278
+ "no-dupe-keys": "off",
279
+ "no-func-assign": "off",
280
+ "no-import-assign": "off",
281
+ "no-new-native-nonconstructor": "off",
282
+ "no-obj-calls": "off",
283
+ "no-redeclare": "off",
284
+ "no-setter-return": "off",
285
+ "no-this-before-super": "off",
286
+ "no-unreachable": "off",
287
+ "no-unsafe-negation": "off",
288
+ "no-var": "error",
289
+ "no-with": "off",
290
+ "prefer-const": "error",
291
+ "prefer-rest-params": "error",
292
+ "prefer-spread": "error"
293
+ }
294
+ }
295
+ ]
296
+ }