@tb-dev/eslint-config 9.1.4 → 10.0.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Andrew Ferreira <andrew.shien2@gmail.com>
3
+ Copyright (c) 2026 Andrew Ferreira <andrew.shien2@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,4 @@
1
+ //#region node_modules/.pnpm/@unocss+eslint-config@66.6.7_eslint@10.2.0_jiti@2.6.1__typescript@6.0.2/node_modules/@unocss/eslint-config/dist/index.mjs
2
+ var src_default = { extends: ["plugin:@unocss/recommended"] };
3
+ //#endregion
4
+ export { src_default as default };
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ function isEnabled(config, feature) {
37
37
  switch (feature) {
38
38
  case "perfectionist": return config?.perfectionist ?? true;
39
39
  case "unicorn": return config?.unicorn ?? true;
40
+ case "unocss": return config?.unocss ?? false;
40
41
  case "vue": return config?.vue ?? false;
41
42
  default: return false;
42
43
  }
@@ -44,6 +45,9 @@ function isEnabled(config, feature) {
44
45
  function getIgnores() {
45
46
  return Object.values(GlobIgnore);
46
47
  }
48
+ function mapRules(rules, fn) {
49
+ return Object.fromEntries(Object.entries(rules).map(([rule, value]) => fn(rule, value)));
50
+ }
47
51
  //#endregion
48
52
  //#region src/lib/vue.ts
49
53
  /**
@@ -56,6 +60,10 @@ async function vue(options) {
56
60
  interopDefault(import("vue-eslint-parser")),
57
61
  interopDefault(import("@typescript-eslint/parser"))
58
62
  ]);
63
+ const overrides = mapRules(options.overrides?.vue ?? {}, (rule, value) => {
64
+ if (rule.startsWith("vue/")) return [rule, value];
65
+ else return [`vue/${rule}`, value];
66
+ });
59
67
  const rules = {
60
68
  ...vuePlugin.configs.base.rules,
61
69
  "vue/attribute-hyphenation": ["error", "always"],
@@ -230,7 +238,7 @@ async function vue(options) {
230
238
  "vue/valid-v-show": "error",
231
239
  "vue/valid-v-slot": "error",
232
240
  "vue/valid-v-text": "error",
233
- ...options.overrides?.vue
241
+ ...overrides
234
242
  };
235
243
  return [
236
244
  { plugins: { vue: vuePlugin } },
@@ -255,14 +263,36 @@ async function vue(options) {
255
263
  ];
256
264
  }
257
265
  //#endregion
266
+ //#region src/lib/unocss.ts
267
+ async function unocss(options) {
268
+ if (!isEnabled(options.features, "unocss")) return {};
269
+ const plugin = await interopDefault(import("./dist-Dg02z52k.js"));
270
+ const overrides = mapRules(options.overrides?.unocss ?? {}, (rule, value) => {
271
+ if (rule.startsWith("@unocss/")) return [rule, value];
272
+ else return [`@unocss/${rule}`, value];
273
+ });
274
+ return {
275
+ plugins: { "@unocss": plugin },
276
+ rules: {
277
+ "@unocss/order": "error",
278
+ ...overrides
279
+ }
280
+ };
281
+ }
282
+ //#endregion
258
283
  //#region src/lib/unicorn.ts
259
284
  /**
260
285
  * @see https://github.com/sindresorhus/eslint-plugin-unicorn#rules
261
286
  */
262
287
  async function unicorn(options) {
263
288
  if (!isEnabled(options.features, "unicorn")) return {};
289
+ const plugin = await interopDefault(import("eslint-plugin-unicorn"));
290
+ const overrides = mapRules(options.overrides?.unicorn ?? {}, (rule, value) => {
291
+ if (rule.startsWith("unicorn/")) return [rule, value];
292
+ else return [`unicorn/${rule}`, value];
293
+ });
264
294
  return {
265
- plugins: { unicorn: await interopDefault(import("eslint-plugin-unicorn")) },
295
+ plugins: { unicorn: plugin },
266
296
  rules: {
267
297
  "unicorn/catch-error-name": ["error", { name: "err" }],
268
298
  "unicorn/consistent-date-clone": "error",
@@ -317,7 +347,7 @@ async function unicorn(options) {
317
347
  "unicorn/prefer-structured-clone": "error",
318
348
  "unicorn/prefer-type-error": "error",
319
349
  "unicorn/relative-url-style": ["error", "never"],
320
- ...options.overrides?.unicorn
350
+ ...overrides
321
351
  }
322
352
  };
323
353
  }
@@ -503,6 +533,10 @@ async function typescript(options) {
503
533
  if (isEnabled(options.features, "vue")) files.push(Glob.Vue);
504
534
  const extraFileExtensions = [];
505
535
  if (isEnabled(options.features, "vue")) extraFileExtensions.push(".vue");
536
+ const overrides = mapRules(options.overrides?.typescript ?? {}, (rule, value) => {
537
+ if (rule.startsWith("@typescript-eslint/")) return [rule, value];
538
+ else return [`@typescript-eslint/${rule}`, value];
539
+ });
506
540
  const rules = {
507
541
  "@typescript-eslint/adjacent-overload-signatures": "error",
508
542
  "no-array-constructor": "off",
@@ -643,7 +677,7 @@ async function typescript(options) {
643
677
  "@typescript-eslint/no-unnecessary-condition": "error",
644
678
  "@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
645
679
  "@typescript-eslint/no-unnecessary-qualifier": "error",
646
- "@typescript-eslint/no-unnecessary-type-arguments": "error",
680
+ "@typescript-eslint/no-unnecessary-type-arguments": "off",
647
681
  "@typescript-eslint/no-unnecessary-type-assertion": "error",
648
682
  "@typescript-eslint/no-unnecessary-type-constraint": "error",
649
683
  "@typescript-eslint/no-unnecessary-type-parameters": "error",
@@ -723,7 +757,7 @@ async function typescript(options) {
723
757
  "@typescript-eslint/unbound-method": "error",
724
758
  "@typescript-eslint/unified-signatures": ["error", { ignoreDifferentlyNamedParameters: true }],
725
759
  "@typescript-eslint/use-unknown-in-catch-callback-variable": "error",
726
- ...options.overrides?.typescript
760
+ ...overrides
727
761
  };
728
762
  return [{
729
763
  files,
@@ -751,8 +785,13 @@ async function typescript(options) {
751
785
  */
752
786
  async function perfectionist(options) {
753
787
  if (!isEnabled(options.features, "perfectionist")) return {};
788
+ const plugin = await interopDefault(import("eslint-plugin-perfectionist"));
789
+ const overrides = mapRules(options.overrides?.perfectionist ?? {}, (rule, value) => {
790
+ if (rule.startsWith("perfectionist/")) return [rule, value];
791
+ else return [`perfectionist/${rule}`, value];
792
+ });
754
793
  return {
755
- plugins: { perfectionist: await interopDefault(import("eslint-plugin-perfectionist")) },
794
+ plugins: { perfectionist: plugin },
756
795
  rules: {
757
796
  "perfectionist/sort-array-includes": ["error", {
758
797
  type: "natural",
@@ -805,7 +844,7 @@ async function perfectionist(options) {
805
844
  "perfectionist/sort-object-types": "off",
806
845
  "perfectionist/sort-union-types": "off",
807
846
  "perfectionist/sort-switch-case": "off",
808
- ...options.overrides?.perfectionist
847
+ ...overrides
809
848
  }
810
849
  };
811
850
  }
@@ -819,6 +858,7 @@ async function defineConfig(options) {
819
858
  ...await vue(options),
820
859
  perfectionist(options),
821
860
  unicorn(options),
861
+ unocss(options),
822
862
  ignores
823
863
  ]);
824
864
  }
@@ -1,4 +1,5 @@
1
1
  export * from './vue';
2
+ export * from './unocss';
2
3
  export * from './unicorn';
3
4
  export * from './javascript';
4
5
  export * from './typescript';
@@ -0,0 +1,2 @@
1
+ import { ConfigObject, ConfigOptions } from '../types';
2
+ export declare function unocss(options: ConfigOptions): Promise<Partial<ConfigObject>>;
@@ -4,6 +4,8 @@ export interface FeaturesObject {
4
4
  /** @default true */
5
5
  unicorn?: boolean;
6
6
  /** @default false */
7
+ unocss?: boolean;
8
+ /** @default false */
7
9
  vue?: boolean;
8
10
  }
9
11
  export interface ConfigOptions {
@@ -16,6 +18,7 @@ export interface ConfigOptions {
16
18
  perfectionist?: Rules;
17
19
  typescript?: Rules;
18
20
  unicorn?: Rules;
21
+ unocss?: Rules;
19
22
  vue?: Rules;
20
23
  };
21
24
  /**
@@ -1,6 +1,7 @@
1
- import { ConfigOptions, FeaturesObject } from '../types';
1
+ import { ConfigOptions, FeaturesObject, Rules, Severity } from '../types';
2
2
  export * from './enum';
3
3
  export declare function interopDefault(promise: Promise<any>): Promise<unknown>;
4
4
  export declare function isEnabled(config: ConfigOptions['features'], feature: keyof FeaturesObject): boolean;
5
5
  export declare function json<T>(path: string): Promise<T>;
6
6
  export declare function getIgnores(): string[];
7
+ export declare function mapRules(rules: Rules, fn: (rule: string, value: any[] | Severity) => [string, any[] | Severity]): Rules;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/eslint-config",
3
- "version": "9.1.4",
3
+ "version": "10.0.0",
4
4
  "description": "ESLint config",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "@typescript-eslint/eslint-plugin": "^8.58.0",
23
23
  "@typescript-eslint/parser": "^8.58.0",
24
+ "@unocss/eslint-config": "^66.6.7",
24
25
  "eslint-plugin-perfectionist": "^5.8.0",
25
26
  "eslint-plugin-unicorn": "^64.0.0",
26
27
  "eslint-plugin-vue": "^10.8.0",