@coderwyd/eslint-config 2.5.4 → 2.5.6

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
@@ -34,8 +34,10 @@ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
34
34
  var GLOB_JS = "**/*.?([cm])js";
35
35
  var GLOB_JSX = "**/*.?([cm])jsx";
36
36
  var GLOB_TS = "**/*.?([cm])ts";
37
+ var GLOB_DTS = "**/*.d.?([cm])ts";
37
38
  var GLOB_TSX = "**/*.?([cm])tsx";
38
39
  var GLOB_VUE = "**/*.vue";
40
+ var GLOB_ASTRO_TS = "**/*.astro/*.ts";
39
41
  var GLOB_SVELTE = "**/*.svelte";
40
42
  var GLOB_HTML = "**/*.htm?(l)";
41
43
  var GLOB_CSS = "**/*.css";
@@ -81,6 +83,7 @@ var GLOB_EXCLUDE = [
81
83
  "**/.output",
82
84
  "**/.vite-inspect",
83
85
  "**/.yarn",
86
+ "**/vite.config.*.timestamp-*",
84
87
  "**/CHANGELOG*.md",
85
88
  "**/*.min.*",
86
89
  "**/LICENSE*",
@@ -179,6 +182,9 @@ async function javascript(options = {}) {
179
182
  linterOptions: {
180
183
  reportUnusedDisableDirectives: true
181
184
  },
185
+ name: "coderwyd/javascript/setup"
186
+ },
187
+ {
182
188
  name: "coderwyd/javascript/rules",
183
189
  plugins: {
184
190
  "unused-imports": default6
@@ -874,7 +880,7 @@ var StylisticConfigDefaults = {
874
880
  async function stylistic(options = {}) {
875
881
  const {
876
882
  indent,
877
- jsx,
883
+ jsx: jsx2,
878
884
  overrides = {},
879
885
  quotes,
880
886
  semi
@@ -888,7 +894,7 @@ async function stylistic(options = {}) {
888
894
  const config = pluginStylistic.configs.customize({
889
895
  flat: true,
890
896
  indent,
891
- jsx,
897
+ jsx: jsx2,
892
898
  pluginName: "style",
893
899
  quotes,
894
900
  semi
@@ -917,10 +923,15 @@ import process2 from "node:process";
917
923
  async function typescript(options = {}) {
918
924
  const { componentExts = [], overrides = {}, parserOptions = {} } = options;
919
925
  const files = options.files ?? [
920
- GLOB_SRC,
926
+ GLOB_TS,
927
+ GLOB_TSX,
921
928
  ...componentExts.map((ext) => `**/*.${ext}`)
922
929
  ];
923
930
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
931
+ const ignoresTypeAware = options.ignoresTypeAware ?? [
932
+ `${GLOB_MARKDOWN}/**`,
933
+ GLOB_ASTRO_TS
934
+ ];
924
935
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
925
936
  const isTypeAware = !!tsconfigPath;
926
937
  const typeAwareRules = {
@@ -940,9 +951,12 @@ async function typescript(options = {}) {
940
951
  "ts/no-unsafe-call": "error",
941
952
  "ts/no-unsafe-member-access": "error",
942
953
  "ts/no-unsafe-return": "error",
954
+ "ts/promise-function-async": "error",
943
955
  "ts/restrict-plus-operands": "error",
944
956
  "ts/restrict-template-expressions": "error",
957
+ "ts/return-await": "error",
945
958
  "ts/strict-boolean-expressions": "error",
959
+ "ts/switch-exhaustiveness-check": "error",
946
960
  "ts/unbound-method": "error"
947
961
  };
948
962
  const [pluginTs, parserTs] = await Promise.all([
@@ -979,7 +993,7 @@ async function typescript(options = {}) {
979
993
  },
980
994
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
981
995
  ...isTypeAware ? [
982
- makeParser(true, filesTypeAware),
996
+ makeParser(true, filesTypeAware, ignoresTypeAware),
983
997
  makeParser(false, files, filesTypeAware)
984
998
  ] : [makeParser(false, files)],
985
999
  {
@@ -1035,6 +1049,7 @@ async function typescript(options = {}) {
1035
1049
  ...isTypeAware ? [
1036
1050
  {
1037
1051
  files: filesTypeAware,
1052
+ ignores: ignoresTypeAware,
1038
1053
  name: "coderwyd/typescript/rules-type-aware",
1039
1054
  rules: {
1040
1055
  ...tsconfigPath ? typeAwareRules : {},
@@ -1043,7 +1058,7 @@ async function typescript(options = {}) {
1043
1058
  }
1044
1059
  ] : [],
1045
1060
  {
1046
- files: ["**/*.d.ts"],
1061
+ files: [GLOB_DTS],
1047
1062
  name: "coderwyd/typescript/disables/dts",
1048
1063
  rules: {
1049
1064
  "eslint-comments/no-unlimited-disable": "off",
@@ -1434,7 +1449,7 @@ import { isPackageExists as isPackageExists3 } from "local-pkg";
1434
1449
  // src/env.ts
1435
1450
  import process3 from "node:process";
1436
1451
  import { isPackageExists as isPackageExists2 } from "local-pkg";
1437
- var isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI);
1452
+ var isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM || process3.env.NVIM) && !process3.env.CI);
1438
1453
  var hasTypeScript = isPackageExists2("typescript");
1439
1454
  var VueJsPackages = [
1440
1455
  "vue",
@@ -1870,6 +1885,23 @@ async function regexp(options = {}) {
1870
1885
  ];
1871
1886
  }
1872
1887
 
1888
+ // src/configs/jsx.ts
1889
+ async function jsx() {
1890
+ return [
1891
+ {
1892
+ files: [GLOB_JSX, GLOB_TSX],
1893
+ languageOptions: {
1894
+ parserOptions: {
1895
+ ecmaFeatures: {
1896
+ jsx: true
1897
+ }
1898
+ }
1899
+ },
1900
+ name: "coderwyd/jsx/setup"
1901
+ }
1902
+ ];
1903
+ }
1904
+
1873
1905
  // src/index.ts
1874
1906
  var flatConfigProps = [
1875
1907
  "name",
@@ -1904,6 +1936,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1904
1936
  },
1905
1937
  gitignore: enableGitignore = true,
1906
1938
  isInEditor: isInEditor2 = isInEditor,
1939
+ jsx: enableJsx = true,
1907
1940
  react: enableReact = false,
1908
1941
  regexp: enableRegexp = true,
1909
1942
  svelte: enableSvelte = false,
@@ -1914,7 +1947,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1914
1947
  } = options;
1915
1948
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1916
1949
  if (stylisticOptions && !("jsx" in stylisticOptions))
1917
- stylisticOptions.jsx = options.jsx ?? true;
1950
+ stylisticOptions.jsx = enableJsx;
1918
1951
  const configs2 = [];
1919
1952
  if (enableGitignore) {
1920
1953
  if (typeof enableGitignore !== "boolean") {
@@ -1956,6 +1989,9 @@ async function defineConfig(options = {}, ...userConfigs) {
1956
1989
  );
1957
1990
  if (enableVue)
1958
1991
  componentExts.push("vue");
1992
+ if (enableJsx) {
1993
+ configs2.push(jsx());
1994
+ }
1959
1995
  if (enableTypeScript) {
1960
1996
  configs2.push(
1961
1997
  typescript({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderwyd/eslint-config",
3
3
  "type": "module",
4
- "version": "2.5.4",
4
+ "version": "2.5.6",
5
5
  "description": "Donny's ESLint config",
6
6
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
7
7
  "license": "MIT",
@@ -40,9 +40,9 @@
40
40
  "eslint": "^8.56.0 || ^9.0.0",
41
41
  "eslint-plugin-react-hooks": "^4.6.0",
42
42
  "eslint-plugin-react-refresh": "^0.4.4",
43
- "eslint-plugin-svelte": "^2.34.1",
43
+ "eslint-plugin-svelte": ">=2.35.1",
44
44
  "eslint-plugin-tailwindcss": "^3.16.0",
45
- "svelte-eslint-parser": "^0.33.1"
45
+ "svelte-eslint-parser": ">=0.37.0"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@eslint-react/eslint-plugin": {
@@ -69,30 +69,30 @@
69
69
  },
70
70
  "dependencies": {
71
71
  "@antfu/install-pkg": "^0.3.3",
72
- "@stylistic/eslint-plugin": "^2.1.0",
72
+ "@stylistic/eslint-plugin": "^2.3.0",
73
73
  "@toml-tools/parser": "^1.0.0",
74
- "@typescript-eslint/eslint-plugin": "^7.11.0",
75
- "@typescript-eslint/parser": "^7.11.0",
74
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
75
+ "@typescript-eslint/parser": "^7.15.0",
76
76
  "eslint-config-flat-gitignore": "^0.1.5",
77
77
  "eslint-merge-processors": "^0.1.0",
78
78
  "eslint-plugin-antfu": "^2.3.3",
79
79
  "eslint-plugin-command": "^0.2.3",
80
80
  "eslint-plugin-eslint-comments": "^3.2.0",
81
- "eslint-plugin-format": "^0.1.1",
82
- "eslint-plugin-import-x": "^0.5.1",
83
- "eslint-plugin-jsdoc": "^48.2.7",
81
+ "eslint-plugin-format": "^0.1.2",
82
+ "eslint-plugin-import-x": "^0.5.3",
83
+ "eslint-plugin-jsdoc": "^48.5.0",
84
84
  "eslint-plugin-jsonc": "^2.16.0",
85
- "eslint-plugin-n": "^17.7.0",
85
+ "eslint-plugin-n": "^17.9.0",
86
86
  "eslint-plugin-no-only-tests": "^3.1.0",
87
- "eslint-plugin-perfectionist": "^2.10.0",
87
+ "eslint-plugin-perfectionist": "^2.11.0",
88
88
  "eslint-plugin-regexp": "^2.6.0",
89
- "eslint-plugin-unicorn": "^53.0.0",
89
+ "eslint-plugin-unicorn": "^54.0.0",
90
90
  "eslint-plugin-unused-imports": "^3.2.0",
91
91
  "eslint-plugin-vitest": "^0.5.4",
92
- "eslint-plugin-vue": "^9.26.0",
92
+ "eslint-plugin-vue": "^9.27.0",
93
93
  "eslint-processor-vue-blocks": "^0.1.2",
94
94
  "eslint-typegen": "^0.2.4",
95
- "globals": "^15.3.0",
95
+ "globals": "^15.7.0",
96
96
  "jsonc-eslint-parser": "^2.4.0",
97
97
  "local-pkg": "^0.5.0",
98
98
  "parse-gitignore": "^2.0.0",
@@ -104,32 +104,32 @@
104
104
  },
105
105
  "devDependencies": {
106
106
  "@antfu/ni": "^0.21.12",
107
- "@eslint-react/eslint-plugin": "^1.5.14",
108
- "@eslint/config-inspector": "^0.4.10",
109
- "@stylistic/eslint-plugin-migrate": "^2.1.0",
107
+ "@eslint-react/eslint-plugin": "^1.5.20",
108
+ "@eslint/config-inspector": "^0.5.1",
109
+ "@stylistic/eslint-plugin-migrate": "^2.3.0",
110
110
  "@types/eslint": "^8.56.10",
111
111
  "@types/fs-extra": "^11.0.4",
112
- "@types/node": "^20.14.0",
112
+ "@types/node": "^20.14.9",
113
113
  "@types/prompts": "^2.4.9",
114
114
  "@types/yargs": "^17.0.32",
115
- "@unocss/eslint-plugin": "^0.60.4",
115
+ "@unocss/eslint-plugin": "^0.61.0",
116
116
  "bumpp": "^9.4.1",
117
- "eslint": "^9.4.0",
117
+ "eslint": "^9.6.0",
118
118
  "eslint-plugin-react-hooks": "^4.6.2",
119
119
  "eslint-plugin-react-refresh": "^0.4.7",
120
- "eslint-plugin-svelte": "2.39.0",
121
- "eslint-plugin-tailwindcss": "^3.17.0",
122
- "execa": "^9.1.0",
120
+ "eslint-plugin-svelte": "2.39.5",
121
+ "eslint-plugin-tailwindcss": "^3.17.4",
122
+ "execa": "^9.3.0",
123
123
  "fast-glob": "^3.3.2",
124
124
  "fs-extra": "^11.2.0",
125
- "lint-staged": "^15.2.5",
125
+ "lint-staged": "^15.2.7",
126
126
  "rimraf": "^5.0.7",
127
127
  "simple-git-hooks": "^2.11.1",
128
- "svelte": "^4.2.17",
129
- "svelte-eslint-parser": "^0.36.0",
130
- "tsup": "^8.0.2",
131
- "tsx": "^4.11.0",
132
- "typescript": "^5.4.5"
128
+ "svelte": "^4.2.18",
129
+ "svelte-eslint-parser": "^0.39.2",
130
+ "tsup": "^8.1.0",
131
+ "tsx": "^4.16.0",
132
+ "typescript": "^5.5.3"
133
133
  },
134
134
  "simple-git-hooks": {
135
135
  "pre-commit": "pnpx nano-staged"