@coderwyd/eslint-config 2.3.0 → 2.3.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/cli.cjs CHANGED
@@ -46,7 +46,7 @@ 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.3.0";
49
+ var version = "2.3.2";
50
50
  var devDependencies = {
51
51
  "@antfu/ni": "^0.21.12",
52
52
  "@types/eslint": "^8.56.6",
@@ -54,9 +54,9 @@ var devDependencies = {
54
54
  "@types/node": "^20.11.30",
55
55
  "@types/prompts": "^2.4.9",
56
56
  "@types/yargs": "^17.0.32",
57
- "@unocss/eslint-plugin": "^0.58.6",
57
+ "@unocss/eslint-plugin": "^0.58.7",
58
58
  bumpp: "^9.4.0",
59
- eslint: "^8.57.0",
59
+ eslint: "9.0.0-rc.0",
60
60
  "eslint-flat-config-viewer": "^0.1.14",
61
61
  "eslint-plugin-react": "^7.34.1",
62
62
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -67,7 +67,7 @@ var devDependencies = {
67
67
  "fs-extra": "^11.2.0",
68
68
  "lint-staged": "^15.2.2",
69
69
  rimraf: "^5.0.5",
70
- "simple-git-hooks": "^2.11.0",
70
+ "simple-git-hooks": "^2.11.1",
71
71
  "svelte-eslint-parser": "^0.33.1",
72
72
  tsup: "^8.0.2",
73
73
  tsx: "^4.7.1",
@@ -97,7 +97,6 @@ var vscodeSettingsString = `
97
97
  // Enable eslint for all supported languages
98
98
  "eslint.validate": [
99
99
  "svelte",
100
- "astro",
101
100
  "html",
102
101
  "css",
103
102
  "less",
@@ -107,7 +106,9 @@ var vscodeSettingsString = `
107
106
  "yaml",
108
107
  "yml",
109
108
  "markdown",
110
- "toml"
109
+ "toml",
110
+ "gql",
111
+ "graphql"
111
112
  ]
112
113
  `;
113
114
 
package/dist/cli.js CHANGED
@@ -17,7 +17,7 @@ import parse from "parse-gitignore";
17
17
  import c from "picocolors";
18
18
 
19
19
  // package.json
20
- var version = "2.3.0";
20
+ var version = "2.3.2";
21
21
  var devDependencies = {
22
22
  "@antfu/ni": "^0.21.12",
23
23
  "@types/eslint": "^8.56.6",
@@ -25,9 +25,9 @@ var devDependencies = {
25
25
  "@types/node": "^20.11.30",
26
26
  "@types/prompts": "^2.4.9",
27
27
  "@types/yargs": "^17.0.32",
28
- "@unocss/eslint-plugin": "^0.58.6",
28
+ "@unocss/eslint-plugin": "^0.58.7",
29
29
  bumpp: "^9.4.0",
30
- eslint: "^8.57.0",
30
+ eslint: "9.0.0-rc.0",
31
31
  "eslint-flat-config-viewer": "^0.1.14",
32
32
  "eslint-plugin-react": "^7.34.1",
33
33
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -38,7 +38,7 @@ var devDependencies = {
38
38
  "fs-extra": "^11.2.0",
39
39
  "lint-staged": "^15.2.2",
40
40
  rimraf: "^5.0.5",
41
- "simple-git-hooks": "^2.11.0",
41
+ "simple-git-hooks": "^2.11.1",
42
42
  "svelte-eslint-parser": "^0.33.1",
43
43
  tsup: "^8.0.2",
44
44
  tsx: "^4.7.1",
@@ -68,7 +68,6 @@ var vscodeSettingsString = `
68
68
  // Enable eslint for all supported languages
69
69
  "eslint.validate": [
70
70
  "svelte",
71
- "astro",
72
71
  "html",
73
72
  "css",
74
73
  "less",
@@ -78,7 +77,9 @@ var vscodeSettingsString = `
78
77
  "yaml",
79
78
  "yml",
80
79
  "markdown",
81
- "toml"
80
+ "toml",
81
+ "gql",
82
+ "graphql"
82
83
  ]
83
84
  `;
84
85
 
package/dist/index.cjs CHANGED
@@ -103,7 +103,7 @@ var GLOB_JSONC = "**/*.jsonc";
103
103
  var GLOB_MARKDOWN = "**/*.md";
104
104
  var GLOB_YAML = "**/*.y?(a)ml";
105
105
  var GLOB_TOML = "**/*.toml";
106
- var GLOB_GRAPHQL = "**/*.graphql";
106
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
107
107
  var GLOB_PRETTIER_LINT = [GLOB_SRC, GLOB_VUE];
108
108
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
109
109
  var GLOB_TESTS = [
@@ -933,7 +933,7 @@ function sortTsconfig() {
933
933
  // src/configs/prettier.ts
934
934
  var import_eslint_config_prettier = __toESM(require("eslint-config-prettier"), 1);
935
935
  var { rules: eslintRules } = import_eslint_config_prettier.default;
936
- async function prettier(rules) {
936
+ async function prettier(rules = {}) {
937
937
  const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
938
938
  const pRules = {
939
939
  ...rules
@@ -1545,14 +1545,14 @@ async function unocss(options = {}) {
1545
1545
 
1546
1546
  // src/configs/formatter.ts
1547
1547
  async function formatter(options = {}, prettierRules2 = {}) {
1548
- const {
1549
- css = true,
1550
- graphql,
1551
- html = true,
1552
- markdown,
1553
- toml,
1554
- yaml
1555
- } = options || {};
1548
+ const { css, graphql, html, markdown, toml, yaml } = options === true ? {
1549
+ css: true,
1550
+ graphql: true,
1551
+ html: true,
1552
+ markdown: true,
1553
+ toml: true,
1554
+ yaml: true
1555
+ } : options;
1556
1556
  const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
1557
1557
  function createPrettierFormatter(files, parser, plugins) {
1558
1558
  const rules = {
@@ -1778,6 +1778,10 @@ async function defineConfig(options = {}, ...userConfigs) {
1778
1778
  const {
1779
1779
  autoRenamePlugins = true,
1780
1780
  componentExts = [],
1781
+ formatter: formatterOptions = {
1782
+ css: true,
1783
+ html: true
1784
+ },
1781
1785
  gitignore: enableGitignore = true,
1782
1786
  isInEditor: isInEditor2 = isInEditor,
1783
1787
  react: enableReact = false,
@@ -1888,22 +1892,26 @@ async function defineConfig(options = {}, ...userConfigs) {
1888
1892
  sortTsconfig()
1889
1893
  );
1890
1894
  }
1891
- let prettierRules2 = {
1892
- ...DEFAULT_PRETTIER_RULES
1893
- };
1894
- if (options.prettierRules) {
1895
- prettierRules2 = { ...prettierRules2, ...options.prettierRules };
1896
- }
1897
- if (usePrettierrc) {
1898
- const prettierConfig = await loadPrettierConfig(
1899
- options.cwd ?? import_node_process4.default.cwd()
1895
+ if (formatterOptions) {
1896
+ let prettierRules2 = {
1897
+ ...DEFAULT_PRETTIER_RULES
1898
+ };
1899
+ if (options.prettierRules) {
1900
+ prettierRules2 = { ...prettierRules2, ...options.prettierRules };
1901
+ }
1902
+ if (usePrettierrc) {
1903
+ const prettierConfig = await loadPrettierConfig(
1904
+ options.cwd ?? import_node_process4.default.cwd()
1905
+ );
1906
+ Object.assign(prettierRules2, prettierConfig);
1907
+ }
1908
+ configs.push(
1909
+ prettier(prettierRules2),
1910
+ formatter(formatterOptions, prettierRules2)
1900
1911
  );
1901
- Object.assign(prettierRules2, prettierConfig);
1912
+ } else {
1913
+ configs.push(prettier());
1902
1914
  }
1903
- configs.push(
1904
- prettier(prettierRules2),
1905
- formatter(options.formatter, prettierRules2)
1906
- );
1907
1915
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1908
1916
  if (key in options)
1909
1917
  acc[key] = options[key];
package/dist/index.d.cts CHANGED
@@ -538,9 +538,6 @@ interface OptionsConfig extends OptionsComponentExts {
538
538
  /**
539
539
  * Use external formatters to format files.
540
540
  *
541
- * Requires installing:
542
- * - `eslint-plugin-prettier`
543
- *
544
541
  * @default
545
542
  * {
546
543
  * "html": true,
@@ -550,8 +547,10 @@ interface OptionsConfig extends OptionsComponentExts {
550
547
  * "yaml": false
551
548
  * "toml": false
552
549
  * }
550
+ *
551
+ * When set to `true`, it will enable all formatters.
553
552
  */
554
- formatter?: OptionsFormatters;
553
+ formatter?: boolean | OptionsFormatters;
555
554
  /**
556
555
  * Default prettier rules
557
556
  *
package/dist/index.d.ts CHANGED
@@ -538,9 +538,6 @@ interface OptionsConfig extends OptionsComponentExts {
538
538
  /**
539
539
  * Use external formatters to format files.
540
540
  *
541
- * Requires installing:
542
- * - `eslint-plugin-prettier`
543
- *
544
541
  * @default
545
542
  * {
546
543
  * "html": true,
@@ -550,8 +547,10 @@ interface OptionsConfig extends OptionsComponentExts {
550
547
  * "yaml": false
551
548
  * "toml": false
552
549
  * }
550
+ *
551
+ * When set to `true`, it will enable all formatters.
553
552
  */
554
- formatter?: OptionsFormatters;
553
+ formatter?: boolean | OptionsFormatters;
555
554
  /**
556
555
  * Default prettier rules
557
556
  *
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ var GLOB_JSONC = "**/*.jsonc";
57
57
  var GLOB_MARKDOWN = "**/*.md";
58
58
  var GLOB_YAML = "**/*.y?(a)ml";
59
59
  var GLOB_TOML = "**/*.toml";
60
- var GLOB_GRAPHQL = "**/*.graphql";
60
+ var GLOB_GRAPHQL = "**/*.{g,graph}ql";
61
61
  var GLOB_PRETTIER_LINT = [GLOB_SRC, GLOB_VUE];
62
62
  var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
63
63
  var GLOB_TESTS = [
@@ -887,7 +887,7 @@ function sortTsconfig() {
887
887
  // src/configs/prettier.ts
888
888
  import prettierRules from "eslint-config-prettier";
889
889
  var { rules: eslintRules } = prettierRules;
890
- async function prettier(rules) {
890
+ async function prettier(rules = {}) {
891
891
  const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
892
892
  const pRules = {
893
893
  ...rules
@@ -1499,14 +1499,14 @@ async function unocss(options = {}) {
1499
1499
 
1500
1500
  // src/configs/formatter.ts
1501
1501
  async function formatter(options = {}, prettierRules2 = {}) {
1502
- const {
1503
- css = true,
1504
- graphql,
1505
- html = true,
1506
- markdown,
1507
- toml,
1508
- yaml
1509
- } = options || {};
1502
+ const { css, graphql, html, markdown, toml, yaml } = options === true ? {
1503
+ css: true,
1504
+ graphql: true,
1505
+ html: true,
1506
+ markdown: true,
1507
+ toml: true,
1508
+ yaml: true
1509
+ } : options;
1510
1510
  const pluginPrettier = await interopDefault(import("eslint-plugin-prettier"));
1511
1511
  function createPrettierFormatter(files, parser, plugins) {
1512
1512
  const rules = {
@@ -1732,6 +1732,10 @@ async function defineConfig(options = {}, ...userConfigs) {
1732
1732
  const {
1733
1733
  autoRenamePlugins = true,
1734
1734
  componentExts = [],
1735
+ formatter: formatterOptions = {
1736
+ css: true,
1737
+ html: true
1738
+ },
1735
1739
  gitignore: enableGitignore = true,
1736
1740
  isInEditor: isInEditor2 = isInEditor,
1737
1741
  react: enableReact = false,
@@ -1842,22 +1846,26 @@ async function defineConfig(options = {}, ...userConfigs) {
1842
1846
  sortTsconfig()
1843
1847
  );
1844
1848
  }
1845
- let prettierRules2 = {
1846
- ...DEFAULT_PRETTIER_RULES
1847
- };
1848
- if (options.prettierRules) {
1849
- prettierRules2 = { ...prettierRules2, ...options.prettierRules };
1850
- }
1851
- if (usePrettierrc) {
1852
- const prettierConfig = await loadPrettierConfig(
1853
- options.cwd ?? process4.cwd()
1849
+ if (formatterOptions) {
1850
+ let prettierRules2 = {
1851
+ ...DEFAULT_PRETTIER_RULES
1852
+ };
1853
+ if (options.prettierRules) {
1854
+ prettierRules2 = { ...prettierRules2, ...options.prettierRules };
1855
+ }
1856
+ if (usePrettierrc) {
1857
+ const prettierConfig = await loadPrettierConfig(
1858
+ options.cwd ?? process4.cwd()
1859
+ );
1860
+ Object.assign(prettierRules2, prettierConfig);
1861
+ }
1862
+ configs.push(
1863
+ prettier(prettierRules2),
1864
+ formatter(formatterOptions, prettierRules2)
1854
1865
  );
1855
- Object.assign(prettierRules2, prettierConfig);
1866
+ } else {
1867
+ configs.push(prettier());
1856
1868
  }
1857
- configs.push(
1858
- prettier(prettierRules2),
1859
- formatter(options.formatter, prettierRules2)
1860
- );
1861
1869
  const fusedConfig = flatConfigProps.reduce((acc, key) => {
1862
1870
  if (key in options)
1863
1871
  acc[key] = options[key];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coderwyd/eslint-config",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.3.2",
5
5
  "packageManager": "pnpm@8.15.5",
6
6
  "description": "Donny's ESLint config",
7
7
  "author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
@@ -72,13 +72,13 @@
72
72
  "@eslint-types/typescript-eslint": "^7.2.0",
73
73
  "@eslint-types/unicorn": "^51.0.1",
74
74
  "@toml-tools/parser": "^1.0.0",
75
- "@typescript-eslint/eslint-plugin": "^7.3.1",
76
- "@typescript-eslint/parser": "^7.3.1",
75
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
76
+ "@typescript-eslint/parser": "^7.4.0",
77
77
  "eslint-config-flat-gitignore": "^0.1.3",
78
78
  "eslint-config-prettier": "^9.1.0",
79
79
  "eslint-plugin-antfu": "^2.1.2",
80
80
  "eslint-plugin-eslint-comments": "^3.2.0",
81
- "eslint-plugin-import-x": "^0.4.1",
81
+ "eslint-plugin-import-x": "^0.4.4",
82
82
  "eslint-plugin-jsdoc": "^48.2.1",
83
83
  "eslint-plugin-jsonc": "^2.14.1",
84
84
  "eslint-plugin-n": "^16.6.2",
@@ -88,9 +88,9 @@
88
88
  "eslint-plugin-tailwindcss": "^3.15.1",
89
89
  "eslint-plugin-unicorn": "^51.0.1",
90
90
  "eslint-plugin-unused-imports": "^3.1.0",
91
- "eslint-plugin-vitest": "^0.3.26",
92
- "eslint-plugin-vue": "^9.23.0",
93
- "globals": "^14.0.0",
91
+ "eslint-plugin-vitest": "^0.4.0",
92
+ "eslint-plugin-vue": "^9.24.0",
93
+ "globals": "^15.0.0",
94
94
  "jsonc-eslint-parser": "^2.4.0",
95
95
  "local-pkg": "^0.5.0",
96
96
  "parse-gitignore": "^2.0.0",
@@ -108,9 +108,9 @@
108
108
  "@types/node": "^20.11.30",
109
109
  "@types/prompts": "^2.4.9",
110
110
  "@types/yargs": "^17.0.32",
111
- "@unocss/eslint-plugin": "^0.58.6",
111
+ "@unocss/eslint-plugin": "^0.58.7",
112
112
  "bumpp": "^9.4.0",
113
- "eslint": "^8.57.0",
113
+ "eslint": "9.0.0-rc.0",
114
114
  "eslint-flat-config-viewer": "^0.1.14",
115
115
  "eslint-plugin-react": "^7.34.1",
116
116
  "eslint-plugin-react-hooks": "^4.6.0",
@@ -121,7 +121,7 @@
121
121
  "fs-extra": "^11.2.0",
122
122
  "lint-staged": "^15.2.2",
123
123
  "rimraf": "^5.0.5",
124
- "simple-git-hooks": "^2.11.0",
124
+ "simple-git-hooks": "^2.11.1",
125
125
  "svelte-eslint-parser": "^0.33.1",
126
126
  "tsup": "^8.0.2",
127
127
  "tsx": "^4.7.1",