@zhangyu1818/oxlint-config 2.9.0 → 2.11.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.d.ts +0 -10
- package/dist/index.js +17 -34
- package/dist/react-agent-rules.d.ts +0 -2
- package/dist/react-agent-rules.js +1 -2
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
//#region src/shared/ignore-patterns.d.ts
|
|
2
1
|
export declare const defaultIgnorePatterns: string[];
|
|
3
|
-
//#endregion
|
|
4
|
-
//#region src/types.d.ts
|
|
5
2
|
type Severity = 'off' | 'warn' | 'error';
|
|
6
3
|
type JsonPrimitive = boolean | null | number | string;
|
|
7
4
|
type JsonValue = JsonObject | JsonPrimitive | JsonValue[];
|
|
@@ -155,8 +152,6 @@ interface DefineOxfmtConfigOptions extends OxfmtOverrideOptions {
|
|
|
155
152
|
overrides?: OxfmtOverride[];
|
|
156
153
|
presets?: OxfmtPresets;
|
|
157
154
|
}
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/oxlint/index.d.ts
|
|
160
155
|
export declare const defaultOxlintPresets: {
|
|
161
156
|
ignores: true;
|
|
162
157
|
imports: true;
|
|
@@ -171,12 +166,7 @@ export declare const defaultOxlintPresets: {
|
|
|
171
166
|
};
|
|
172
167
|
export declare function defineOxlintConfig(options?: DefineOxlintConfigOptions): OxlintConfig;
|
|
173
168
|
export declare const defineConfig: typeof defineOxlintConfig;
|
|
174
|
-
//#endregion
|
|
175
|
-
//#region src/oxfmt/presets/imports.d.ts
|
|
176
169
|
export declare const defaultSortImports: SortImportsOptions;
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/oxfmt/index.d.ts
|
|
179
170
|
export declare const defaultOxfmtPresets: Required<OxfmtPresets>;
|
|
180
171
|
export declare function defineOxfmtConfig(options?: DefineOxfmtConfigOptions): OxfmtConfig;
|
|
181
|
-
//#endregion
|
|
182
172
|
export type { DefineOxfmtConfigOptions, DefineOxlintConfigOptions, OxfmtConfig, OxfmtOverride, OxfmtPresetConfig, OxfmtPresets, OxlintConfig, OxlintGlobalValue, OxlintGlobals, OxlintJsPlugin, OxlintJsPluginAlias, OxlintOverride, OxlintPlugin, OxlintPresetConfig, OxlintPresets, ReactOptions, ReactPresetOptions, RuleConfig, Rules, Severity, SortImportsOptions, SortPackageJsonOptions, TailwindSortOptions, TypeScriptOptions };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isPackageExists } from "local-pkg";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
4
|
+
// src/shared/ignore-patterns.ts
|
|
5
5
|
const defaultIgnorePatterns = [
|
|
6
6
|
"**/node_modules",
|
|
7
7
|
"**/dist",
|
|
@@ -36,8 +36,7 @@ const defaultIgnorePatterns = [
|
|
|
36
36
|
"**/components.d.ts",
|
|
37
37
|
"tests/fixtures/**"
|
|
38
38
|
];
|
|
39
|
-
|
|
40
|
-
//#region src/oxlint/presets/imports.ts
|
|
39
|
+
// src/oxlint/presets/imports.ts
|
|
41
40
|
const importRules = {
|
|
42
41
|
"import/first": "error",
|
|
43
42
|
"import/newline-after-import": "error",
|
|
@@ -47,8 +46,7 @@ const importRules = {
|
|
|
47
46
|
"import/no-self-import": "error",
|
|
48
47
|
"import/no-webpack-loader-syntax": "error"
|
|
49
48
|
};
|
|
50
|
-
|
|
51
|
-
//#region src/oxlint/presets/javascript.ts
|
|
49
|
+
// src/oxlint/presets/javascript.ts
|
|
52
50
|
const javascriptRules = {
|
|
53
51
|
"accessor-pairs": ["error", {
|
|
54
52
|
enforceForClassMembers: true,
|
|
@@ -185,8 +183,7 @@ const javascriptRules = {
|
|
|
185
183
|
"vars-on-top": "error",
|
|
186
184
|
yoda: ["error", "never"]
|
|
187
185
|
};
|
|
188
|
-
|
|
189
|
-
//#region src/oxlint/presets/next.ts
|
|
186
|
+
// src/oxlint/presets/next.ts
|
|
190
187
|
const nextjsRules = {
|
|
191
188
|
"nextjs/google-font-display": "warn",
|
|
192
189
|
"nextjs/google-font-preconnect": "warn",
|
|
@@ -210,16 +207,14 @@ const nextjsRules = {
|
|
|
210
207
|
"nextjs/no-typos": "warn",
|
|
211
208
|
"nextjs/no-unwanted-polyfillio": "warn"
|
|
212
209
|
};
|
|
213
|
-
|
|
214
|
-
//#region src/oxlint/presets/node.ts
|
|
210
|
+
// src/oxlint/presets/node.ts
|
|
215
211
|
const nodeRules = {
|
|
216
212
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
217
213
|
"node/no-exports-assign": "error",
|
|
218
214
|
"node/no-new-require": "error",
|
|
219
215
|
"node/no-path-concat": "error"
|
|
220
216
|
};
|
|
221
|
-
|
|
222
|
-
//#region src/oxlint/presets/react-agent-rules.ts
|
|
217
|
+
// src/oxlint/presets/react-agent-rules.ts
|
|
223
218
|
function resolveReactAgentRulesPluginPath() {
|
|
224
219
|
const sourcePluginPath = fileURLToPath(new URL("../../react-agent-rules.ts", import.meta.url));
|
|
225
220
|
if (existsSync(sourcePluginPath)) return sourcePluginPath;
|
|
@@ -232,8 +227,7 @@ const reactAgentRules = {
|
|
|
232
227
|
"react-agent-rules/no-manual-memoization": "error",
|
|
233
228
|
"react-agent-rules/no-use-context": "error"
|
|
234
229
|
};
|
|
235
|
-
|
|
236
|
-
//#region src/oxlint/presets/react.ts
|
|
230
|
+
// src/oxlint/presets/react.ts
|
|
237
231
|
const jsxA11yRules = {
|
|
238
232
|
"jsx-a11y/alt-text": "error",
|
|
239
233
|
"jsx-a11y/anchor-ambiguous-text": "off",
|
|
@@ -358,8 +352,7 @@ function createReactRules(options, nextEnabled) {
|
|
|
358
352
|
}]
|
|
359
353
|
};
|
|
360
354
|
}
|
|
361
|
-
|
|
362
|
-
//#region src/oxlint/presets/test.ts
|
|
355
|
+
// src/oxlint/presets/test.ts
|
|
363
356
|
const vitestRules = {
|
|
364
357
|
"no-unused-expressions": "off",
|
|
365
358
|
"vitest/expect-expect": "error",
|
|
@@ -380,8 +373,7 @@ const vitestRules = {
|
|
|
380
373
|
"vitest/valid-expect-in-promise": "error",
|
|
381
374
|
"vitest/valid-title": "error"
|
|
382
375
|
};
|
|
383
|
-
|
|
384
|
-
//#region src/oxlint/presets/typescript.ts
|
|
376
|
+
// src/oxlint/presets/typescript.ts
|
|
385
377
|
const typeScriptRules = {
|
|
386
378
|
"no-throw-literal": "off",
|
|
387
379
|
"no-undef": "off",
|
|
@@ -449,8 +441,7 @@ const typeScriptRules = {
|
|
|
449
441
|
"typescript/triple-slash-reference": "warn",
|
|
450
442
|
"typescript/unified-signatures": "error"
|
|
451
443
|
};
|
|
452
|
-
|
|
453
|
-
//#region src/oxlint/presets/unicorn.ts
|
|
444
|
+
// src/oxlint/presets/unicorn.ts
|
|
454
445
|
const unicornRules = {
|
|
455
446
|
"unicorn/consistent-empty-array-spread": "error",
|
|
456
447
|
"unicorn/consistent-function-scoping": "error",
|
|
@@ -478,8 +469,7 @@ const unicornRules = {
|
|
|
478
469
|
"unicorn/prefer-type-error": "error",
|
|
479
470
|
"unicorn/throw-new-error": "error"
|
|
480
471
|
};
|
|
481
|
-
|
|
482
|
-
//#region src/shared/utils.ts
|
|
472
|
+
// src/shared/utils.ts
|
|
483
473
|
function resolvePreset(preset, defaultEnabled) {
|
|
484
474
|
if (typeof preset === "boolean" || preset == null) return {
|
|
485
475
|
enabled: preset ?? defaultEnabled,
|
|
@@ -493,8 +483,7 @@ function resolvePreset(preset, defaultEnabled) {
|
|
|
493
483
|
function dedupe(values) {
|
|
494
484
|
return [...new Set(values)];
|
|
495
485
|
}
|
|
496
|
-
|
|
497
|
-
//#region src/oxlint/shared.ts
|
|
486
|
+
// src/oxlint/shared.ts
|
|
498
487
|
const scriptFiles = [
|
|
499
488
|
"scripts/**/*.js",
|
|
500
489
|
"scripts/**/*.mjs",
|
|
@@ -633,8 +622,7 @@ function pruneOverride(override) {
|
|
|
633
622
|
if (override.rules && Object.keys(override.rules).length !== 0) result.rules = override.rules;
|
|
634
623
|
return result.rules || result.plugins || result.jsPlugins || result.env || result.globals ? result : null;
|
|
635
624
|
}
|
|
636
|
-
|
|
637
|
-
//#region src/oxlint/index.ts
|
|
625
|
+
// src/oxlint/index.ts
|
|
638
626
|
const defaultOxlintPresets = {
|
|
639
627
|
ignores: true,
|
|
640
628
|
imports: true,
|
|
@@ -772,8 +760,7 @@ function defineOxlintConfig(options = {}) {
|
|
|
772
760
|
return config;
|
|
773
761
|
}
|
|
774
762
|
const defineConfig = defineOxlintConfig;
|
|
775
|
-
|
|
776
|
-
//#region src/oxfmt/presets/imports.ts
|
|
763
|
+
// src/oxfmt/presets/imports.ts
|
|
777
764
|
const defaultSortImports = {
|
|
778
765
|
customGroups: [
|
|
779
766
|
{
|
|
@@ -831,19 +818,16 @@ const defaultSortImports = {
|
|
|
831
818
|
partitionByNewline: false,
|
|
832
819
|
sortSideEffects: true
|
|
833
820
|
};
|
|
834
|
-
|
|
835
|
-
//#region src/oxfmt/presets/package-json.ts
|
|
821
|
+
// src/oxfmt/presets/package-json.ts
|
|
836
822
|
const defaultSortPackageJson = { sortScripts: false };
|
|
837
|
-
|
|
838
|
-
//#region src/oxfmt/presets/tailwindcss.ts
|
|
823
|
+
// src/oxfmt/presets/tailwindcss.ts
|
|
839
824
|
const defaultTailwindSort = { functions: [
|
|
840
825
|
"clsx",
|
|
841
826
|
"cn",
|
|
842
827
|
"cva",
|
|
843
828
|
"tw"
|
|
844
829
|
] };
|
|
845
|
-
|
|
846
|
-
//#region src/oxfmt/index.ts
|
|
830
|
+
// src/oxfmt/index.ts
|
|
847
831
|
const defaultOxfmtPresets = {
|
|
848
832
|
imports: true,
|
|
849
833
|
packageJson: true,
|
|
@@ -885,5 +869,4 @@ function defineOxfmtConfig(options = {}) {
|
|
|
885
869
|
useTabs: options.useTabs ?? false
|
|
886
870
|
};
|
|
887
871
|
}
|
|
888
|
-
//#endregion
|
|
889
872
|
export { defaultIgnorePatterns, defaultOxfmtPresets, defaultOxlintPresets, defaultSortImports, defineConfig, defineOxfmtConfig, defineOxlintConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/react-agent-rules.ts
|
|
2
2
|
const NO_MANUAL_MEMOIZATION_MESSAGE = "React Compiler automatically optimizes components and values, so manual memoization is not needed.";
|
|
3
3
|
const NO_FORWARD_REF_MESSAGE = "Starting in React 19, ref is a prop, so forwardRef is no longer needed.";
|
|
4
4
|
const NO_USE_CONTEXT_MESSAGE = "In React 19, use is preferred over useContext for reading context because it is more flexible.";
|
|
@@ -80,5 +80,4 @@ const plugin = {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
//#endregion
|
|
84
83
|
export { plugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhangyu1818/oxlint-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Native Oxlint and Oxfmt config preset package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oxc",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^26.6.5",
|
|
44
|
-
"oxfmt": "^0.
|
|
45
|
-
"oxlint": "^1.
|
|
46
|
-
"oxlint-tsgolint": "^7.0.
|
|
47
|
-
"tsdown": "
|
|
44
|
+
"oxfmt": "^0.74.0",
|
|
45
|
+
"oxlint": "^1.89.0",
|
|
46
|
+
"oxlint-tsgolint": "^7.0.2005",
|
|
47
|
+
"tsdown": "0.23.1",
|
|
48
48
|
"typescript": "^7.0.2",
|
|
49
|
-
"vitest": "^5.0.
|
|
49
|
+
"vitest": "^5.0.5"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"oxfmt": "^0.
|
|
52
|
+
"oxfmt": "^0.74.0",
|
|
53
53
|
"oxlint": "^1.79.0",
|
|
54
54
|
"oxlint-tsgolint": "^7.0.2001"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=24"
|
|
58
58
|
},
|
|
59
|
-
"packageManager": "pnpm@12.
|
|
59
|
+
"packageManager": "pnpm@12.15.0"
|
|
60
60
|
}
|