@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/README.md CHANGED
@@ -59,9 +59,6 @@ Add the following settings to your `.vscode/settings.json`:
59
59
 
60
60
  ```jsonc
61
61
  {
62
- // Enable the ESlint flat config support
63
- "eslint.experimental.useFlatConfig": true,
64
-
65
62
  // Disable the default formatter, use eslint instead
66
63
  "prettier.enable": false,
67
64
  "editor.formatOnSave": false,
package/dist/cli.cjs CHANGED
@@ -46,35 +46,35 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
46
46
  var import_picocolors = __toESM(require("picocolors"), 1);
47
47
 
48
48
  // package.json
49
- var version = "2.5.4";
49
+ var version = "2.5.6";
50
50
  var devDependencies = {
51
51
  "@antfu/ni": "^0.21.12",
52
- "@eslint-react/eslint-plugin": "^1.5.14",
53
- "@eslint/config-inspector": "^0.4.10",
54
- "@stylistic/eslint-plugin-migrate": "^2.1.0",
52
+ "@eslint-react/eslint-plugin": "^1.5.20",
53
+ "@eslint/config-inspector": "^0.5.1",
54
+ "@stylistic/eslint-plugin-migrate": "^2.3.0",
55
55
  "@types/eslint": "^8.56.10",
56
56
  "@types/fs-extra": "^11.0.4",
57
- "@types/node": "^20.14.0",
57
+ "@types/node": "^20.14.9",
58
58
  "@types/prompts": "^2.4.9",
59
59
  "@types/yargs": "^17.0.32",
60
- "@unocss/eslint-plugin": "^0.60.4",
60
+ "@unocss/eslint-plugin": "^0.61.0",
61
61
  bumpp: "^9.4.1",
62
- eslint: "^9.4.0",
62
+ eslint: "^9.6.0",
63
63
  "eslint-plugin-react-hooks": "^4.6.2",
64
64
  "eslint-plugin-react-refresh": "^0.4.7",
65
- "eslint-plugin-svelte": "2.39.0",
66
- "eslint-plugin-tailwindcss": "^3.17.0",
67
- execa: "^9.1.0",
65
+ "eslint-plugin-svelte": "2.39.5",
66
+ "eslint-plugin-tailwindcss": "^3.17.4",
67
+ execa: "^9.3.0",
68
68
  "fast-glob": "^3.3.2",
69
69
  "fs-extra": "^11.2.0",
70
- "lint-staged": "^15.2.5",
70
+ "lint-staged": "^15.2.7",
71
71
  rimraf: "^5.0.7",
72
72
  "simple-git-hooks": "^2.11.1",
73
- svelte: "^4.2.17",
74
- "svelte-eslint-parser": "^0.36.0",
75
- tsup: "^8.0.2",
76
- tsx: "^4.11.0",
77
- typescript: "^5.4.5"
73
+ svelte: "^4.2.18",
74
+ "svelte-eslint-parser": "^0.39.2",
75
+ tsup: "^8.1.0",
76
+ tsx: "^4.16.0",
77
+ typescript: "^5.5.3"
78
78
  };
79
79
 
80
80
  // src/cli/constants.ts
@@ -84,9 +84,6 @@ var CROSS = import_picocolors.default.red("\u2718");
84
84
  var WARN = import_picocolors.default.yellow("\u2139");
85
85
  var eslintVersion = devDependencies.eslint;
86
86
  var vscodeSettingsString = `
87
- // Enable the ESlint flat config support
88
- "eslint.experimental.useFlatConfig": true,
89
-
90
87
  // Disable the default formatter, use eslint instead
91
88
  "prettier.enable": false,
92
89
  "editor.formatOnSave": false,
package/dist/cli.js CHANGED
@@ -17,35 +17,35 @@ import parse from "parse-gitignore";
17
17
  import c from "picocolors";
18
18
 
19
19
  // package.json
20
- var version = "2.5.4";
20
+ var version = "2.5.6";
21
21
  var devDependencies = {
22
22
  "@antfu/ni": "^0.21.12",
23
- "@eslint-react/eslint-plugin": "^1.5.14",
24
- "@eslint/config-inspector": "^0.4.10",
25
- "@stylistic/eslint-plugin-migrate": "^2.1.0",
23
+ "@eslint-react/eslint-plugin": "^1.5.20",
24
+ "@eslint/config-inspector": "^0.5.1",
25
+ "@stylistic/eslint-plugin-migrate": "^2.3.0",
26
26
  "@types/eslint": "^8.56.10",
27
27
  "@types/fs-extra": "^11.0.4",
28
- "@types/node": "^20.14.0",
28
+ "@types/node": "^20.14.9",
29
29
  "@types/prompts": "^2.4.9",
30
30
  "@types/yargs": "^17.0.32",
31
- "@unocss/eslint-plugin": "^0.60.4",
31
+ "@unocss/eslint-plugin": "^0.61.0",
32
32
  bumpp: "^9.4.1",
33
- eslint: "^9.4.0",
33
+ eslint: "^9.6.0",
34
34
  "eslint-plugin-react-hooks": "^4.6.2",
35
35
  "eslint-plugin-react-refresh": "^0.4.7",
36
- "eslint-plugin-svelte": "2.39.0",
37
- "eslint-plugin-tailwindcss": "^3.17.0",
38
- execa: "^9.1.0",
36
+ "eslint-plugin-svelte": "2.39.5",
37
+ "eslint-plugin-tailwindcss": "^3.17.4",
38
+ execa: "^9.3.0",
39
39
  "fast-glob": "^3.3.2",
40
40
  "fs-extra": "^11.2.0",
41
- "lint-staged": "^15.2.5",
41
+ "lint-staged": "^15.2.7",
42
42
  rimraf: "^5.0.7",
43
43
  "simple-git-hooks": "^2.11.1",
44
- svelte: "^4.2.17",
45
- "svelte-eslint-parser": "^0.36.0",
46
- tsup: "^8.0.2",
47
- tsx: "^4.11.0",
48
- typescript: "^5.4.5"
44
+ svelte: "^4.2.18",
45
+ "svelte-eslint-parser": "^0.39.2",
46
+ tsup: "^8.1.0",
47
+ tsx: "^4.16.0",
48
+ typescript: "^5.5.3"
49
49
  };
50
50
 
51
51
  // src/cli/constants.ts
@@ -55,9 +55,6 @@ var CROSS = c.red("\u2718");
55
55
  var WARN = c.yellow("\u2139");
56
56
  var eslintVersion = devDependencies.eslint;
57
57
  var vscodeSettingsString = `
58
- // Enable the ESlint flat config support
59
- "eslint.experimental.useFlatConfig": true,
60
-
61
58
  // Disable the default formatter, use eslint instead
62
59
  "prettier.enable": false,
63
60
  "editor.formatOnSave": false,
package/dist/index.cjs CHANGED
@@ -79,8 +79,10 @@ var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
79
79
  var GLOB_JS = "**/*.?([cm])js";
80
80
  var GLOB_JSX = "**/*.?([cm])jsx";
81
81
  var GLOB_TS = "**/*.?([cm])ts";
82
+ var GLOB_DTS = "**/*.d.?([cm])ts";
82
83
  var GLOB_TSX = "**/*.?([cm])tsx";
83
84
  var GLOB_VUE = "**/*.vue";
85
+ var GLOB_ASTRO_TS = "**/*.astro/*.ts";
84
86
  var GLOB_SVELTE = "**/*.svelte";
85
87
  var GLOB_HTML = "**/*.htm?(l)";
86
88
  var GLOB_CSS = "**/*.css";
@@ -126,6 +128,7 @@ var GLOB_EXCLUDE = [
126
128
  "**/.output",
127
129
  "**/.vite-inspect",
128
130
  "**/.yarn",
131
+ "**/vite.config.*.timestamp-*",
129
132
  "**/CHANGELOG*.md",
130
133
  "**/*.min.*",
131
134
  "**/LICENSE*",
@@ -224,6 +227,9 @@ async function javascript(options = {}) {
224
227
  linterOptions: {
225
228
  reportUnusedDisableDirectives: true
226
229
  },
230
+ name: "coderwyd/javascript/setup"
231
+ },
232
+ {
227
233
  name: "coderwyd/javascript/rules",
228
234
  plugins: {
229
235
  "unused-imports": import_eslint_plugin_unused_imports.default
@@ -919,7 +925,7 @@ var StylisticConfigDefaults = {
919
925
  async function stylistic(options = {}) {
920
926
  const {
921
927
  indent,
922
- jsx,
928
+ jsx: jsx2,
923
929
  overrides = {},
924
930
  quotes,
925
931
  semi
@@ -933,7 +939,7 @@ async function stylistic(options = {}) {
933
939
  const config = pluginStylistic.configs.customize({
934
940
  flat: true,
935
941
  indent,
936
- jsx,
942
+ jsx: jsx2,
937
943
  pluginName: "style",
938
944
  quotes,
939
945
  semi
@@ -962,10 +968,15 @@ var import_node_process2 = __toESM(require("process"), 1);
962
968
  async function typescript(options = {}) {
963
969
  const { componentExts = [], overrides = {}, parserOptions = {} } = options;
964
970
  const files = options.files ?? [
965
- GLOB_SRC,
971
+ GLOB_TS,
972
+ GLOB_TSX,
966
973
  ...componentExts.map((ext) => `**/*.${ext}`)
967
974
  ];
968
975
  const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
976
+ const ignoresTypeAware = options.ignoresTypeAware ?? [
977
+ `${GLOB_MARKDOWN}/**`,
978
+ GLOB_ASTRO_TS
979
+ ];
969
980
  const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
970
981
  const isTypeAware = !!tsconfigPath;
971
982
  const typeAwareRules = {
@@ -985,9 +996,12 @@ async function typescript(options = {}) {
985
996
  "ts/no-unsafe-call": "error",
986
997
  "ts/no-unsafe-member-access": "error",
987
998
  "ts/no-unsafe-return": "error",
999
+ "ts/promise-function-async": "error",
988
1000
  "ts/restrict-plus-operands": "error",
989
1001
  "ts/restrict-template-expressions": "error",
1002
+ "ts/return-await": "error",
990
1003
  "ts/strict-boolean-expressions": "error",
1004
+ "ts/switch-exhaustiveness-check": "error",
991
1005
  "ts/unbound-method": "error"
992
1006
  };
993
1007
  const [pluginTs, parserTs] = await Promise.all([
@@ -1024,7 +1038,7 @@ async function typescript(options = {}) {
1024
1038
  },
1025
1039
  // assign type-aware parser for type-aware files and type-unaware parser for the rest
1026
1040
  ...isTypeAware ? [
1027
- makeParser(true, filesTypeAware),
1041
+ makeParser(true, filesTypeAware, ignoresTypeAware),
1028
1042
  makeParser(false, files, filesTypeAware)
1029
1043
  ] : [makeParser(false, files)],
1030
1044
  {
@@ -1080,6 +1094,7 @@ async function typescript(options = {}) {
1080
1094
  ...isTypeAware ? [
1081
1095
  {
1082
1096
  files: filesTypeAware,
1097
+ ignores: ignoresTypeAware,
1083
1098
  name: "coderwyd/typescript/rules-type-aware",
1084
1099
  rules: {
1085
1100
  ...tsconfigPath ? typeAwareRules : {},
@@ -1088,7 +1103,7 @@ async function typescript(options = {}) {
1088
1103
  }
1089
1104
  ] : [],
1090
1105
  {
1091
- files: ["**/*.d.ts"],
1106
+ files: [GLOB_DTS],
1092
1107
  name: "coderwyd/typescript/disables/dts",
1093
1108
  rules: {
1094
1109
  "eslint-comments/no-unlimited-disable": "off",
@@ -1479,7 +1494,7 @@ var import_local_pkg3 = require("local-pkg");
1479
1494
  // src/env.ts
1480
1495
  var import_node_process3 = __toESM(require("process"), 1);
1481
1496
  var import_local_pkg2 = require("local-pkg");
1482
- var 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);
1497
+ var 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.NVIM) && !import_node_process3.default.env.CI);
1483
1498
  var hasTypeScript = (0, import_local_pkg2.isPackageExists)("typescript");
1484
1499
  var VueJsPackages = [
1485
1500
  "vue",
@@ -1915,6 +1930,23 @@ async function regexp(options = {}) {
1915
1930
  ];
1916
1931
  }
1917
1932
 
1933
+ // src/configs/jsx.ts
1934
+ async function jsx() {
1935
+ return [
1936
+ {
1937
+ files: [GLOB_JSX, GLOB_TSX],
1938
+ languageOptions: {
1939
+ parserOptions: {
1940
+ ecmaFeatures: {
1941
+ jsx: true
1942
+ }
1943
+ }
1944
+ },
1945
+ name: "coderwyd/jsx/setup"
1946
+ }
1947
+ ];
1948
+ }
1949
+
1918
1950
  // src/index.ts
1919
1951
  var flatConfigProps = [
1920
1952
  "name",
@@ -1949,6 +1981,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1949
1981
  },
1950
1982
  gitignore: enableGitignore = true,
1951
1983
  isInEditor: isInEditor2 = isInEditor,
1984
+ jsx: enableJsx = true,
1952
1985
  react: enableReact = false,
1953
1986
  regexp: enableRegexp = true,
1954
1987
  svelte: enableSvelte = false,
@@ -1959,7 +1992,7 @@ async function defineConfig(options = {}, ...userConfigs) {
1959
1992
  } = options;
1960
1993
  const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
1961
1994
  if (stylisticOptions && !("jsx" in stylisticOptions))
1962
- stylisticOptions.jsx = options.jsx ?? true;
1995
+ stylisticOptions.jsx = enableJsx;
1963
1996
  const configs2 = [];
1964
1997
  if (enableGitignore) {
1965
1998
  if (typeof enableGitignore !== "boolean") {
@@ -2001,6 +2034,9 @@ async function defineConfig(options = {}, ...userConfigs) {
2001
2034
  );
2002
2035
  if (enableVue)
2003
2036
  componentExts.push("vue");
2037
+ if (enableJsx) {
2038
+ configs2.push(jsx());
2039
+ }
2004
2040
  if (enableTypeScript) {
2005
2041
  configs2.push(
2006
2042
  typescript({