@zhangyu1818/oxlint-config 2.1.1 → 2.3.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/dist/index.js CHANGED
@@ -1,1030 +1,871 @@
1
- // src/oxlint/index.ts
2
- import { isPackageExists as isPackageExists2 } from "local-pkg";
3
-
4
- // src/shared/ignore-patterns.ts
5
- var defaultIgnorePatterns = [
6
- "**/node_modules",
7
- "**/dist",
8
- "**/package-lock.json",
9
- "**/yarn.lock",
10
- "**/pnpm-lock.yaml",
11
- "**/bun.lockb",
12
- "**/output",
13
- "**/coverage",
14
- "**/temp",
15
- "**/.temp",
16
- "**/tmp",
17
- "**/.tmp",
18
- "**/.history",
19
- "**/.vitepress/cache",
20
- "**/.nuxt",
21
- "**/.next",
22
- "**/.vercel",
23
- "**/.changeset",
24
- "**/.idea",
25
- "**/.cache",
26
- "**/.output",
27
- "**/.vite-inspect",
28
- "**/.yarn",
29
- "**/CHANGELOG*.md",
30
- "**/*.min.*",
31
- "**/LICENSE*",
32
- "**/__snapshots__",
33
- "**/auto-import.d.ts",
34
- "**/auto-imports.d.ts",
35
- "**/components.d.ts",
36
- "tests/fixtures/**"
1
+ import { isPackageExists } from "local-pkg";
2
+ import { existsSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ //#region src/shared/ignore-patterns.ts
5
+ const defaultIgnorePatterns = [
6
+ "**/node_modules",
7
+ "**/dist",
8
+ "**/package-lock.json",
9
+ "**/yarn.lock",
10
+ "**/pnpm-lock.yaml",
11
+ "**/bun.lockb",
12
+ "**/output",
13
+ "**/coverage",
14
+ "**/temp",
15
+ "**/.temp",
16
+ "**/tmp",
17
+ "**/.tmp",
18
+ ".tmp-*",
19
+ "**/.history",
20
+ "**/.vitepress/cache",
21
+ "**/.nuxt",
22
+ "**/.next",
23
+ "**/.vercel",
24
+ "**/.changeset",
25
+ "**/.idea",
26
+ "**/.cache",
27
+ "**/.output",
28
+ "**/.vite-inspect",
29
+ "**/.yarn",
30
+ "**/CHANGELOG*.md",
31
+ "**/*.min.*",
32
+ "**/LICENSE*",
33
+ "**/__snapshots__",
34
+ "**/auto-import.d.ts",
35
+ "**/auto-imports.d.ts",
36
+ "**/components.d.ts",
37
+ "tests/fixtures/**"
37
38
  ];
38
-
39
- // src/oxlint/presets/imports.ts
40
- var importRules = {
41
- "import/first": "error",
42
- "import/no-duplicates": ["error", { "prefer-inline": true }],
43
- "import/no-mutable-exports": "error",
44
- "import/no-named-default": "error",
45
- "import/no-self-import": "error",
46
- "import/no-webpack-loader-syntax": "error"
39
+ //#endregion
40
+ //#region src/oxlint/presets/imports.ts
41
+ const importRules = {
42
+ "import/first": "error",
43
+ "import/newline-after-import": "error",
44
+ "import/no-duplicates": ["error", { "prefer-inline": true }],
45
+ "import/no-mutable-exports": "error",
46
+ "import/no-named-default": "error",
47
+ "import/no-self-import": "error",
48
+ "import/no-webpack-loader-syntax": "error"
47
49
  };
48
-
49
- // src/oxlint/presets/javascript.ts
50
- var javascriptRules = {
51
- "accessor-pairs": [
52
- "error",
53
- {
54
- enforceForClassMembers: true,
55
- setWithoutGet: true
56
- }
57
- ],
58
- "array-callback-return": "error",
59
- "block-scoped-var": "error",
60
- "constructor-super": "error",
61
- "default-case-last": "error",
62
- eqeqeq: ["error", "smart"],
63
- "new-cap": [
64
- "error",
65
- {
66
- capIsNew: false,
67
- newIsCap: true,
68
- properties: true
69
- }
70
- ],
71
- "no-alert": "error",
72
- "no-array-constructor": "error",
73
- "no-async-promise-executor": "error",
74
- "no-caller": "error",
75
- "no-case-declarations": "error",
76
- "no-class-assign": "error",
77
- "no-compare-neg-zero": "error",
78
- "no-cond-assign": ["error", "always"],
79
- "no-console": [
80
- "error",
81
- {
82
- allow: ["warn", "error"]
83
- }
84
- ],
85
- "no-const-assign": "error",
86
- "no-control-regex": "error",
87
- "no-debugger": "error",
88
- "no-delete-var": "error",
89
- "no-dupe-class-members": "error",
90
- "no-dupe-keys": "error",
91
- "no-duplicate-case": "error",
92
- "no-empty": ["error", { allowEmptyCatch: true }],
93
- "no-empty-character-class": "error",
94
- "no-empty-pattern": "error",
95
- "no-eval": "error",
96
- "no-ex-assign": "error",
97
- "no-extend-native": "error",
98
- "no-extra-bind": "error",
99
- "no-extra-boolean-cast": "error",
100
- "no-fallthrough": "error",
101
- "no-func-assign": "error",
102
- "no-global-assign": "error",
103
- "no-import-assign": "error",
104
- "no-invalid-regexp": "error",
105
- "no-irregular-whitespace": "error",
106
- "no-iterator": "error",
107
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
108
- "no-lone-blocks": "error",
109
- "no-loss-of-precision": "error",
110
- "no-misleading-character-class": "error",
111
- "no-multi-str": "error",
112
- "no-new": "error",
113
- "no-new-func": "error",
114
- "no-new-native-nonconstructor": "error",
115
- "no-new-wrappers": "error",
116
- "no-obj-calls": "error",
117
- "no-proto": "error",
118
- "no-prototype-builtins": "error",
119
- "no-redeclare": ["error", { builtinGlobals: false }],
120
- "no-regex-spaces": "error",
121
- "no-restricted-globals": [
122
- "error",
123
- {
124
- message: "Use `globalThis` instead.",
125
- name: "global"
126
- },
127
- {
128
- message: "Use `globalThis` instead.",
129
- name: "self"
130
- }
131
- ],
132
- "no-self-assign": ["error", { props: true }],
133
- "no-self-compare": "error",
134
- "no-sequences": "error",
135
- "no-shadow-restricted-names": "error",
136
- "no-sparse-arrays": "error",
137
- "no-template-curly-in-string": "error",
138
- "no-this-before-super": "error",
139
- "no-throw-literal": "error",
140
- "no-undef": "error",
141
- "no-unmodified-loop-condition": "error",
142
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
143
- "no-unreachable": "error",
144
- "no-unsafe-finally": "error",
145
- "no-unsafe-negation": "error",
146
- "no-unused-expressions": [
147
- "error",
148
- {
149
- allowTaggedTemplates: true,
150
- allowTernary: true
151
- }
152
- ],
153
- "no-unused-vars": [
154
- "error",
155
- {
156
- args: "none",
157
- caughtErrors: "none",
158
- vars: "all"
159
- }
160
- ],
161
- "no-use-before-define": [
162
- "error",
163
- {
164
- classes: false,
165
- functions: false,
166
- variables: true
167
- }
168
- ],
169
- "no-useless-backreference": "error",
170
- "no-useless-call": "error",
171
- "no-useless-catch": "error",
172
- "no-useless-computed-key": "error",
173
- "no-useless-constructor": "error",
174
- "no-useless-rename": "error",
175
- "no-useless-return": "error",
176
- "no-var": "error",
177
- "no-with": "error",
178
- "object-shorthand": [
179
- "error",
180
- "always",
181
- {
182
- avoidExplicitReturnArrows: true,
183
- avoidQuotes: true
184
- }
185
- ],
186
- "prefer-const": ["error", { destructuring: "all" }],
187
- "prefer-exponentiation-operator": "error",
188
- "prefer-promise-reject-errors": "error",
189
- "prefer-rest-params": "error",
190
- "prefer-spread": "error",
191
- "prefer-template": "error",
192
- "symbol-description": "error",
193
- "unicode-bom": ["error", "never"],
194
- "use-isnan": [
195
- "error",
196
- {
197
- enforceForIndexOf: true,
198
- enforceForSwitchCase: true
199
- }
200
- ],
201
- "valid-typeof": ["error", { requireStringLiterals: true }],
202
- "vars-on-top": "error",
203
- yoda: ["error", "never"]
50
+ //#endregion
51
+ //#region src/oxlint/presets/javascript.ts
52
+ const javascriptRules = {
53
+ "accessor-pairs": ["error", {
54
+ enforceForClassMembers: true,
55
+ setWithoutGet: true
56
+ }],
57
+ "array-callback-return": "error",
58
+ "block-scoped-var": "error",
59
+ "constructor-super": "error",
60
+ "default-case-last": "error",
61
+ eqeqeq: ["error", "smart"],
62
+ "new-cap": ["error", {
63
+ capIsNew: false,
64
+ newIsCap: true,
65
+ properties: true
66
+ }],
67
+ "no-alert": "error",
68
+ "no-array-constructor": "error",
69
+ "no-async-promise-executor": "error",
70
+ "no-caller": "error",
71
+ "no-case-declarations": "error",
72
+ "no-class-assign": "error",
73
+ "no-compare-neg-zero": "error",
74
+ "no-cond-assign": ["error", "always"],
75
+ "no-console": ["error", { allow: ["warn", "error"] }],
76
+ "no-const-assign": "error",
77
+ "no-control-regex": "error",
78
+ "no-debugger": "error",
79
+ "no-delete-var": "error",
80
+ "no-dupe-class-members": "error",
81
+ "no-dupe-keys": "error",
82
+ "no-duplicate-case": "error",
83
+ "no-empty": ["error", { allowEmptyCatch: true }],
84
+ "no-empty-character-class": "error",
85
+ "no-empty-pattern": "error",
86
+ "no-eval": "error",
87
+ "no-ex-assign": "error",
88
+ "no-extend-native": "error",
89
+ "no-extra-bind": "error",
90
+ "no-extra-boolean-cast": "error",
91
+ "no-fallthrough": "error",
92
+ "no-func-assign": "error",
93
+ "no-global-assign": "error",
94
+ "no-import-assign": "error",
95
+ "no-invalid-regexp": "error",
96
+ "no-irregular-whitespace": "error",
97
+ "no-iterator": "error",
98
+ "no-labels": ["error", {
99
+ allowLoop: false,
100
+ allowSwitch: false
101
+ }],
102
+ "no-lone-blocks": "error",
103
+ "no-loss-of-precision": "error",
104
+ "no-misleading-character-class": "error",
105
+ "no-multi-str": "error",
106
+ "no-new": "error",
107
+ "no-new-func": "error",
108
+ "no-new-native-nonconstructor": "error",
109
+ "no-new-wrappers": "error",
110
+ "no-obj-calls": "error",
111
+ "no-proto": "error",
112
+ "no-prototype-builtins": "error",
113
+ "no-redeclare": ["error", { builtinGlobals: false }],
114
+ "no-regex-spaces": "error",
115
+ "no-restricted-globals": [
116
+ "error",
117
+ {
118
+ message: "Use `globalThis` instead.",
119
+ name: "global"
120
+ },
121
+ {
122
+ message: "Use `globalThis` instead.",
123
+ name: "self"
124
+ }
125
+ ],
126
+ "no-self-assign": ["error", { props: true }],
127
+ "no-self-compare": "error",
128
+ "no-sequences": "error",
129
+ "no-shadow-restricted-names": "error",
130
+ "no-sparse-arrays": "error",
131
+ "no-template-curly-in-string": "error",
132
+ "no-this-before-super": "error",
133
+ "no-throw-literal": "error",
134
+ "no-undef": "error",
135
+ "no-unmodified-loop-condition": "error",
136
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
137
+ "no-unreachable": "error",
138
+ "no-unsafe-finally": "error",
139
+ "no-unsafe-negation": "error",
140
+ "no-unused-expressions": ["error", {
141
+ allowTaggedTemplates: true,
142
+ allowTernary: true
143
+ }],
144
+ "no-unused-vars": ["error", {
145
+ args: "none",
146
+ caughtErrors: "none",
147
+ vars: "all"
148
+ }],
149
+ "no-use-before-define": ["error", {
150
+ classes: false,
151
+ functions: false,
152
+ variables: true
153
+ }],
154
+ "no-useless-backreference": "error",
155
+ "no-useless-call": "error",
156
+ "no-useless-catch": "error",
157
+ "no-useless-computed-key": "error",
158
+ "no-useless-constructor": "error",
159
+ "no-useless-rename": "error",
160
+ "no-useless-return": "error",
161
+ "no-var": "error",
162
+ "no-with": "error",
163
+ "object-shorthand": [
164
+ "error",
165
+ "always",
166
+ {
167
+ avoidExplicitReturnArrows: true,
168
+ avoidQuotes: true
169
+ }
170
+ ],
171
+ "prefer-const": ["error", { destructuring: "all" }],
172
+ "prefer-exponentiation-operator": "error",
173
+ "prefer-promise-reject-errors": "error",
174
+ "prefer-rest-params": "error",
175
+ "prefer-spread": "error",
176
+ "prefer-template": "error",
177
+ "symbol-description": "error",
178
+ "unicode-bom": ["error", "never"],
179
+ "use-isnan": ["error", {
180
+ enforceForIndexOf: true,
181
+ enforceForSwitchCase: true
182
+ }],
183
+ "valid-typeof": ["error", { requireStringLiterals: true }],
184
+ "vars-on-top": "error",
185
+ yoda: ["error", "never"]
204
186
  };
205
-
206
- // src/oxlint/presets/next.ts
207
- var nextjsRules = {
208
- "nextjs/google-font-display": "warn",
209
- "nextjs/google-font-preconnect": "warn",
210
- "nextjs/inline-script-id": "error",
211
- "nextjs/next-script-for-ga": "warn",
212
- "nextjs/no-assign-module-variable": "error",
213
- "nextjs/no-async-client-component": "warn",
214
- "nextjs/no-before-interactive-script-outside-document": "warn",
215
- "nextjs/no-css-tags": "warn",
216
- "nextjs/no-document-import-in-page": "error",
217
- "nextjs/no-duplicate-head": "error",
218
- "nextjs/no-head-element": "warn",
219
- "nextjs/no-head-import-in-document": "error",
220
- "nextjs/no-html-link-for-pages": "off",
221
- "nextjs/no-img-element": "warn",
222
- "nextjs/no-page-custom-font": "warn",
223
- "nextjs/no-script-component-in-head": "error",
224
- "nextjs/no-styled-jsx-in-document": "warn",
225
- "nextjs/no-sync-scripts": "error",
226
- "nextjs/no-title-in-document-head": "warn",
227
- "nextjs/no-typos": "warn",
228
- "nextjs/no-unwanted-polyfillio": "warn"
187
+ //#endregion
188
+ //#region src/oxlint/presets/next.ts
189
+ const nextjsRules = {
190
+ "nextjs/google-font-display": "warn",
191
+ "nextjs/google-font-preconnect": "warn",
192
+ "nextjs/inline-script-id": "error",
193
+ "nextjs/next-script-for-ga": "warn",
194
+ "nextjs/no-assign-module-variable": "error",
195
+ "nextjs/no-async-client-component": "warn",
196
+ "nextjs/no-before-interactive-script-outside-document": "warn",
197
+ "nextjs/no-css-tags": "warn",
198
+ "nextjs/no-document-import-in-page": "error",
199
+ "nextjs/no-duplicate-head": "error",
200
+ "nextjs/no-head-element": "warn",
201
+ "nextjs/no-head-import-in-document": "error",
202
+ "nextjs/no-html-link-for-pages": "off",
203
+ "nextjs/no-img-element": "warn",
204
+ "nextjs/no-page-custom-font": "warn",
205
+ "nextjs/no-script-component-in-head": "error",
206
+ "nextjs/no-styled-jsx-in-document": "warn",
207
+ "nextjs/no-sync-scripts": "error",
208
+ "nextjs/no-title-in-document-head": "warn",
209
+ "nextjs/no-typos": "warn",
210
+ "nextjs/no-unwanted-polyfillio": "warn"
229
211
  };
230
-
231
- // src/oxlint/presets/node.ts
232
- var nodeRules = {
233
- "node/handle-callback-err": ["error", "^(err|error)$"],
234
- "node/no-exports-assign": "error",
235
- "node/no-new-require": "error",
236
- "node/no-path-concat": "error"
212
+ //#endregion
213
+ //#region src/oxlint/presets/node.ts
214
+ const nodeRules = {
215
+ "node/handle-callback-err": ["error", "^(err|error)$"],
216
+ "node/no-exports-assign": "error",
217
+ "node/no-new-require": "error",
218
+ "node/no-path-concat": "error"
237
219
  };
238
-
239
- // src/oxlint/presets/react-agent-rules.ts
240
- import { existsSync } from "fs";
241
- import { fileURLToPath } from "url";
220
+ //#endregion
221
+ //#region src/oxlint/presets/react-agent-rules.ts
242
222
  function resolveReactAgentRulesPluginPath() {
243
- const sourcePluginPath = fileURLToPath(
244
- new URL("../../react-agent-rules.ts", import.meta.url)
245
- );
246
- if (existsSync(sourcePluginPath)) {
247
- return sourcePluginPath;
248
- }
249
- return fileURLToPath(new URL("./react-agent-rules.js", import.meta.url));
223
+ const sourcePluginPath = fileURLToPath(new URL("../../react-agent-rules.ts", import.meta.url));
224
+ if (existsSync(sourcePluginPath)) return sourcePluginPath;
225
+ return fileURLToPath(new URL("./react-agent-rules.js", import.meta.url));
250
226
  }
251
- var reactAgentRulesPlugin = resolveReactAgentRulesPluginPath();
252
- var reactAgentRules = {
253
- "react-agent-rules/effect-empty-deps-only": "error",
254
- "react-agent-rules/no-forward-ref": "error",
255
- "react-agent-rules/no-manual-memoization": "error",
256
- "react-agent-rules/no-use-context": "error"
227
+ const reactAgentRulesPlugin = resolveReactAgentRulesPluginPath();
228
+ const reactAgentRules = {
229
+ "react-agent-rules/effect-empty-deps-only": "error",
230
+ "react-agent-rules/no-forward-ref": "error",
231
+ "react-agent-rules/no-manual-memoization": "error",
232
+ "react-agent-rules/no-use-context": "error"
257
233
  };
258
-
259
- // src/oxlint/presets/react.ts
260
- import { isPackageExists } from "local-pkg";
261
- var jsxA11yRules = {
262
- "jsx-a11y/alt-text": "error",
263
- "jsx-a11y/anchor-ambiguous-text": "off",
264
- "jsx-a11y/anchor-has-content": "error",
265
- "jsx-a11y/anchor-is-valid": "error",
266
- "jsx-a11y/aria-activedescendant-has-tabindex": "error",
267
- "jsx-a11y/aria-props": "error",
268
- "jsx-a11y/aria-proptypes": "error",
269
- "jsx-a11y/aria-role": "error",
270
- "jsx-a11y/aria-unsupported-elements": "error",
271
- "jsx-a11y/autocomplete-valid": "error",
272
- "jsx-a11y/click-events-have-key-events": "error",
273
- "jsx-a11y/heading-has-content": "error",
274
- "jsx-a11y/html-has-lang": "error",
275
- "jsx-a11y/iframe-has-title": "error",
276
- "jsx-a11y/img-redundant-alt": "error",
277
- "jsx-a11y/label-has-associated-control": "error",
278
- "jsx-a11y/media-has-caption": "error",
279
- "jsx-a11y/mouse-events-have-key-events": "error",
280
- "jsx-a11y/no-access-key": "error",
281
- "jsx-a11y/no-autofocus": "error",
282
- "jsx-a11y/no-distracting-elements": "error",
283
- "jsx-a11y/no-noninteractive-tabindex": [
284
- "error",
285
- {
286
- allowExpressionValues: true,
287
- roles: ["tabpanel"],
288
- tags: []
289
- }
290
- ],
291
- "jsx-a11y/no-redundant-roles": "error",
292
- "jsx-a11y/no-static-element-interactions": [
293
- "error",
294
- {
295
- allowExpressionValues: true,
296
- handlers: [
297
- "onClick",
298
- "onMouseDown",
299
- "onMouseUp",
300
- "onKeyPress",
301
- "onKeyDown",
302
- "onKeyUp"
303
- ]
304
- }
305
- ],
306
- "jsx-a11y/role-has-required-aria-props": "error",
307
- "jsx-a11y/role-supports-aria-props": "error",
308
- "jsx-a11y/scope": "error",
309
- "jsx-a11y/tabindex-no-positive": "error"
234
+ //#endregion
235
+ //#region src/oxlint/presets/react.ts
236
+ const jsxA11yRules = {
237
+ "jsx-a11y/alt-text": "error",
238
+ "jsx-a11y/anchor-ambiguous-text": "off",
239
+ "jsx-a11y/anchor-has-content": "error",
240
+ "jsx-a11y/anchor-is-valid": "error",
241
+ "jsx-a11y/aria-activedescendant-has-tabindex": "error",
242
+ "jsx-a11y/aria-props": "error",
243
+ "jsx-a11y/aria-proptypes": "error",
244
+ "jsx-a11y/aria-role": "error",
245
+ "jsx-a11y/aria-unsupported-elements": "error",
246
+ "jsx-a11y/autocomplete-valid": "error",
247
+ "jsx-a11y/click-events-have-key-events": "error",
248
+ "jsx-a11y/heading-has-content": "error",
249
+ "jsx-a11y/html-has-lang": "error",
250
+ "jsx-a11y/iframe-has-title": "error",
251
+ "jsx-a11y/img-redundant-alt": "error",
252
+ "jsx-a11y/interactive-supports-focus": "error",
253
+ "jsx-a11y/label-has-associated-control": "error",
254
+ "jsx-a11y/media-has-caption": "error",
255
+ "jsx-a11y/mouse-events-have-key-events": "error",
256
+ "jsx-a11y/no-access-key": "error",
257
+ "jsx-a11y/no-autofocus": "error",
258
+ "jsx-a11y/no-distracting-elements": "error",
259
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
260
+ "jsx-a11y/no-noninteractive-element-interactions": "error",
261
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
262
+ "jsx-a11y/no-noninteractive-tabindex": ["error", {
263
+ allowExpressionValues: true,
264
+ roles: ["tabpanel"],
265
+ tags: []
266
+ }],
267
+ "jsx-a11y/no-redundant-roles": "error",
268
+ "jsx-a11y/no-static-element-interactions": ["error", {
269
+ allowExpressionValues: true,
270
+ handlers: [
271
+ "onClick",
272
+ "onMouseDown",
273
+ "onMouseUp",
274
+ "onKeyPress",
275
+ "onKeyDown",
276
+ "onKeyUp"
277
+ ]
278
+ }],
279
+ "jsx-a11y/role-has-required-aria-props": "error",
280
+ "jsx-a11y/role-supports-aria-props": "error",
281
+ "jsx-a11y/scope": "error",
282
+ "jsx-a11y/tabindex-no-positive": "error"
310
283
  };
311
- var baseReactRules = {
312
- "react/exhaustive-deps": "warn",
313
- "react/jsx-boolean-value": "error",
314
- "react/jsx-curly-brace-presence": [
315
- "error",
316
- {
317
- children: "never",
318
- propElementValues: "always",
319
- props: "never"
320
- }
321
- ],
322
- "react/jsx-key": "error",
323
- "react/jsx-no-comment-textnodes": "error",
324
- "react/jsx-no-duplicate-props": "error",
325
- "react/jsx-no-target-blank": "error",
326
- "react/jsx-no-undef": "error",
327
- "react/jsx-no-useless-fragment": "error",
328
- "react/no-array-index-key": "warn",
329
- "react/no-children-prop": "error",
330
- "react/no-danger-with-children": "error",
331
- "react/no-direct-mutation-state": "error",
332
- "react/no-find-dom-node": "error",
333
- "react/no-is-mounted": "error",
334
- "react/no-render-return-value": "error",
335
- "react/no-string-refs": "error",
336
- "react/no-unknown-property": "error",
337
- "react/no-unescaped-entities": "error",
338
- "react/react-in-jsx-scope": "off",
339
- "react/require-render-return": "error",
340
- "react/rules-of-hooks": "error",
341
- "react/self-closing-comp": [
342
- "error",
343
- {
344
- component: true,
345
- html: true
346
- }
347
- ],
348
- "react/void-dom-elements-no-children": "error"
284
+ const baseReactRules = {
285
+ "react/exhaustive-deps": "warn",
286
+ "react/jsx-boolean-value": "error",
287
+ "react/jsx-curly-brace-presence": ["error", {
288
+ children: "never",
289
+ propElementValues: "always",
290
+ props: "never"
291
+ }],
292
+ "react/jsx-key": "error",
293
+ "react/jsx-no-comment-textnodes": "error",
294
+ "react/jsx-no-duplicate-props": "error",
295
+ "react/jsx-no-target-blank": "error",
296
+ "react/jsx-no-undef": "error",
297
+ "react/jsx-no-useless-fragment": "error",
298
+ "react/no-array-index-key": "warn",
299
+ "react/no-children-prop": "error",
300
+ "react/no-danger-with-children": "error",
301
+ "react/no-direct-mutation-state": "error",
302
+ "react/no-find-dom-node": "error",
303
+ "react/no-is-mounted": "error",
304
+ "react/no-render-return-value": "error",
305
+ "react/no-string-refs": "error",
306
+ "react/no-unknown-property": "error",
307
+ "react/no-unescaped-entities": "error",
308
+ "react/no-unstable-nested-components": "error",
309
+ "react/react-in-jsx-scope": "off",
310
+ "react/require-render-return": "error",
311
+ "react/rules-of-hooks": "error",
312
+ "react/self-closing-comp": ["error", {
313
+ component: true,
314
+ html: true
315
+ }],
316
+ "react/void-dom-elements-no-children": "error"
349
317
  };
350
318
  function createReactRules(options, nextEnabled) {
351
- const framework = options.framework ?? {};
352
- const next = framework.next ?? nextEnabled;
353
- const vite = framework.vite ?? isPackageExists("vite");
354
- return {
355
- ...baseReactRules,
356
- "react/only-export-components": [
357
- "warn",
358
- {
359
- allowConstantExport: vite,
360
- allowExportNames: next ? [
361
- "dynamic",
362
- "dynamicParams",
363
- "revalidate",
364
- "fetchCache",
365
- "runtime",
366
- "preferredRegion",
367
- "maxDuration",
368
- "generateStaticParams",
369
- "metadata",
370
- "generateMetadata",
371
- "viewport",
372
- "generateViewport"
373
- ] : []
374
- }
375
- ]
376
- };
319
+ const framework = options.framework ?? {};
320
+ const next = framework.next ?? nextEnabled;
321
+ const vite = framework.vite ?? isPackageExists("vite");
322
+ return {
323
+ ...baseReactRules,
324
+ "react/only-export-components": ["warn", {
325
+ allowConstantExport: vite,
326
+ allowExportNames: next ? [
327
+ "dynamic",
328
+ "dynamicParams",
329
+ "revalidate",
330
+ "fetchCache",
331
+ "runtime",
332
+ "preferredRegion",
333
+ "maxDuration",
334
+ "generateStaticParams",
335
+ "metadata",
336
+ "generateMetadata",
337
+ "viewport",
338
+ "generateViewport"
339
+ ] : []
340
+ }]
341
+ };
377
342
  }
378
-
379
- // src/oxlint/presets/test.ts
380
- var vitestRules = {
381
- "no-unused-expressions": "off",
382
- "vitest/expect-expect": "error",
383
- "vitest/no-commented-out-tests": "error",
384
- "vitest/no-conditional-expect": "error",
385
- "vitest/no-disabled-tests": "warn",
386
- "vitest/no-focused-tests": "error",
387
- "vitest/no-identical-title": "error",
388
- "vitest/no-import-node-test": "error",
389
- "vitest/no-interpolation-in-snapshots": "error",
390
- "vitest/no-mocks-import": "error",
391
- "vitest/no-standalone-expect": "error",
392
- "vitest/no-unneeded-async-expect-function": "error",
393
- "vitest/prefer-called-exactly-once-with": "error",
394
- "vitest/require-local-test-context-for-concurrent-snapshots": "error",
395
- "vitest/valid-describe-callback": "error",
396
- "vitest/valid-expect": "error",
397
- "vitest/valid-expect-in-promise": "error",
398
- "vitest/valid-title": "error"
343
+ //#endregion
344
+ //#region src/oxlint/presets/test.ts
345
+ const vitestRules = {
346
+ "no-unused-expressions": "off",
347
+ "vitest/expect-expect": "error",
348
+ "vitest/no-commented-out-tests": "error",
349
+ "vitest/no-conditional-expect": "error",
350
+ "vitest/no-disabled-tests": "warn",
351
+ "vitest/no-focused-tests": "error",
352
+ "vitest/no-identical-title": "error",
353
+ "vitest/no-import-node-test": "error",
354
+ "vitest/no-interpolation-in-snapshots": "error",
355
+ "vitest/no-mocks-import": "error",
356
+ "vitest/no-standalone-expect": "error",
357
+ "vitest/no-unneeded-async-expect-function": "error",
358
+ "vitest/prefer-called-exactly-once-with": "error",
359
+ "vitest/require-local-test-context-for-concurrent-snapshots": "error",
360
+ "vitest/valid-describe-callback": "error",
361
+ "vitest/valid-expect": "error",
362
+ "vitest/valid-expect-in-promise": "error",
363
+ "vitest/valid-title": "error"
399
364
  };
400
-
401
- // src/oxlint/presets/typescript.ts
402
- var typeScriptRules = {
403
- "no-throw-literal": "off",
404
- "no-undef": "off",
405
- "no-unused-vars": "error",
406
- "typescript/adjacent-overload-signatures": "off",
407
- "typescript/array-type": "error",
408
- "typescript/await-thenable": "warn",
409
- "typescript/ban-ts-comment": [
410
- "error",
411
- {
412
- minimumDescriptionLength: 3,
413
- "ts-check": false,
414
- "ts-expect-error": "allow-with-description",
415
- "ts-ignore": true,
416
- "ts-nocheck": true
417
- }
418
- ],
419
- "typescript/consistent-generic-constructors": "error",
420
- "typescript/consistent-indexed-object-style": "error",
421
- "typescript/consistent-type-definitions": "warn",
422
- "typescript/consistent-type-exports": [
423
- "error",
424
- {
425
- fixMixedExportsWithInlineTypeSpecifier: true
426
- }
427
- ],
428
- "typescript/consistent-type-imports": [
429
- "error",
430
- {
431
- disallowTypeAnnotations: false,
432
- fixStyle: "separate-type-imports",
433
- prefer: "type-imports"
434
- }
435
- ],
436
- "typescript/dot-notation": ["error", { allowKeywords: true }],
437
- "typescript/no-implied-eval": "error",
438
- "typescript/no-array-delete": "error",
439
- "typescript/no-base-to-string": "error",
440
- "typescript/no-duplicate-enum-values": "error",
441
- "typescript/no-duplicate-type-constituents": "error",
442
- "typescript/no-dynamic-delete": "error",
443
- "typescript/no-empty-interface": "error",
444
- "typescript/no-empty-object-type": "error",
445
- "typescript/no-explicit-any": "warn",
446
- "typescript/no-extra-non-null-assertion": "error",
447
- "typescript/no-extraneous-class": "error",
448
- "typescript/no-for-in-array": "error",
449
- "typescript/no-import-type-side-effects": "error",
450
- "typescript/no-invalid-void-type": "error",
451
- "typescript/no-meaningless-void-operator": "error",
452
- "typescript/no-misused-new": "error",
453
- "typescript/no-misused-promises": "error",
454
- "typescript/no-mixed-enums": "error",
455
- "typescript/no-namespace": "error",
456
- "typescript/no-non-null-asserted-nullish-coalescing": "error",
457
- "typescript/no-non-null-asserted-optional-chain": "error",
458
- "typescript/no-non-null-assertion": "off",
459
- "typescript/no-redundant-type-constituents": "error",
460
- "typescript/no-this-alias": "error",
461
- "typescript/no-unnecessary-boolean-literal-compare": "error",
462
- "typescript/no-unnecessary-condition": "error",
463
- "typescript/no-unnecessary-template-expression": "error",
464
- "typescript/no-unnecessary-type-arguments": "error",
465
- "typescript/no-unnecessary-type-assertion": "error",
466
- "typescript/no-unnecessary-type-constraint": "error",
467
- "typescript/no-unsafe-declaration-merging": "error",
468
- "typescript/no-unsafe-function-type": "error",
469
- "typescript/no-useless-empty-export": "error",
470
- "typescript/no-var-requires": "error",
471
- "typescript/no-wrapper-object-types": "error",
472
- "typescript/non-nullable-type-assertion-style": "error",
473
- "typescript/only-throw-error": "error",
474
- "typescript/prefer-as-const": "error",
475
- "typescript/prefer-literal-enum-member": "error",
476
- "typescript/prefer-optional-chain": "error",
477
- "typescript/triple-slash-reference": "warn",
478
- "typescript/unified-signatures": "error"
365
+ //#endregion
366
+ //#region src/oxlint/presets/typescript.ts
367
+ const typeScriptRules = {
368
+ "no-throw-literal": "off",
369
+ "no-undef": "off",
370
+ "no-unused-vars": "error",
371
+ "typescript/adjacent-overload-signatures": "off",
372
+ "typescript/array-type": "error",
373
+ "typescript/await-thenable": "warn",
374
+ "typescript/ban-ts-comment": ["error", {
375
+ minimumDescriptionLength: 3,
376
+ "ts-check": false,
377
+ "ts-expect-error": "allow-with-description",
378
+ "ts-ignore": true,
379
+ "ts-nocheck": true
380
+ }],
381
+ "typescript/consistent-generic-constructors": "error",
382
+ "typescript/consistent-indexed-object-style": "error",
383
+ "typescript/consistent-type-definitions": "warn",
384
+ "typescript/consistent-type-exports": ["error", { fixMixedExportsWithInlineTypeSpecifier: true }],
385
+ "typescript/consistent-type-imports": ["error", {
386
+ disallowTypeAnnotations: false,
387
+ fixStyle: "separate-type-imports",
388
+ prefer: "type-imports"
389
+ }],
390
+ "typescript/dot-notation": ["error", { allowKeywords: true }],
391
+ "typescript/no-implied-eval": "error",
392
+ "typescript/no-array-delete": "error",
393
+ "typescript/no-base-to-string": "error",
394
+ "typescript/no-duplicate-enum-values": "error",
395
+ "typescript/no-duplicate-type-constituents": "error",
396
+ "typescript/no-dynamic-delete": "error",
397
+ "typescript/no-empty-interface": "error",
398
+ "typescript/no-empty-object-type": "error",
399
+ "typescript/no-explicit-any": "warn",
400
+ "typescript/no-extra-non-null-assertion": "error",
401
+ "typescript/no-extraneous-class": "error",
402
+ "typescript/no-for-in-array": "error",
403
+ "typescript/no-import-type-side-effects": "error",
404
+ "typescript/no-invalid-void-type": "error",
405
+ "typescript/no-meaningless-void-operator": "error",
406
+ "typescript/no-misused-new": "error",
407
+ "typescript/no-misused-promises": "error",
408
+ "typescript/no-mixed-enums": "error",
409
+ "typescript/no-namespace": "error",
410
+ "typescript/no-non-null-asserted-nullish-coalescing": "error",
411
+ "typescript/no-non-null-asserted-optional-chain": "error",
412
+ "typescript/no-non-null-assertion": "off",
413
+ "typescript/no-redundant-type-constituents": "error",
414
+ "typescript/no-this-alias": "error",
415
+ "typescript/no-unnecessary-boolean-literal-compare": "error",
416
+ "typescript/no-unnecessary-condition": "error",
417
+ "typescript/no-unnecessary-template-expression": "error",
418
+ "typescript/no-unnecessary-type-arguments": "error",
419
+ "typescript/no-unnecessary-type-assertion": "error",
420
+ "typescript/no-unnecessary-type-constraint": "error",
421
+ "typescript/no-unsafe-declaration-merging": "error",
422
+ "typescript/no-unsafe-function-type": "error",
423
+ "typescript/no-useless-empty-export": "error",
424
+ "typescript/no-var-requires": "error",
425
+ "typescript/no-wrapper-object-types": "error",
426
+ "typescript/non-nullable-type-assertion-style": "error",
427
+ "typescript/only-throw-error": "error",
428
+ "typescript/prefer-as-const": "error",
429
+ "typescript/prefer-literal-enum-member": "error",
430
+ "typescript/prefer-optional-chain": "error",
431
+ "typescript/triple-slash-reference": "warn",
432
+ "typescript/unified-signatures": "error"
479
433
  };
480
-
481
- // src/oxlint/presets/unicorn.ts
482
- var unicornRules = {
483
- "unicorn/consistent-empty-array-spread": "error",
484
- "unicorn/consistent-function-scoping": "error",
485
- "unicorn/error-message": "error",
486
- "unicorn/escape-case": "error",
487
- "unicorn/explicit-length-check": ["error", { "non-zero": "not-equal" }],
488
- "unicorn/new-for-builtins": "error",
489
- "unicorn/no-anonymous-default-export": "error",
490
- "unicorn/no-await-expression-member": "error",
491
- "unicorn/no-await-in-promise-methods": "error",
492
- "unicorn/no-instanceof-builtins": "error",
493
- "unicorn/no-new-array": "error",
494
- "unicorn/no-new-buffer": "error",
495
- "unicorn/no-useless-length-check": "error",
496
- "unicorn/no-useless-spread": "error",
497
- "unicorn/prefer-dom-node-text-content": "error",
498
- "unicorn/prefer-includes": "error",
499
- "unicorn/prefer-modern-dom-apis": "error",
500
- "unicorn/prefer-node-protocol": "error",
501
- "unicorn/prefer-number-properties": "error",
502
- "unicorn/prefer-query-selector": "error",
503
- "unicorn/prefer-string-raw": "error",
504
- "unicorn/prefer-string-starts-ends-with": "error",
505
- "unicorn/prefer-type-error": "error",
506
- "unicorn/throw-new-error": "error"
434
+ //#endregion
435
+ //#region src/oxlint/presets/unicorn.ts
436
+ const unicornRules = {
437
+ "unicorn/consistent-empty-array-spread": "error",
438
+ "unicorn/consistent-function-scoping": "error",
439
+ "unicorn/error-message": "error",
440
+ "unicorn/escape-case": "error",
441
+ "unicorn/explicit-length-check": ["error", { "non-zero": "not-equal" }],
442
+ "unicorn/explicit-timer-delay": "error",
443
+ "unicorn/new-for-builtins": "error",
444
+ "unicorn/no-anonymous-default-export": "error",
445
+ "unicorn/no-await-expression-member": "error",
446
+ "unicorn/no-await-in-promise-methods": "error",
447
+ "unicorn/no-confusing-array-with": "error",
448
+ "unicorn/no-instanceof-builtins": "error",
449
+ "unicorn/no-new-array": "error",
450
+ "unicorn/no-new-buffer": "error",
451
+ "unicorn/no-useless-length-check": "error",
452
+ "unicorn/no-useless-spread": "error",
453
+ "unicorn/prefer-dom-node-text-content": "error",
454
+ "unicorn/prefer-includes": "error",
455
+ "unicorn/prefer-modern-dom-apis": "error",
456
+ "unicorn/prefer-node-protocol": "error",
457
+ "unicorn/prefer-number-properties": "error",
458
+ "unicorn/prefer-query-selector": "error",
459
+ "unicorn/prefer-string-raw": "error",
460
+ "unicorn/prefer-type-error": "error",
461
+ "unicorn/throw-new-error": "error"
507
462
  };
508
-
509
- // src/shared/utils.ts
463
+ //#endregion
464
+ //#region src/shared/utils.ts
510
465
  function resolvePreset(preset, defaultEnabled) {
511
- if (typeof preset === "boolean" || preset == null) {
512
- return {
513
- enabled: preset ?? defaultEnabled,
514
- options: void 0
515
- };
516
- }
517
- return {
518
- enabled: preset.enabled ?? true,
519
- options: preset.options
520
- };
466
+ if (typeof preset === "boolean" || preset == null) return {
467
+ enabled: preset ?? defaultEnabled,
468
+ options: void 0
469
+ };
470
+ return {
471
+ enabled: preset.enabled ?? true,
472
+ options: preset.options
473
+ };
521
474
  }
522
475
  function dedupe(values) {
523
- return [...new Set(values)];
476
+ return [...new Set(values)];
524
477
  }
525
-
526
- // src/oxlint/shared.ts
527
- var scriptFiles = [
528
- "scripts/**/*.js",
529
- "scripts/**/*.mjs",
530
- "scripts/**/*.cjs",
531
- "scripts/**/*.jsx",
532
- "scripts/**/*.ts",
533
- "scripts/**/*.mts",
534
- "scripts/**/*.cts",
535
- "scripts/**/*.tsx",
536
- "cli.js",
537
- "cli.mjs",
538
- "cli.cjs",
539
- "cli.jsx",
540
- "cli.ts",
541
- "cli.mts",
542
- "cli.cts",
543
- "cli.tsx"
478
+ //#endregion
479
+ //#region src/oxlint/shared.ts
480
+ const scriptFiles = [
481
+ "scripts/**/*.js",
482
+ "scripts/**/*.mjs",
483
+ "scripts/**/*.cjs",
484
+ "scripts/**/*.jsx",
485
+ "scripts/**/*.ts",
486
+ "scripts/**/*.mts",
487
+ "scripts/**/*.cts",
488
+ "scripts/**/*.tsx",
489
+ "cli.js",
490
+ "cli.mjs",
491
+ "cli.cjs",
492
+ "cli.jsx",
493
+ "cli.ts",
494
+ "cli.mts",
495
+ "cli.cts",
496
+ "cli.tsx"
497
+ ];
498
+ const tsFiles = [
499
+ "**/*.ts",
500
+ "**/*.mts",
501
+ "**/*.cts",
502
+ "**/*.tsx",
503
+ "**/*.mtsx",
504
+ "**/*.ctsx"
505
+ ];
506
+ const sourceFiles = [
507
+ "**/*.js",
508
+ "**/*.mjs",
509
+ "**/*.cjs",
510
+ "**/*.jsx",
511
+ "**/*.ts",
512
+ "**/*.mts",
513
+ "**/*.cts",
514
+ "**/*.tsx",
515
+ "**/*.mtsx",
516
+ "**/*.ctsx"
544
517
  ];
545
- var tsFiles = [
546
- "**/*.ts",
547
- "**/*.mts",
548
- "**/*.cts",
549
- "**/*.tsx",
550
- "**/*.mtsx",
551
- "**/*.ctsx"
518
+ const componentFiles = [
519
+ "**/*.jsx",
520
+ "**/*.tsx",
521
+ "**/*.mtsx",
522
+ "**/*.ctsx"
552
523
  ];
553
- var sourceFiles = [
554
- "**/*.js",
555
- "**/*.mjs",
556
- "**/*.cjs",
557
- "**/*.jsx",
558
- "**/*.ts",
559
- "**/*.mts",
560
- "**/*.cts",
561
- "**/*.tsx",
562
- "**/*.mtsx",
563
- "**/*.ctsx"
524
+ const dtsFiles = [
525
+ "**/*.d.ts",
526
+ "**/*.d.mts",
527
+ "**/*.d.cts"
564
528
  ];
565
- var componentFiles = ["**/*.jsx", "**/*.tsx", "**/*.mtsx", "**/*.ctsx"];
566
- var dtsFiles = ["**/*.d.ts", "**/*.d.mts", "**/*.d.cts"];
567
- var jsRequireFiles = ["**/*.js", "**/*.cjs"];
568
- var testFiles = [
569
- "**/__tests__/**/*.js",
570
- "**/__tests__/**/*.mjs",
571
- "**/__tests__/**/*.cjs",
572
- "**/__tests__/**/*.jsx",
573
- "**/__tests__/**/*.ts",
574
- "**/__tests__/**/*.mts",
575
- "**/__tests__/**/*.cts",
576
- "**/__tests__/**/*.tsx",
577
- "**/__tests__/**/*.mtsx",
578
- "**/__tests__/**/*.ctsx",
579
- "**/*.spec.js",
580
- "**/*.spec.mjs",
581
- "**/*.spec.cjs",
582
- "**/*.spec.jsx",
583
- "**/*.spec.ts",
584
- "**/*.spec.mts",
585
- "**/*.spec.cts",
586
- "**/*.spec.tsx",
587
- "**/*.spec.mtsx",
588
- "**/*.spec.ctsx",
589
- "**/*.test.js",
590
- "**/*.test.mjs",
591
- "**/*.test.cjs",
592
- "**/*.test.jsx",
593
- "**/*.test.ts",
594
- "**/*.test.mts",
595
- "**/*.test.cts",
596
- "**/*.test.tsx",
597
- "**/*.test.mtsx",
598
- "**/*.test.ctsx",
599
- "**/*.bench.js",
600
- "**/*.bench.mjs",
601
- "**/*.bench.cjs",
602
- "**/*.bench.jsx",
603
- "**/*.bench.ts",
604
- "**/*.bench.mts",
605
- "**/*.bench.cts",
606
- "**/*.bench.tsx",
607
- "**/*.bench.mtsx",
608
- "**/*.bench.ctsx",
609
- "**/*.benchmark.js",
610
- "**/*.benchmark.mjs",
611
- "**/*.benchmark.cjs",
612
- "**/*.benchmark.jsx",
613
- "**/*.benchmark.ts",
614
- "**/*.benchmark.mts",
615
- "**/*.benchmark.cts",
616
- "**/*.benchmark.tsx",
617
- "**/*.benchmark.mtsx",
618
- "**/*.benchmark.ctsx"
529
+ const jsRequireFiles = ["**/*.js", "**/*.cjs"];
530
+ const testFiles = [
531
+ "**/__tests__/**/*.js",
532
+ "**/__tests__/**/*.mjs",
533
+ "**/__tests__/**/*.cjs",
534
+ "**/__tests__/**/*.jsx",
535
+ "**/__tests__/**/*.ts",
536
+ "**/__tests__/**/*.mts",
537
+ "**/__tests__/**/*.cts",
538
+ "**/__tests__/**/*.tsx",
539
+ "**/__tests__/**/*.mtsx",
540
+ "**/__tests__/**/*.ctsx",
541
+ "**/*.spec.js",
542
+ "**/*.spec.mjs",
543
+ "**/*.spec.cjs",
544
+ "**/*.spec.jsx",
545
+ "**/*.spec.ts",
546
+ "**/*.spec.mts",
547
+ "**/*.spec.cts",
548
+ "**/*.spec.tsx",
549
+ "**/*.spec.mtsx",
550
+ "**/*.spec.ctsx",
551
+ "**/*.test.js",
552
+ "**/*.test.mjs",
553
+ "**/*.test.cjs",
554
+ "**/*.test.jsx",
555
+ "**/*.test.ts",
556
+ "**/*.test.mts",
557
+ "**/*.test.cts",
558
+ "**/*.test.tsx",
559
+ "**/*.test.mtsx",
560
+ "**/*.test.ctsx",
561
+ "**/*.bench.js",
562
+ "**/*.bench.mjs",
563
+ "**/*.bench.cjs",
564
+ "**/*.bench.jsx",
565
+ "**/*.bench.ts",
566
+ "**/*.bench.mts",
567
+ "**/*.bench.cts",
568
+ "**/*.bench.tsx",
569
+ "**/*.bench.mtsx",
570
+ "**/*.bench.ctsx",
571
+ "**/*.benchmark.js",
572
+ "**/*.benchmark.mjs",
573
+ "**/*.benchmark.cjs",
574
+ "**/*.benchmark.jsx",
575
+ "**/*.benchmark.ts",
576
+ "**/*.benchmark.mts",
577
+ "**/*.benchmark.cts",
578
+ "**/*.benchmark.tsx",
579
+ "**/*.benchmark.mtsx",
580
+ "**/*.benchmark.ctsx"
619
581
  ];
620
582
  function resolveRulePreset(preset, defaultEnabled) {
621
- const resolved = resolvePreset(preset, defaultEnabled);
622
- return {
623
- ...resolved,
624
- rules: typeof preset === "boolean" || preset == null ? {} : preset.rules ?? {}
625
- };
583
+ return {
584
+ ...resolvePreset(preset, defaultEnabled),
585
+ rules: typeof preset === "boolean" || preset == null ? {} : preset.rules ?? {}
586
+ };
626
587
  }
627
588
  function resolveIgnorePreset(preset, defaultEnabled) {
628
- if (typeof preset === "boolean" || preset == null) {
629
- return {
630
- enabled: preset ?? defaultEnabled,
631
- patterns: []
632
- };
633
- }
634
- return {
635
- enabled: preset.enabled ?? defaultEnabled,
636
- patterns: preset.patterns ?? []
637
- };
589
+ if (typeof preset === "boolean" || preset == null) return {
590
+ enabled: preset ?? defaultEnabled,
591
+ patterns: []
592
+ };
593
+ return {
594
+ enabled: preset.enabled ?? defaultEnabled,
595
+ patterns: preset.patterns ?? []
596
+ };
638
597
  }
639
598
  function mergeRules(...entries) {
640
- return Object.assign({}, ...entries);
599
+ return Object.assign({}, ...entries);
641
600
  }
642
601
  function pickRules(rules, predicate) {
643
- if (!rules) {
644
- return {};
645
- }
646
- return Object.fromEntries(
647
- Object.entries(rules).filter(([rule]) => predicate(rule))
648
- );
602
+ if (!rules) return {};
603
+ return Object.fromEntries(Object.entries(rules).filter(([rule]) => predicate(rule)));
649
604
  }
650
605
  function appendPlugin(plugins, plugin) {
651
- if (!plugins.includes(plugin)) {
652
- plugins.push(plugin);
653
- }
606
+ if (!plugins.includes(plugin)) plugins.push(plugin);
654
607
  }
655
608
  function pruneOverride(override) {
656
- const result = {
657
- files: override.files
658
- };
659
- if (override.env && Object.keys(override.env).length !== 0) {
660
- result.env = override.env;
661
- }
662
- if (override.excludeFiles && override.excludeFiles.length !== 0) {
663
- result.excludeFiles = override.excludeFiles;
664
- }
665
- if (override.globals && Object.keys(override.globals).length !== 0) {
666
- result.globals = override.globals;
667
- }
668
- if (override.jsPlugins && override.jsPlugins.length !== 0) {
669
- result.jsPlugins = override.jsPlugins;
670
- }
671
- if (override.plugins && override.plugins.length !== 0) {
672
- result.plugins = override.plugins;
673
- }
674
- if (override.rules && Object.keys(override.rules).length !== 0) {
675
- result.rules = override.rules;
676
- }
677
- return result.rules || result.plugins || result.jsPlugins || result.env || result.globals ? result : null;
609
+ const result = { files: override.files };
610
+ if (override.env && Object.keys(override.env).length !== 0) result.env = override.env;
611
+ if (override.excludeFiles && override.excludeFiles.length !== 0) result.excludeFiles = override.excludeFiles;
612
+ if (override.globals && Object.keys(override.globals).length !== 0) result.globals = override.globals;
613
+ if (override.jsPlugins && override.jsPlugins.length !== 0) result.jsPlugins = override.jsPlugins;
614
+ if (override.plugins && override.plugins.length !== 0) result.plugins = override.plugins;
615
+ if (override.rules && Object.keys(override.rules).length !== 0) result.rules = override.rules;
616
+ return result.rules || result.plugins || result.jsPlugins || result.env || result.globals ? result : null;
678
617
  }
679
-
680
- // src/oxlint/index.ts
681
- var defaultOxlintPresets = {
682
- ignores: true,
683
- imports: true,
684
- javascript: true,
685
- next: isPackageExists2("next"),
686
- node: false,
687
- react: isPackageExists2("react"),
688
- reactAgentRules: isPackageExists2("react"),
689
- test: isPackageExists2("vitest"),
690
- typescript: isPackageExists2("typescript"),
691
- unicorn: true
618
+ //#endregion
619
+ //#region src/oxlint/index.ts
620
+ const defaultOxlintPresets = {
621
+ ignores: true,
622
+ imports: true,
623
+ javascript: true,
624
+ next: isPackageExists("next"),
625
+ node: false,
626
+ react: isPackageExists("react"),
627
+ reactAgentRules: isPackageExists("react"),
628
+ test: isPackageExists("vitest"),
629
+ typescript: isPackageExists("typescript"),
630
+ unicorn: true
692
631
  };
693
632
  function defineOxlintConfig(options = {}) {
694
- const presets = {
695
- ...defaultOxlintPresets,
696
- ...options.presets
697
- };
698
- const ignorePreset = resolveIgnorePreset(presets.ignores, true);
699
- const importPreset = resolveRulePreset(presets.imports, true);
700
- const javascriptPreset = resolveRulePreset(presets.javascript, true);
701
- const nextPreset = resolveRulePreset(presets.next, defaultOxlintPresets.next);
702
- const nodePreset = resolveRulePreset(presets.node, false);
703
- const reactPreset = resolveRulePreset(
704
- presets.react,
705
- defaultOxlintPresets.react
706
- );
707
- const reactAgentRulesPreset = resolveRulePreset(
708
- options.presets?.reactAgentRules,
709
- reactPreset.enabled
710
- );
711
- const testPreset = resolveRulePreset(presets.test, defaultOxlintPresets.test);
712
- const typeScriptPreset = resolveRulePreset(
713
- presets.typescript,
714
- defaultOxlintPresets.typescript
715
- );
716
- const unicornPreset = resolveRulePreset(presets.unicorn, true);
717
- const reactAgentRulesForSourceFiles = reactAgentRulesPreset.enabled ? mergeRules(
718
- reactAgentRules,
719
- reactAgentRulesPreset.rules,
720
- pickRules(
721
- options.rules,
722
- (rule) => rule.startsWith("react-agent-rules/")
723
- )
724
- ) : void 0;
725
- const plugins = [];
726
- const rules = mergeRules(
727
- {
728
- "max-lines": [
729
- "error",
730
- {
731
- max: 300,
732
- skipBlankLines: true,
733
- skipComments: true
734
- }
735
- ]
736
- },
737
- unicornPreset.enabled ? unicornRules : void 0,
738
- unicornPreset.rules,
739
- importPreset.enabled ? importRules : void 0,
740
- importPreset.rules,
741
- javascriptPreset.enabled ? javascriptRules : void 0,
742
- javascriptPreset.rules,
743
- nodePreset.enabled ? nodeRules : void 0,
744
- nodePreset.rules,
745
- reactAgentRulesPreset.enabled ? reactAgentRules : void 0,
746
- reactAgentRulesPreset.rules,
747
- options.rules
748
- );
749
- if (unicornPreset.enabled) {
750
- appendPlugin(plugins, "unicorn");
751
- }
752
- if (importPreset.enabled) {
753
- appendPlugin(plugins, "import");
754
- }
755
- if (typeScriptPreset.enabled) {
756
- appendPlugin(plugins, "typescript");
757
- }
758
- if (nodePreset.enabled) {
759
- appendPlugin(plugins, "node");
760
- }
761
- const overrides = [];
762
- if (reactAgentRulesPreset.enabled && reactAgentRulesForSourceFiles) {
763
- overrides.push({
764
- files: sourceFiles,
765
- jsPlugins: [reactAgentRulesPlugin],
766
- rules: reactAgentRulesForSourceFiles
767
- });
768
- }
769
- if (javascriptPreset.enabled) {
770
- overrides.push({
771
- files: scriptFiles,
772
- rules: {
773
- "no-console": "off"
774
- }
775
- });
776
- }
777
- if (typeScriptPreset.enabled) {
778
- overrides.push({
779
- files: tsFiles,
780
- rules: mergeRules(typeScriptRules, typeScriptPreset.rules)
781
- });
782
- overrides.push({
783
- files: dtsFiles,
784
- rules: {
785
- "import/no-duplicates": "off"
786
- }
787
- });
788
- overrides.push({
789
- files: jsRequireFiles,
790
- rules: {
791
- "typescript/no-require-imports": "off",
792
- "typescript/no-var-requires": "off"
793
- }
794
- });
795
- }
796
- overrides.push({
797
- files: componentFiles,
798
- rules: {
799
- "max-lines": [
800
- "error",
801
- {
802
- max: 200,
803
- skipBlankLines: true,
804
- skipComments: true
805
- }
806
- ]
807
- }
808
- });
809
- if (reactPreset.enabled || nextPreset.enabled) {
810
- const reactOptions = reactPreset.options ?? {};
811
- const a11y = reactOptions.a11y ?? true;
812
- const overridePlugins = [];
813
- const reactRules = reactPreset.enabled ? createReactRules(reactOptions, nextPreset.enabled) : {};
814
- const nextRules = nextPreset.enabled ? nextjsRules : {};
815
- const mergedRules = mergeRules(
816
- reactRules,
817
- a11y && reactPreset.enabled ? jsxA11yRules : void 0,
818
- nextRules,
819
- reactAgentRulesPreset.enabled ? {
820
- "react/exhaustive-deps": "off"
821
- } : void 0,
822
- reactPreset.rules,
823
- nextPreset.rules
824
- );
825
- if (reactPreset.enabled) {
826
- appendPlugin(overridePlugins, "react");
827
- }
828
- if (reactPreset.enabled && a11y) {
829
- appendPlugin(overridePlugins, "jsx-a11y");
830
- }
831
- if (nextPreset.enabled) {
832
- appendPlugin(overridePlugins, "nextjs");
833
- }
834
- const override = pruneOverride({
835
- files: sourceFiles,
836
- plugins: overridePlugins,
837
- rules: mergedRules
838
- });
839
- if (override) {
840
- overrides.push(override);
841
- }
842
- }
843
- overrides.push({
844
- files: testFiles,
845
- plugins: testPreset.enabled ? ["vitest"] : void 0,
846
- rules: mergeRules(
847
- {
848
- "max-lines": [
849
- "error",
850
- {
851
- max: 500,
852
- skipBlankLines: true,
853
- skipComments: true
854
- }
855
- ]
856
- },
857
- testPreset.enabled ? vitestRules : void 0,
858
- testPreset.rules
859
- )
860
- });
861
- const config = {
862
- $schema: "./node_modules/oxlint/configuration_schema.json",
863
- categories: {
864
- correctness: "off",
865
- ...options.categories ?? {}
866
- },
867
- env: {
868
- browser: true,
869
- builtin: true,
870
- es2024: true,
871
- node: true,
872
- ...options.env ?? {}
873
- },
874
- extends: options.extends,
875
- globals: options.globals,
876
- ignorePatterns: ignorePreset.enabled ? dedupe([
877
- ...defaultIgnorePatterns,
878
- ...ignorePreset.patterns,
879
- ...options.ignorePatterns ?? []
880
- ]) : options.ignorePatterns,
881
- jsPlugins: reactAgentRulesPreset.enabled ? [reactAgentRulesPlugin, ...options.jsPlugins ?? []] : options.jsPlugins,
882
- overrides: [...overrides, ...options.overrides ?? []].map(pruneOverride).filter((override) => override !== null),
883
- plugins,
884
- rules,
885
- settings: options.settings
886
- };
887
- if (typeScriptPreset.enabled) {
888
- config.options = {
889
- typeAware: typeScriptPreset.options?.typeAware ?? true
890
- };
891
- }
892
- if (!config.ignorePatterns || config.ignorePatterns.length === 0) {
893
- delete config.ignorePatterns;
894
- }
895
- if (!config.extends || config.extends.length === 0) {
896
- delete config.extends;
897
- }
898
- if (!config.globals || Object.keys(config.globals).length === 0) {
899
- delete config.globals;
900
- }
901
- if (!config.overrides || config.overrides.length === 0) {
902
- delete config.overrides;
903
- }
904
- if (!config.jsPlugins || config.jsPlugins.length === 0) {
905
- delete config.jsPlugins;
906
- }
907
- if (!config.plugins || config.plugins.length === 0) {
908
- delete config.plugins;
909
- }
910
- if (!config.rules || Object.keys(config.rules).length === 0) {
911
- delete config.rules;
912
- }
913
- if (!config.settings || Object.keys(config.settings).length === 0) {
914
- delete config.settings;
915
- }
916
- return config;
633
+ const presets = {
634
+ ...defaultOxlintPresets,
635
+ ...options.presets
636
+ };
637
+ const ignorePreset = resolveIgnorePreset(presets.ignores, true);
638
+ const importPreset = resolveRulePreset(presets.imports, true);
639
+ const javascriptPreset = resolveRulePreset(presets.javascript, true);
640
+ const nextPreset = resolveRulePreset(presets.next, defaultOxlintPresets.next);
641
+ const nodePreset = resolveRulePreset(presets.node, false);
642
+ const reactPreset = resolveRulePreset(presets.react, defaultOxlintPresets.react);
643
+ const reactAgentRulesPreset = resolveRulePreset(options.presets?.reactAgentRules, reactPreset.enabled);
644
+ const testPreset = resolveRulePreset(presets.test, defaultOxlintPresets.test);
645
+ const typeScriptPreset = resolveRulePreset(presets.typescript, defaultOxlintPresets.typescript);
646
+ const unicornPreset = resolveRulePreset(presets.unicorn, true);
647
+ const reactAgentRulesForSourceFiles = reactAgentRulesPreset.enabled ? mergeRules(reactAgentRules, reactAgentRulesPreset.rules, pickRules(options.rules, (rule) => rule.startsWith("react-agent-rules/"))) : void 0;
648
+ const plugins = [];
649
+ const rules = mergeRules({ "max-lines": ["error", {
650
+ max: 300,
651
+ skipBlankLines: true,
652
+ skipComments: true
653
+ }] }, unicornPreset.enabled ? unicornRules : void 0, unicornPreset.rules, importPreset.enabled ? importRules : void 0, importPreset.rules, javascriptPreset.enabled ? javascriptRules : void 0, javascriptPreset.rules, nodePreset.enabled ? nodeRules : void 0, nodePreset.rules, reactAgentRulesPreset.enabled ? reactAgentRules : void 0, reactAgentRulesPreset.rules, options.rules);
654
+ if (unicornPreset.enabled) appendPlugin(plugins, "unicorn");
655
+ if (importPreset.enabled) appendPlugin(plugins, "import");
656
+ if (typeScriptPreset.enabled) appendPlugin(plugins, "typescript");
657
+ if (nodePreset.enabled) appendPlugin(plugins, "node");
658
+ const overrides = [];
659
+ if (reactAgentRulesPreset.enabled && reactAgentRulesForSourceFiles) overrides.push({
660
+ files: sourceFiles,
661
+ jsPlugins: [reactAgentRulesPlugin],
662
+ rules: reactAgentRulesForSourceFiles
663
+ });
664
+ if (javascriptPreset.enabled) overrides.push({
665
+ files: scriptFiles,
666
+ rules: { "no-console": "off" }
667
+ });
668
+ if (typeScriptPreset.enabled) {
669
+ overrides.push({
670
+ files: tsFiles,
671
+ rules: mergeRules(typeScriptRules, typeScriptPreset.rules)
672
+ });
673
+ overrides.push({
674
+ files: dtsFiles,
675
+ rules: { "import/no-duplicates": "off" }
676
+ });
677
+ overrides.push({
678
+ files: jsRequireFiles,
679
+ rules: {
680
+ "typescript/no-require-imports": "off",
681
+ "typescript/no-var-requires": "off"
682
+ }
683
+ });
684
+ }
685
+ overrides.push({
686
+ files: componentFiles,
687
+ rules: { "max-lines": ["error", {
688
+ max: 200,
689
+ skipBlankLines: true,
690
+ skipComments: true
691
+ }] }
692
+ });
693
+ if (reactPreset.enabled || nextPreset.enabled) {
694
+ const reactOptions = reactPreset.options ?? {};
695
+ const a11y = reactOptions.a11y ?? true;
696
+ const overridePlugins = [];
697
+ const reactRules = reactPreset.enabled ? createReactRules(reactOptions, nextPreset.enabled) : {};
698
+ const nextRules = nextPreset.enabled ? nextjsRules : {};
699
+ const mergedRules = mergeRules(reactRules, a11y && reactPreset.enabled ? jsxA11yRules : void 0, nextRules, reactAgentRulesPreset.enabled ? { "react/exhaustive-deps": "off" } : void 0, reactPreset.rules, nextPreset.rules);
700
+ if (reactPreset.enabled) appendPlugin(overridePlugins, "react");
701
+ if (reactPreset.enabled && a11y) appendPlugin(overridePlugins, "jsx-a11y");
702
+ if (nextPreset.enabled) appendPlugin(overridePlugins, "nextjs");
703
+ const override = pruneOverride({
704
+ files: sourceFiles,
705
+ plugins: overridePlugins,
706
+ rules: mergedRules
707
+ });
708
+ if (override) overrides.push(override);
709
+ }
710
+ overrides.push({
711
+ files: testFiles,
712
+ plugins: testPreset.enabled ? ["vitest"] : void 0,
713
+ rules: mergeRules({ "max-lines": ["error", {
714
+ max: 500,
715
+ skipBlankLines: true,
716
+ skipComments: true
717
+ }] }, testPreset.enabled ? vitestRules : void 0, testPreset.rules)
718
+ });
719
+ const config = {
720
+ $schema: "./node_modules/oxlint/configuration_schema.json",
721
+ categories: {
722
+ correctness: "off",
723
+ ...options.categories ?? {}
724
+ },
725
+ env: {
726
+ browser: true,
727
+ builtin: true,
728
+ es2024: true,
729
+ node: true,
730
+ ...options.env ?? {}
731
+ },
732
+ extends: options.extends,
733
+ globals: options.globals,
734
+ ignorePatterns: ignorePreset.enabled ? dedupe([
735
+ ...defaultIgnorePatterns,
736
+ ...ignorePreset.patterns,
737
+ ...options.ignorePatterns ?? []
738
+ ]) : options.ignorePatterns,
739
+ jsPlugins: reactAgentRulesPreset.enabled ? [reactAgentRulesPlugin, ...options.jsPlugins ?? []] : options.jsPlugins,
740
+ overrides: [...overrides, ...options.overrides ?? []].map(pruneOverride).filter((override) => override !== null),
741
+ plugins,
742
+ rules,
743
+ settings: options.settings
744
+ };
745
+ if (typeScriptPreset.enabled) config.options = { typeAware: typeScriptPreset.options?.typeAware ?? true };
746
+ if (!config.ignorePatterns || config.ignorePatterns.length === 0) delete config.ignorePatterns;
747
+ if (!config.extends || config.extends.length === 0) delete config.extends;
748
+ if (!config.globals || Object.keys(config.globals).length === 0) delete config.globals;
749
+ if (!config.overrides || config.overrides.length === 0) delete config.overrides;
750
+ if (!config.jsPlugins || config.jsPlugins.length === 0) delete config.jsPlugins;
751
+ if (!config.plugins || config.plugins.length === 0) delete config.plugins;
752
+ if (!config.rules || Object.keys(config.rules).length === 0) delete config.rules;
753
+ if (!config.settings || Object.keys(config.settings).length === 0) delete config.settings;
754
+ return config;
917
755
  }
918
- var defineConfig = defineOxlintConfig;
919
-
920
- // src/oxfmt/presets/imports.ts
921
- var defaultSortImports = {
922
- customGroups: [
923
- {
924
- elementNamePattern: ["next", "next/**"],
925
- groupName: "next"
926
- },
927
- {
928
- elementNamePattern: ["react", "react-dom", "react-dom/**"],
929
- groupName: "react"
930
- },
931
- {
932
- elementNamePattern: ["three", "three/**"],
933
- groupName: "three"
934
- },
935
- {
936
- elementNamePattern: ["@react-three/**"],
937
- groupName: "reactThree"
938
- }
939
- ],
940
- groups: [
941
- "value-builtin",
942
- "next",
943
- "react",
944
- "three",
945
- "reactThree",
946
- "value-external",
947
- "value-internal",
948
- ["value-index", "value-sibling", "value-parent"],
949
- "type-builtin",
950
- "type-external",
951
- "type-internal",
952
- ["type-index", "type-sibling", "type-parent"],
953
- "style",
954
- "side_effect",
955
- "side_effect_style",
956
- "unknown"
957
- ],
958
- ignoreCase: false,
959
- internalPattern: ["^@/.*", "^~/.*"],
960
- newlinesBetween: true,
961
- order: "asc",
962
- partitionByComment: false,
963
- partitionByNewline: false,
964
- sortSideEffects: true
756
+ const defineConfig = defineOxlintConfig;
757
+ //#endregion
758
+ //#region src/oxfmt/presets/imports.ts
759
+ const defaultSortImports = {
760
+ customGroups: [
761
+ {
762
+ elementNamePattern: ["next", "next/**"],
763
+ groupName: "next"
764
+ },
765
+ {
766
+ elementNamePattern: [
767
+ "react",
768
+ "react-dom",
769
+ "react-dom/**"
770
+ ],
771
+ groupName: "react"
772
+ },
773
+ {
774
+ elementNamePattern: ["three", "three/**"],
775
+ groupName: "three"
776
+ },
777
+ {
778
+ elementNamePattern: ["@react-three/**"],
779
+ groupName: "reactThree"
780
+ }
781
+ ],
782
+ groups: [
783
+ "value-builtin",
784
+ "next",
785
+ "react",
786
+ "three",
787
+ "reactThree",
788
+ "value-external",
789
+ "value-internal",
790
+ [
791
+ "value-index",
792
+ "value-sibling",
793
+ "value-parent"
794
+ ],
795
+ "type-builtin",
796
+ "type-external",
797
+ "type-internal",
798
+ [
799
+ "type-index",
800
+ "type-sibling",
801
+ "type-parent"
802
+ ],
803
+ "style",
804
+ "side_effect",
805
+ "side_effect_style",
806
+ "unknown"
807
+ ],
808
+ ignoreCase: false,
809
+ internalPattern: ["^@/.*", "^~/.*"],
810
+ newlinesBetween: true,
811
+ order: "asc",
812
+ partitionByComment: false,
813
+ partitionByNewline: false,
814
+ sortSideEffects: true
965
815
  };
966
-
967
- // src/oxfmt/presets/package-json.ts
968
- var defaultSortPackageJson = {
969
- sortScripts: false
970
- };
971
-
972
- // src/oxfmt/presets/tailwindcss.ts
973
- var defaultTailwindSort = {
974
- functions: ["clsx", "cn", "cva", "tw"]
975
- };
976
-
977
- // src/oxfmt/index.ts
978
- var defaultOxfmtPresets = {
979
- imports: true,
980
- packageJson: true,
981
- tailwindcss: false
816
+ //#endregion
817
+ //#region src/oxfmt/presets/package-json.ts
818
+ const defaultSortPackageJson = { sortScripts: false };
819
+ //#endregion
820
+ //#region src/oxfmt/presets/tailwindcss.ts
821
+ const defaultTailwindSort = { functions: [
822
+ "clsx",
823
+ "cn",
824
+ "cva",
825
+ "tw"
826
+ ] };
827
+ //#endregion
828
+ //#region src/oxfmt/index.ts
829
+ const defaultOxfmtPresets = {
830
+ imports: true,
831
+ packageJson: true,
832
+ tailwindcss: false
982
833
  };
983
834
  function defineOxfmtConfig(options = {}) {
984
- const presets = {
985
- ...defaultOxfmtPresets,
986
- ...options.presets
987
- };
988
- const importsPreset = resolvePreset(presets.imports, true);
989
- const packageJsonPreset = resolvePreset(presets.packageJson, true);
990
- const tailwindPreset = resolvePreset(presets.tailwindcss, false);
991
- const sortImports = importsPreset.enabled ? {
992
- ...defaultSortImports,
993
- ...importsPreset.options
994
- } : false;
995
- const sortPackageJson = packageJsonPreset.enabled ? {
996
- ...defaultSortPackageJson,
997
- ...packageJsonPreset.options
998
- } : false;
999
- const sortTailwindcss = tailwindPreset.enabled ? {
1000
- ...defaultTailwindSort,
1001
- ...tailwindPreset.options
1002
- } : false;
1003
- return {
1004
- $schema: "./node_modules/oxfmt/configuration_schema.json",
1005
- endOfLine: options.endOfLine ?? "lf",
1006
- ignorePatterns: dedupe([
1007
- ...defaultIgnorePatterns,
1008
- ...options.ignorePatterns ?? []
1009
- ]),
1010
- overrides: options.overrides,
1011
- printWidth: options.printWidth ?? 80,
1012
- semi: options.semi ?? false,
1013
- singleQuote: options.singleQuote ?? true,
1014
- sortImports,
1015
- sortPackageJson,
1016
- sortTailwindcss,
1017
- tabWidth: options.tabWidth ?? 2,
1018
- trailingComma: options.trailingComma ?? "all",
1019
- useTabs: options.useTabs ?? false
1020
- };
835
+ const presets = {
836
+ ...defaultOxfmtPresets,
837
+ ...options.presets
838
+ };
839
+ const importsPreset = resolvePreset(presets.imports, true);
840
+ const packageJsonPreset = resolvePreset(presets.packageJson, true);
841
+ const tailwindPreset = resolvePreset(presets.tailwindcss, false);
842
+ const sortImports = importsPreset.enabled ? {
843
+ ...defaultSortImports,
844
+ ...importsPreset.options
845
+ } : false;
846
+ const sortPackageJson = packageJsonPreset.enabled ? {
847
+ ...defaultSortPackageJson,
848
+ ...packageJsonPreset.options
849
+ } : false;
850
+ const sortTailwindcss = tailwindPreset.enabled ? {
851
+ ...defaultTailwindSort,
852
+ ...tailwindPreset.options
853
+ } : false;
854
+ return {
855
+ $schema: "./node_modules/oxfmt/configuration_schema.json",
856
+ endOfLine: options.endOfLine ?? "lf",
857
+ ignorePatterns: dedupe([...defaultIgnorePatterns, ...options.ignorePatterns ?? []]),
858
+ overrides: options.overrides,
859
+ printWidth: options.printWidth ?? 80,
860
+ semi: options.semi ?? false,
861
+ singleQuote: options.singleQuote ?? true,
862
+ sortImports,
863
+ sortPackageJson,
864
+ sortTailwindcss,
865
+ tabWidth: options.tabWidth ?? 2,
866
+ trailingComma: options.trailingComma ?? "all",
867
+ useTabs: options.useTabs ?? false
868
+ };
1021
869
  }
1022
- export {
1023
- defaultIgnorePatterns,
1024
- defaultOxfmtPresets,
1025
- defaultOxlintPresets,
1026
- defaultSortImports,
1027
- defineConfig,
1028
- defineOxfmtConfig,
1029
- defineOxlintConfig
1030
- };
870
+ //#endregion
871
+ export { defaultIgnorePatterns, defaultOxfmtPresets, defaultOxlintPresets, defaultSortImports, defineConfig, defineOxfmtConfig, defineOxlintConfig };