@dhzh/eslint-config 0.8.2 → 0.9.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/cli.cjs CHANGED
@@ -48,8 +48,8 @@ var import_picocolors = __toESM(require("picocolors"), 1);
48
48
  var package_default = {
49
49
  name: "@dhzh/eslint-config",
50
50
  type: "module",
51
- version: "0.8.2",
52
- packageManager: "pnpm@9.1.4",
51
+ version: "0.9.0",
52
+ packageManager: "pnpm@9.3.0",
53
53
  description: "Easton's ESLint config",
54
54
  author: "Easton Zheng <dhzhme@gmail.com>",
55
55
  license: "MIT",
@@ -133,10 +133,10 @@ var package_default = {
133
133
  dependencies: {
134
134
  "@antfu/install-pkg": "^0.3.3",
135
135
  "@clack/prompts": "^0.7.0",
136
- "@eslint-react/eslint-plugin": "^1.5.14",
136
+ "@eslint-react/eslint-plugin": "^1.5.15",
137
137
  "@stylistic/eslint-plugin": "^2.1.0",
138
- "@typescript-eslint/eslint-plugin": "^7.11.0",
139
- "@typescript-eslint/parser": "^7.11.0",
138
+ "@typescript-eslint/eslint-plugin": "^7.13.0",
139
+ "@typescript-eslint/parser": "^7.13.0",
140
140
  "eslint-config-flat-gitignore": "^0.1.5",
141
141
  "eslint-flat-config-utils": "^0.2.5",
142
142
  "eslint-merge-processors": "^0.1.0",
@@ -144,10 +144,10 @@ var package_default = {
144
144
  "eslint-plugin-command": "^0.2.3",
145
145
  "eslint-plugin-eslint-comments": "^3.2.0",
146
146
  "eslint-plugin-import-x": "^0.5.1",
147
- "eslint-plugin-jsdoc": "^48.2.7",
147
+ "eslint-plugin-jsdoc": "^48.2.9",
148
148
  "eslint-plugin-jsonc": "^2.16.0",
149
149
  "eslint-plugin-markdown": "^5.0.0",
150
- "eslint-plugin-n": "^17.7.0",
150
+ "eslint-plugin-n": "^17.8.1",
151
151
  "eslint-plugin-no-only-tests": "^3.1.0",
152
152
  "eslint-plugin-perfectionist": "^2.10.0",
153
153
  "eslint-plugin-react-hooks": "^4.6.2",
@@ -160,7 +160,7 @@ var package_default = {
160
160
  "eslint-plugin-vue": "^9.26.0",
161
161
  "eslint-plugin-yml": "^1.14.0",
162
162
  "eslint-processor-vue-blocks": "^0.1.2",
163
- globals: "^15.3.0",
163
+ globals: "^15.4.0",
164
164
  "jsonc-eslint-parser": "^2.4.0",
165
165
  "local-pkg": "^0.5.0",
166
166
  "parse-gitignore": "^2.0.0",
@@ -173,37 +173,37 @@ var package_default = {
173
173
  devDependencies: {
174
174
  "@antfu/ni": "^0.21.12",
175
175
  "@dhzh/eslint-config": "workspace:*",
176
- "@eslint/config-inspector": "^0.4.10",
176
+ "@eslint/config-inspector": "^0.4.11",
177
177
  "@prettier/plugin-xml": "^3.4.1",
178
178
  "@stylistic/eslint-plugin-migrate": "^2.1.0",
179
179
  "@types/eslint": "^8.56.10",
180
180
  "@types/fs-extra": "^11.0.4",
181
- "@types/node": "^20.13.0",
181
+ "@types/node": "^20.14.2",
182
182
  "@types/prompts": "^2.4.9",
183
183
  "@types/yargs": "^17.0.32",
184
184
  "@unocss/eslint-plugin": "^0.60.4",
185
185
  "astro-eslint-parser": "^1.0.2",
186
186
  bumpp: "^9.4.1",
187
187
  eslint: "npm:eslint-ts-patch@9.4.0-0",
188
- "eslint-plugin-astro": "^1.2.0",
188
+ "eslint-plugin-astro": "^1.2.2",
189
189
  "eslint-plugin-format": "^0.1.1",
190
190
  "eslint-plugin-solid": "^0.14.0",
191
- "eslint-plugin-svelte": "^2.39.0",
191
+ "eslint-plugin-svelte": "^2.39.3",
192
192
  "eslint-ts-patch": "9.4.0-0",
193
193
  "eslint-typegen": "^0.2.4",
194
194
  esno: "^4.7.0",
195
- execa: "^9.1.0",
195
+ execa: "^9.2.0",
196
196
  "fast-glob": "^3.3.2",
197
197
  "fs-extra": "^11.2.0",
198
- "lint-staged": "^15.2.5",
198
+ "lint-staged": "^15.2.6",
199
199
  "prettier-plugin-astro": "^0.14.0",
200
200
  "prettier-plugin-slidev": "^1.0.5",
201
201
  rimraf: "^5.0.7",
202
202
  "simple-git-hooks": "^2.11.1",
203
- svelte: "^4.2.17",
204
- "svelte-eslint-parser": "^0.36.0",
205
- tsup: "^8.0.2",
206
- tsx: "^4.11.0",
203
+ svelte: "^4.2.18",
204
+ "svelte-eslint-parser": "^0.37.0",
205
+ tsup: "^8.1.0",
206
+ tsx: "^4.15.2",
207
207
  typescript: "^5.4.5",
208
208
  vitest: "^1.6.0",
209
209
  vue: "^3.4.27"
package/dist/cli.js CHANGED
@@ -19,8 +19,8 @@ import c from "picocolors";
19
19
  var package_default = {
20
20
  name: "@dhzh/eslint-config",
21
21
  type: "module",
22
- version: "0.8.2",
23
- packageManager: "pnpm@9.1.4",
22
+ version: "0.9.0",
23
+ packageManager: "pnpm@9.3.0",
24
24
  description: "Easton's ESLint config",
25
25
  author: "Easton Zheng <dhzhme@gmail.com>",
26
26
  license: "MIT",
@@ -104,10 +104,10 @@ var package_default = {
104
104
  dependencies: {
105
105
  "@antfu/install-pkg": "^0.3.3",
106
106
  "@clack/prompts": "^0.7.0",
107
- "@eslint-react/eslint-plugin": "^1.5.14",
107
+ "@eslint-react/eslint-plugin": "^1.5.15",
108
108
  "@stylistic/eslint-plugin": "^2.1.0",
109
- "@typescript-eslint/eslint-plugin": "^7.11.0",
110
- "@typescript-eslint/parser": "^7.11.0",
109
+ "@typescript-eslint/eslint-plugin": "^7.13.0",
110
+ "@typescript-eslint/parser": "^7.13.0",
111
111
  "eslint-config-flat-gitignore": "^0.1.5",
112
112
  "eslint-flat-config-utils": "^0.2.5",
113
113
  "eslint-merge-processors": "^0.1.0",
@@ -115,10 +115,10 @@ var package_default = {
115
115
  "eslint-plugin-command": "^0.2.3",
116
116
  "eslint-plugin-eslint-comments": "^3.2.0",
117
117
  "eslint-plugin-import-x": "^0.5.1",
118
- "eslint-plugin-jsdoc": "^48.2.7",
118
+ "eslint-plugin-jsdoc": "^48.2.9",
119
119
  "eslint-plugin-jsonc": "^2.16.0",
120
120
  "eslint-plugin-markdown": "^5.0.0",
121
- "eslint-plugin-n": "^17.7.0",
121
+ "eslint-plugin-n": "^17.8.1",
122
122
  "eslint-plugin-no-only-tests": "^3.1.0",
123
123
  "eslint-plugin-perfectionist": "^2.10.0",
124
124
  "eslint-plugin-react-hooks": "^4.6.2",
@@ -131,7 +131,7 @@ var package_default = {
131
131
  "eslint-plugin-vue": "^9.26.0",
132
132
  "eslint-plugin-yml": "^1.14.0",
133
133
  "eslint-processor-vue-blocks": "^0.1.2",
134
- globals: "^15.3.0",
134
+ globals: "^15.4.0",
135
135
  "jsonc-eslint-parser": "^2.4.0",
136
136
  "local-pkg": "^0.5.0",
137
137
  "parse-gitignore": "^2.0.0",
@@ -144,37 +144,37 @@ var package_default = {
144
144
  devDependencies: {
145
145
  "@antfu/ni": "^0.21.12",
146
146
  "@dhzh/eslint-config": "workspace:*",
147
- "@eslint/config-inspector": "^0.4.10",
147
+ "@eslint/config-inspector": "^0.4.11",
148
148
  "@prettier/plugin-xml": "^3.4.1",
149
149
  "@stylistic/eslint-plugin-migrate": "^2.1.0",
150
150
  "@types/eslint": "^8.56.10",
151
151
  "@types/fs-extra": "^11.0.4",
152
- "@types/node": "^20.13.0",
152
+ "@types/node": "^20.14.2",
153
153
  "@types/prompts": "^2.4.9",
154
154
  "@types/yargs": "^17.0.32",
155
155
  "@unocss/eslint-plugin": "^0.60.4",
156
156
  "astro-eslint-parser": "^1.0.2",
157
157
  bumpp: "^9.4.1",
158
158
  eslint: "npm:eslint-ts-patch@9.4.0-0",
159
- "eslint-plugin-astro": "^1.2.0",
159
+ "eslint-plugin-astro": "^1.2.2",
160
160
  "eslint-plugin-format": "^0.1.1",
161
161
  "eslint-plugin-solid": "^0.14.0",
162
- "eslint-plugin-svelte": "^2.39.0",
162
+ "eslint-plugin-svelte": "^2.39.3",
163
163
  "eslint-ts-patch": "9.4.0-0",
164
164
  "eslint-typegen": "^0.2.4",
165
165
  esno: "^4.7.0",
166
- execa: "^9.1.0",
166
+ execa: "^9.2.0",
167
167
  "fast-glob": "^3.3.2",
168
168
  "fs-extra": "^11.2.0",
169
- "lint-staged": "^15.2.5",
169
+ "lint-staged": "^15.2.6",
170
170
  "prettier-plugin-astro": "^0.14.0",
171
171
  "prettier-plugin-slidev": "^1.0.5",
172
172
  rimraf: "^5.0.7",
173
173
  "simple-git-hooks": "^2.11.1",
174
- svelte: "^4.2.17",
175
- "svelte-eslint-parser": "^0.36.0",
176
- tsup: "^8.0.2",
177
- tsx: "^4.11.0",
174
+ svelte: "^4.2.18",
175
+ "svelte-eslint-parser": "^0.37.0",
176
+ tsup: "^8.1.0",
177
+ tsx: "^4.15.2",
178
178
  typescript: "^5.4.5",
179
179
  vitest: "^1.6.0",
180
180
  vue: "^3.4.27"
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ var src_exports = {};
32
32
  __export(src_exports, {
33
33
  GLOB_ALL_SRC: () => GLOB_ALL_SRC,
34
34
  GLOB_ASTRO: () => GLOB_ASTRO,
35
+ GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
35
36
  GLOB_CSS: () => GLOB_CSS,
36
37
  GLOB_EXCLUDE: () => GLOB_EXCLUDE,
37
38
  GLOB_GRAPHQL: () => GLOB_GRAPHQL,
@@ -75,6 +76,7 @@ __export(src_exports, {
75
76
  javascript: () => javascript,
76
77
  jsdoc: () => jsdoc,
77
78
  jsonc: () => jsonc,
79
+ jsx: () => jsx,
78
80
  markdown: () => markdown,
79
81
  node: () => node,
80
82
  parserPlain: () => parserPlain,
@@ -130,6 +132,7 @@ var GLOB_TOML = "**/*.toml";
130
132
  var GLOB_XML = "**/*.xml";
131
133
  var GLOB_HTML = "**/*.htm?(l)";
132
134
  var GLOB_ASTRO = "**/*.astro";
135
+ var GLOB_ASTRO_TS = "**/*.astro/*.ts";
133
136
  var GLOB_GRAPHQL = "**/*.{g,graph}ql";
134
137
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
135
138
  var GLOB_TESTS = [
@@ -377,7 +380,7 @@ var StylisticConfigDefaults = {
377
380
  async function stylistic(options = {}) {
378
381
  const {
379
382
  indent,
380
- jsx,
383
+ jsx: jsx2,
381
384
  lessOpinionated = false,
382
385
  overrides = {},
383
386
  quotes,
@@ -392,7 +395,7 @@ async function stylistic(options = {}) {
392
395
  braceStyle: "1tbs",
393
396
  flat: true,
394
397
  indent,
395
- jsx,
398
+ jsx: jsx2,
396
399
  pluginName: "style",
397
400
  quotes,
398
401
  semi
@@ -425,7 +428,7 @@ async function stylistic(options = {}) {
425
428
  async function formatters(options = {}, stylistic2 = {}) {
426
429
  if (options === true) {
427
430
  options = {
428
- astro: (0, import_local_pkg2.isPackageExists)("astro"),
431
+ astro: (0, import_local_pkg2.isPackageExists)("prettier-plugin-astro"),
429
432
  css: true,
430
433
  graphql: true,
431
434
  html: true,
@@ -646,6 +649,19 @@ async function formatters(options = {}, stylistic2 = {}) {
646
649
  ]
647
650
  }
648
651
  });
652
+ configs2.push({
653
+ files: [GLOB_ASTRO, GLOB_ASTRO_TS],
654
+ name: "antfu/formatter/astro/disables",
655
+ rules: {
656
+ "style/arrow-parens": "off",
657
+ "style/block-spacing": "off",
658
+ "style/comma-dangle": "off",
659
+ "style/indent": "off",
660
+ "style/no-multi-spaces": "off",
661
+ "style/quotes": "off",
662
+ "style/semi": "off"
663
+ }
664
+ });
649
665
  }
650
666
  if (options.graphql) {
651
667
  configs2.push({
@@ -749,6 +765,9 @@ async function javascript(options = {}) {
749
765
  linterOptions: {
750
766
  reportUnusedDisableDirectives: true
751
767
  },
768
+ name: "antfu/javascript/setup"
769
+ },
770
+ {
752
771
  name: "antfu/javascript/rules",
753
772
  plugins: {
754
773
  "antfu": import_eslint_plugin_antfu.default,
@@ -976,6 +995,23 @@ async function jsdoc(options = {}) {
976
995
  ];
977
996
  }
978
997
 
998
+ // src/configs/jsx.ts
999
+ async function jsx() {
1000
+ return [
1001
+ {
1002
+ files: [GLOB_JSX, GLOB_TSX],
1003
+ languageOptions: {
1004
+ parserOptions: {
1005
+ ecmaFeatures: {
1006
+ jsx: true
1007
+ }
1008
+ }
1009
+ },
1010
+ name: "antfu/jsx/setup"
1011
+ }
1012
+ ];
1013
+ }
1014
+
979
1015
  // src/configs/jsonc.ts
980
1016
  async function jsonc(options = {}) {
981
1017
  const {
@@ -1123,25 +1159,6 @@ async function markdown(options = {}) {
1123
1159
  "unicode-bom": "off",
1124
1160
  "unused-imports/no-unused-imports": "off",
1125
1161
  "unused-imports/no-unused-vars": "off",
1126
- // Type aware rules
1127
- ...{
1128
- "ts/await-thenable": "off",
1129
- "ts/dot-notation": "off",
1130
- "ts/no-floating-promises": "off",
1131
- "ts/no-for-in-array": "off",
1132
- "ts/no-implied-eval": "off",
1133
- "ts/no-misused-promises": "off",
1134
- "ts/no-throw-literal": "off",
1135
- "ts/no-unnecessary-type-assertion": "off",
1136
- "ts/no-unsafe-argument": "off",
1137
- "ts/no-unsafe-assignment": "off",
1138
- "ts/no-unsafe-call": "off",
1139
- "ts/no-unsafe-member-access": "off",
1140
- "ts/no-unsafe-return": "off",
1141
- "ts/restrict-plus-operands": "off",
1142
- "ts/restrict-template-expressions": "off",
1143
- "ts/unbound-method": "off"
1144
- },
1145
1162
  ...overrides
1146
1163
  }
1147
1164
  }
@@ -1438,6 +1455,7 @@ async function sortPackageJson() {
1438
1455
  "packageManager",
1439
1456
  "description",
1440
1457
  "author",
1458
+ "contributors",
1441
1459
  "license",
1442
1460
  "funding",
1443
1461
  "homepage",
@@ -1850,10 +1868,15 @@ async function typescript(options = {}) {
1850
1868
  parserOptions = {}
1851
1869
  } = options;
1852
1870
  const files = options.files ?? [
1853
- GLOB_SRC,
1871
+ GLOB_TS,
1872
+ GLOB_TSX,
1854
1873
  ...componentExts.map((ext) => `**/*.${ext}`)
1855
1874
  ];
1856
1875
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
1876
+ const ignoresTypeAware = options.ignoresTypeAware ?? [
1877
+ `${GLOB_MARKDOWN}/**`,
1878
+ GLOB_ASTRO_TS
1879
+ ];
1857
1880
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
1858
1881
  const isTypeAware = !!tsconfigPath;
1859
1882
  const typeAwareRules = {
@@ -1915,7 +1938,7 @@ async function typescript(options = {}) {
1915
1938
  },
1916
1939
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
1917
1940
  ...isTypeAware ? [
1918
- makeParser(true, filesTypeAware),
1941
+ makeParser(true, filesTypeAware, ignoresTypeAware),
1919
1942
  makeParser(false, files, filesTypeAware)
1920
1943
  ] : [makeParser(false, files)],
1921
1944
  {
@@ -1962,6 +1985,7 @@ async function typescript(options = {}) {
1962
1985
  },
1963
1986
  ...isTypeAware ? [{
1964
1987
  files: filesTypeAware,
1988
+ ignores: ignoresTypeAware,
1965
1989
  name: "antfu/typescript/rules-type-aware",
1966
1990
  rules: {
1967
1991
  ...tsconfigPath ? typeAwareRules : {},
@@ -1969,7 +1993,7 @@ async function typescript(options = {}) {
1969
1993
  }
1970
1994
  }] : [],
1971
1995
  {
1972
- files: ["**/*.d.ts"],
1996
+ files: ["**/*.d.?([cm])ts"],
1973
1997
  name: "antfu/typescript/disables/dts",
1974
1998
  rules: {
1975
1999
  "eslint-comments/no-unlimited-disable": "off",
@@ -2358,6 +2382,7 @@ function dhzh(options = {}, ...userConfigs) {
2358
2382
  componentExts = [],
2359
2383
  gitignore: enableGitignore = true,
2360
2384
  isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
2385
+ jsx: enableJsx = true,
2361
2386
  react: enableReact = false,
2362
2387
  regexp: enableRegexp = true,
2363
2388
  solid: enableSolid = false,
@@ -2368,7 +2393,7 @@ function dhzh(options = {}, ...userConfigs) {
2368
2393
  } = options;
2369
2394
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
2370
2395
  if (stylisticOptions && !("jsx" in stylisticOptions)) {
2371
- stylisticOptions.jsx = options.jsx ?? true;
2396
+ stylisticOptions.jsx = enableJsx;
2372
2397
  }
2373
2398
  const configs2 = [];
2374
2399
  if (enableGitignore) {
@@ -2404,6 +2429,9 @@ function dhzh(options = {}, ...userConfigs) {
2404
2429
  if (enableVue) {
2405
2430
  componentExts.push("vue");
2406
2431
  }
2432
+ if (enableJsx) {
2433
+ configs2.push(jsx());
2434
+ }
2407
2435
  if (enableTypeScript) {
2408
2436
  configs2.push(typescript({
2409
2437
  ...typescriptOptions,
@@ -2541,6 +2569,7 @@ var src_default = dhzh;
2541
2569
  0 && (module.exports = {
2542
2570
  GLOB_ALL_SRC,
2543
2571
  GLOB_ASTRO,
2572
+ GLOB_ASTRO_TS,
2544
2573
  GLOB_CSS,
2545
2574
  GLOB_EXCLUDE,
2546
2575
  GLOB_GRAPHQL,
@@ -2583,6 +2612,7 @@ var src_default = dhzh;
2583
2612
  javascript,
2584
2613
  jsdoc,
2585
2614
  jsonc,
2615
+ jsx,
2586
2616
  markdown,
2587
2617
  node,
2588
2618
  parserPlain,