@coderwyd/eslint-config 2.6.0 → 2.6.2

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,6 +1,3 @@
1
- // src/index.ts
2
- import fs from "node:fs";
3
-
4
1
  // src/plugins/index.ts
5
2
  import { default as default2 } from "eslint-plugin-antfu";
6
3
  import { default as default3 } from "eslint-plugin-eslint-comments";
@@ -11,7 +8,7 @@ import { default as default6 } from "eslint-plugin-unused-imports";
11
8
  import { default as default7 } from "eslint-plugin-perfectionist";
12
9
 
13
10
  // src/configs/comments.ts
14
- async function comments() {
11
+ function comments() {
15
12
  return [
16
13
  {
17
14
  name: "coderwyd/eslint-comments/rules",
@@ -75,6 +72,7 @@ var GLOB_EXCLUDE = [
75
72
  "**/.vitepress/cache",
76
73
  "**/.nuxt",
77
74
  "**/.next",
75
+ "**/.svelte-kit",
78
76
  "**/.vercel",
79
77
  "**/.changeset",
80
78
  "**/.idea",
@@ -92,7 +90,7 @@ var GLOB_EXCLUDE = [
92
90
  ];
93
91
 
94
92
  // src/configs/ignores.ts
95
- async function ignores() {
93
+ function ignores() {
96
94
  return [
97
95
  {
98
96
  ignores: GLOB_EXCLUDE
@@ -101,7 +99,7 @@ async function ignores() {
101
99
  }
102
100
 
103
101
  // src/configs/imports.ts
104
- async function imports(options = {}) {
102
+ function imports(options = {}) {
105
103
  const { stylistic: stylistic2 = true } = options;
106
104
  return [
107
105
  {
@@ -120,23 +118,6 @@ async function imports(options = {}) {
120
118
  "import/no-named-default": "error",
121
119
  "import/no-self-import": "error",
122
120
  "import/no-webpack-loader-syntax": "error",
123
- "import/order": [
124
- "error",
125
- {
126
- groups: [
127
- "builtin",
128
- "external",
129
- "internal",
130
- "parent",
131
- "sibling",
132
- "index",
133
- "object",
134
- "type"
135
- ],
136
- pathGroups: [{ group: "internal", pattern: "{{@,~}/,#}**" }],
137
- pathGroupsExcludedImportTypes: ["type"]
138
- }
139
- ],
140
121
  ...stylistic2 ? {
141
122
  "import/newline-after-import": ["error", { count: 1 }]
142
123
  } : {}
@@ -155,7 +136,7 @@ async function imports(options = {}) {
155
136
 
156
137
  // src/configs/javascript.ts
157
138
  import globals from "globals";
158
- async function javascript(options = {}) {
139
+ function javascript(options = {}) {
159
140
  const { isInEditor: isInEditor2 = false, overrides = {} } = options;
160
141
  return [
161
142
  {
@@ -361,16 +342,8 @@ async function javascript(options = {}) {
361
342
  "prefer-rest-params": "error",
362
343
  "prefer-spread": "error",
363
344
  "prefer-template": "error",
364
- "sort-imports": [
365
- "error",
366
- {
367
- allowSeparatedGroups: false,
368
- ignoreCase: false,
369
- ignoreDeclarationSort: true,
370
- ignoreMemberSort: false,
371
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
372
- }
373
- ],
345
+ "require-await": "error",
346
+ "require-yield": "error",
374
347
  "symbol-description": "error",
375
348
  "unicode-bom": ["error", "never"],
376
349
  "unused-imports/no-unused-imports": isInEditor2 ? "off" : "error",
@@ -625,7 +598,7 @@ async function jsonc(options = {}) {
625
598
  }
626
599
 
627
600
  // src/configs/node.ts
628
- async function node() {
601
+ function node() {
629
602
  return [
630
603
  {
631
604
  name: "coderwyd/node/rules",
@@ -647,7 +620,7 @@ async function node() {
647
620
  }
648
621
 
649
622
  // src/configs/sort.ts
650
- async function sortPackageJson() {
623
+ function sortPackageJson() {
651
624
  return [
652
625
  {
653
626
  files: ["**/package.json"],
@@ -854,6 +827,7 @@ function sortTsconfig() {
854
827
  "allowSyntheticDefaultImports",
855
828
  "esModuleInterop",
856
829
  "forceConsistentCasingInFileNames",
830
+ "isolatedDeclarations",
857
831
  "isolatedModules",
858
832
  "preserveSymlinks",
859
833
  "verbatimModuleSyntax",
@@ -931,7 +905,7 @@ async function typescript(options = {}) {
931
905
  `${GLOB_MARKDOWN}/**`,
932
906
  GLOB_ASTRO_TS
933
907
  ];
934
- const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
908
+ const tsconfigPath = options.tsconfigPath;
935
909
  const isTypeAware = !!tsconfigPath;
936
910
  const typeAwareRules = {
937
911
  "dot-notation": "off",
@@ -1014,7 +988,7 @@ async function typescript(options = {}) {
1014
988
  "no-useless-constructor": "off",
1015
989
  "ts/ban-ts-comment": [
1016
990
  "error",
1017
- { "ts-ignore": "allow-with-description" }
991
+ { "ts-expect-error": "allow-with-description" }
1018
992
  ],
1019
993
  "ts/consistent-type-definitions": ["error", "interface"],
1020
994
  "ts/consistent-type-imports": [
@@ -1025,7 +999,15 @@ async function typescript(options = {}) {
1025
999
  // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
1026
1000
  "ts/no-dupe-class-members": "error",
1027
1001
  "ts/no-dynamic-delete": "off",
1028
- "ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
1002
+ "ts/no-empty-object-type": [
1003
+ "error",
1004
+ {
1005
+ allowInterfaces: "with-single-extends",
1006
+ // interface Derived extends Base {}
1007
+ allowObjectTypes: "never",
1008
+ allowWithName: "Props$"
1009
+ }
1010
+ ],
1029
1011
  "ts/no-explicit-any": "off",
1030
1012
  "ts/no-extraneous-class": "off",
1031
1013
  "ts/no-import-type-side-effects": "error",
@@ -1041,7 +1023,6 @@ async function typescript(options = {}) {
1041
1023
  ],
1042
1024
  "ts/no-useless-constructor": "off",
1043
1025
  "ts/no-wrapper-object-types": "error",
1044
- "ts/prefer-ts-expect-error": "error",
1045
1026
  "ts/triple-slash-reference": "off",
1046
1027
  "ts/unified-signatures": "off",
1047
1028
  ...overrides
@@ -1087,7 +1068,7 @@ async function typescript(options = {}) {
1087
1068
  }
1088
1069
 
1089
1070
  // src/configs/unicorn.ts
1090
- async function unicorn() {
1071
+ function unicorn() {
1091
1072
  return [
1092
1073
  {
1093
1074
  name: "coderwyd/unicorn/rules",
@@ -1119,6 +1100,7 @@ async function unicorn() {
1119
1100
  "unicorn/no-hex-escape": "error",
1120
1101
  "unicorn/no-instanceof-array": "error",
1121
1102
  "unicorn/no-invalid-remove-event-listener": "error",
1103
+ "unicorn/no-length-as-slice-end": "error",
1122
1104
  "unicorn/no-lonely-if": "error",
1123
1105
  "unicorn/no-new-array": "error",
1124
1106
  "unicorn/no-new-buffer": "error",
@@ -1283,7 +1265,7 @@ async function vue(options = {}) {
1283
1265
  // },
1284
1266
  "vue/html-quotes": ["error", "double"],
1285
1267
  // ],
1286
- "vue/max-attributes-per-line": "off",
1268
+ // 'vue/max-attributes-per-line': 'off',
1287
1269
  "vue/multi-word-component-names": "off",
1288
1270
  // 'vue/next-tick-style': ['warn', 'promise'],
1289
1271
  "vue/no-constant-condition": "warn",
@@ -1426,6 +1408,7 @@ async function test(options = {}) {
1426
1408
  "test/no-only-tests": isInEditor2 ? "off" : "error",
1427
1409
  "test/prefer-hooks-in-order": "error",
1428
1410
  "test/prefer-lowercase-title": "error",
1411
+ "ts/explicit-function-return-type": "off",
1429
1412
  ...overrides
1430
1413
  }
1431
1414
  }
@@ -1433,12 +1416,45 @@ async function test(options = {}) {
1433
1416
  }
1434
1417
 
1435
1418
  // src/configs/perfectionist.ts
1436
- async function perfectionist() {
1419
+ function perfectionist() {
1437
1420
  return [
1438
1421
  {
1439
- name: "coderwyd/perfectionist/setup",
1422
+ name: "coderwyd/perfectionist/rules",
1440
1423
  plugins: {
1441
1424
  perfectionist: default7
1425
+ },
1426
+ rules: {
1427
+ "perfectionist/sort-imports": [
1428
+ "warn",
1429
+ {
1430
+ groups: [
1431
+ "builtin",
1432
+ "external",
1433
+ "internal",
1434
+ "internal-type",
1435
+ "parent",
1436
+ "parent-type",
1437
+ "sibling",
1438
+ "sibling-type",
1439
+ "index",
1440
+ "index-type",
1441
+ "object",
1442
+ "type",
1443
+ "side-effect",
1444
+ "side-effect-style"
1445
+ ],
1446
+ internalPattern: ["~/**", "@/**", "#**"],
1447
+ newlinesBetween: "ignore"
1448
+ }
1449
+ ],
1450
+ "perfectionist/sort-named-exports": [
1451
+ "warn",
1452
+ { groupKind: "values-first" }
1453
+ ],
1454
+ "perfectionist/sort-named-imports": [
1455
+ "warn",
1456
+ { groupKind: "values-first" }
1457
+ ]
1442
1458
  }
1443
1459
  }
1444
1460
  ];
@@ -1788,7 +1804,6 @@ async function svelte(options = {}) {
1788
1804
  "svelte/no-useless-mustaches": "error",
1789
1805
  "svelte/require-store-callbacks-use-set-param": "error",
1790
1806
  "svelte/system": "error",
1791
- "svelte/valid-compile": "error",
1792
1807
  "svelte/valid-each-key": "error",
1793
1808
  "unused-imports/no-unused-vars": [
1794
1809
  "error",
@@ -1852,7 +1867,7 @@ async function tailwindcss(options = {}) {
1852
1867
 
1853
1868
  // src/configs/command.ts
1854
1869
  import createCommand from "eslint-plugin-command/config";
1855
- async function command() {
1870
+ function command() {
1856
1871
  return [
1857
1872
  {
1858
1873
  ...createCommand(),
@@ -1863,7 +1878,7 @@ async function command() {
1863
1878
 
1864
1879
  // src/configs/regexp.ts
1865
1880
  import { configs } from "eslint-plugin-regexp";
1866
- async function regexp(options = {}) {
1881
+ function regexp(options = {}) {
1867
1882
  const config = configs["flat/recommended"];
1868
1883
  const rules = {
1869
1884
  ...config.rules
@@ -1887,7 +1902,7 @@ async function regexp(options = {}) {
1887
1902
  }
1888
1903
 
1889
1904
  // src/configs/jsx.ts
1890
- async function jsx() {
1905
+ function jsx() {
1891
1906
  return [
1892
1907
  {
1893
1908
  files: [GLOB_JSX, GLOB_TSX],
@@ -1958,13 +1973,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1958
1973
  ])
1959
1974
  );
1960
1975
  } else {
1961
- if (fs.existsSync(".gitignore")) {
1962
- configs2.push(
1963
- interopDefault(import("eslint-config-flat-gitignore")).then((r) => [
1964
- r()
1965
- ])
1966
- );
1967
- }
1976
+ configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({ strict: false })]));
1968
1977
  }
1969
1978
  }
1970
1979
  const typescriptOptions = resolveSubOptions(options, "typescript");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderwyd/eslint-config",
3
3
  "type": "module",
4
- "version": "2.6.0",
4
+ "version": "2.6.2",
5
5
  "description": "Donny's ESLint config",
6
6
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
7
7
  "license": "MIT",
@@ -71,23 +71,23 @@
71
71
  "@antfu/install-pkg": "^0.3.3",
72
72
  "@stylistic/eslint-plugin": "^2.6.0-beta.0",
73
73
  "@toml-tools/parser": "^1.0.0",
74
- "@typescript-eslint/eslint-plugin": "^8.0.0-alpha.41",
75
- "@typescript-eslint/parser": "^8.0.0-alpha.41",
76
- "eslint-config-flat-gitignore": "^0.1.7",
74
+ "@typescript-eslint/eslint-plugin": "^8.0.0-alpha.54",
75
+ "@typescript-eslint/parser": "^8.0.0-alpha.54",
76
+ "eslint-config-flat-gitignore": "^0.1.8",
77
77
  "eslint-merge-processors": "^0.1.0",
78
78
  "eslint-plugin-antfu": "^2.3.4",
79
79
  "eslint-plugin-command": "^0.2.3",
80
80
  "eslint-plugin-eslint-comments": "^3.2.0",
81
81
  "eslint-plugin-format": "^0.1.2",
82
- "eslint-plugin-import-x": "^3.0.1",
83
- "eslint-plugin-jsdoc": "^48.7.0",
82
+ "eslint-plugin-import-x": "^3.1.0",
83
+ "eslint-plugin-jsdoc": "^48.8.3",
84
84
  "eslint-plugin-jsonc": "^2.16.0",
85
- "eslint-plugin-n": "^17.9.0",
85
+ "eslint-plugin-n": "^17.10.1",
86
86
  "eslint-plugin-no-only-tests": "^3.1.0",
87
- "eslint-plugin-perfectionist": "^2.11.0",
87
+ "eslint-plugin-perfectionist": "^3.0.0",
88
88
  "eslint-plugin-regexp": "^2.6.0",
89
- "eslint-plugin-unicorn": "^54.0.0",
90
- "eslint-plugin-unused-imports": "^4.0.0",
89
+ "eslint-plugin-unicorn": "^55.0.0",
90
+ "eslint-plugin-unused-imports": "^4.0.1",
91
91
  "eslint-plugin-vitest": "^0.5.4",
92
92
  "eslint-plugin-vue": "^9.27.0",
93
93
  "eslint-processor-vue-blocks": "^0.1.2",
@@ -103,21 +103,21 @@
103
103
  "yargs": "^17.7.2"
104
104
  },
105
105
  "devDependencies": {
106
- "@antfu/ni": "^0.21.12",
107
- "@eslint-react/eslint-plugin": "^1.5.24",
108
- "@eslint/config-inspector": "^0.5.1",
106
+ "@antfu/ni": "^0.22.0",
107
+ "@eslint-react/eslint-plugin": "^1.5.30",
108
+ "@eslint/config-inspector": "^0.5.2",
109
109
  "@stylistic/eslint-plugin-migrate": "^2.3.0",
110
- "@types/eslint": "^8.56.10",
110
+ "@types/eslint": "^9.6.0",
111
111
  "@types/fs-extra": "^11.0.4",
112
- "@types/node": "^20.14.10",
112
+ "@types/node": "^20.14.12",
113
113
  "@types/prompts": "^2.4.9",
114
114
  "@types/yargs": "^17.0.32",
115
- "@unocss/eslint-plugin": "^0.61.3",
115
+ "@unocss/eslint-plugin": "^0.61.6",
116
116
  "bumpp": "^9.4.1",
117
- "eslint": "^9.6.0",
117
+ "eslint": "^9.8.0",
118
118
  "eslint-plugin-react-hooks": "^4.6.2",
119
- "eslint-plugin-react-refresh": "^0.4.8",
120
- "eslint-plugin-svelte": "2.41.0",
119
+ "eslint-plugin-react-refresh": "^0.4.9",
120
+ "eslint-plugin-svelte": "2.43.0",
121
121
  "eslint-plugin-tailwindcss": "^3.17.4",
122
122
  "execa": "^9.3.0",
123
123
  "fast-glob": "^3.3.2",
@@ -126,10 +126,10 @@
126
126
  "rimraf": "^6.0.1",
127
127
  "simple-git-hooks": "^2.11.1",
128
128
  "svelte": "^4.2.18",
129
- "svelte-eslint-parser": "^0.40.0",
130
- "tsup": "^8.1.0",
129
+ "svelte-eslint-parser": "^0.41.0",
130
+ "tsup": "^8.2.3",
131
131
  "tsx": "^4.16.2",
132
- "typescript": "^5.5.3"
132
+ "typescript": "^5.5.4"
133
133
  },
134
134
  "simple-git-hooks": {
135
135
  "pre-commit": "pnpx nano-staged"