@antfu/eslint-config 2.7.0 → 2.8.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
@@ -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.7.0";
49
+ var version = "2.8.0";
50
50
  var devDependencies = {
51
51
  "@antfu/eslint-config": "workspace:*",
52
52
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
@@ -59,24 +59,25 @@ var devDependencies = {
59
59
  "@types/yargs": "^17.0.32",
60
60
  "@unocss/eslint-plugin": "^0.58.5",
61
61
  "astro-eslint-parser": "^0.16.3",
62
- bumpp: "^9.3.0",
63
- eslint: "npm:eslint-ts-patch@^8.56.0-0",
62
+ bumpp: "^9.4.0",
63
+ eslint: "npm:eslint-ts-patch@^8.57.0-0",
64
64
  "eslint-flat-config-viewer": "^0.1.11",
65
65
  "eslint-plugin-astro": "^0.31.4",
66
66
  "eslint-plugin-format": "^0.1.0",
67
- "eslint-plugin-react": "^7.33.2",
67
+ "eslint-plugin-react": "^7.34.0",
68
68
  "eslint-plugin-react-hooks": "^4.6.0",
69
69
  "eslint-plugin-react-refresh": "^0.4.5",
70
70
  "eslint-plugin-svelte": "^2.35.1",
71
- "eslint-ts-patch": "^8.56.0-0",
72
- esno: "^4.0.0",
71
+ "eslint-ts-patch": "^8.57.0-0",
72
+ esno: "^4.7.0",
73
73
  execa: "^8.0.1",
74
74
  "fast-glob": "^3.3.2",
75
75
  "fs-extra": "^11.2.0",
76
76
  "lint-staged": "^15.2.2",
77
+ "prettier-plugin-astro": "^0.13.0",
77
78
  "prettier-plugin-slidev": "^1.0.5",
78
79
  rimraf: "^5.0.5",
79
- "simple-git-hooks": "^2.9.0",
80
+ "simple-git-hooks": "^2.10.0",
80
81
  svelte: "^4.2.12",
81
82
  "svelte-eslint-parser": "^0.33.1",
82
83
  tsup: "^8.0.2",
@@ -131,7 +132,8 @@ var vscodeSettingsString = `
131
132
  "json",
132
133
  "jsonc",
133
134
  "yaml",
134
- "toml"
135
+ "toml",
136
+ "astro",
135
137
  ]
136
138
  `;
137
139
 
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.7.0";
20
+ var version = "2.8.0";
21
21
  var devDependencies = {
22
22
  "@antfu/eslint-config": "workspace:*",
23
23
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
@@ -30,24 +30,25 @@ var devDependencies = {
30
30
  "@types/yargs": "^17.0.32",
31
31
  "@unocss/eslint-plugin": "^0.58.5",
32
32
  "astro-eslint-parser": "^0.16.3",
33
- bumpp: "^9.3.0",
34
- eslint: "npm:eslint-ts-patch@^8.56.0-0",
33
+ bumpp: "^9.4.0",
34
+ eslint: "npm:eslint-ts-patch@^8.57.0-0",
35
35
  "eslint-flat-config-viewer": "^0.1.11",
36
36
  "eslint-plugin-astro": "^0.31.4",
37
37
  "eslint-plugin-format": "^0.1.0",
38
- "eslint-plugin-react": "^7.33.2",
38
+ "eslint-plugin-react": "^7.34.0",
39
39
  "eslint-plugin-react-hooks": "^4.6.0",
40
40
  "eslint-plugin-react-refresh": "^0.4.5",
41
41
  "eslint-plugin-svelte": "^2.35.1",
42
- "eslint-ts-patch": "^8.56.0-0",
43
- esno: "^4.0.0",
42
+ "eslint-ts-patch": "^8.57.0-0",
43
+ esno: "^4.7.0",
44
44
  execa: "^8.0.1",
45
45
  "fast-glob": "^3.3.2",
46
46
  "fs-extra": "^11.2.0",
47
47
  "lint-staged": "^15.2.2",
48
+ "prettier-plugin-astro": "^0.13.0",
48
49
  "prettier-plugin-slidev": "^1.0.5",
49
50
  rimraf: "^5.0.5",
50
- "simple-git-hooks": "^2.9.0",
51
+ "simple-git-hooks": "^2.10.0",
51
52
  svelte: "^4.2.12",
52
53
  "svelte-eslint-parser": "^0.33.1",
53
54
  tsup: "^8.0.2",
@@ -102,7 +103,8 @@ var vscodeSettingsString = `
102
103
  "json",
103
104
  "jsonc",
104
105
  "yaml",
105
- "toml"
106
+ "toml",
107
+ "astro",
106
108
  ]
107
109
  `;
108
110
 
package/dist/index.cjs CHANGED
@@ -818,6 +818,7 @@ async function stylistic(options = {}) {
818
818
  async function formatters(options = {}, stylistic2 = {}) {
819
819
  if (options === true) {
820
820
  options = {
821
+ astro: (0, import_local_pkg2.isPackageExists)("astro"),
821
822
  css: true,
822
823
  graphql: true,
823
824
  html: true,
@@ -827,7 +828,8 @@ async function formatters(options = {}, stylistic2 = {}) {
827
828
  }
828
829
  await ensurePackages([
829
830
  "eslint-plugin-format",
830
- options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0
831
+ options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
832
+ options.astro ? "prettier-plugin-astro" : void 0
831
833
  ]);
832
834
  if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
833
835
  throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
@@ -986,6 +988,27 @@ async function formatters(options = {}, stylistic2 = {}) {
986
988
  });
987
989
  }
988
990
  }
991
+ if (options.astro) {
992
+ configs.push({
993
+ files: [GLOB_ASTRO],
994
+ languageOptions: {
995
+ parser: parserPlain
996
+ },
997
+ name: "antfu:formatter:astro",
998
+ rules: {
999
+ "format/prettier": [
1000
+ "error",
1001
+ {
1002
+ ...prettierOptions,
1003
+ parser: "astro",
1004
+ plugins: [
1005
+ "prettier-plugin-astro"
1006
+ ]
1007
+ }
1008
+ ]
1009
+ }
1010
+ });
1011
+ }
989
1012
  if (options.graphql) {
990
1013
  configs.push({
991
1014
  files: ["**/*.graphql"],
@@ -1985,7 +2008,13 @@ async function astro(options = {}) {
1985
2008
  rules: {
1986
2009
  "astro/no-set-html-directive": "off",
1987
2010
  "astro/semi": "off",
1988
- ...stylistic2 ? {} : {},
2011
+ ...stylistic2 ? {
2012
+ "style/indent": "off",
2013
+ "style/jsx-closing-tag-location": "off",
2014
+ "style/jsx-indent": "off",
2015
+ "style/jsx-one-expression-per-line": "off",
2016
+ "style/no-multiple-empty-lines": "off"
2017
+ } : {},
1989
2018
  ...overrides
1990
2019
  }
1991
2020
  }
package/dist/index.d.cts CHANGED
@@ -197,6 +197,12 @@ interface OptionsFormatters {
197
197
  slidev?: boolean | {
198
198
  files?: string[];
199
199
  };
200
+ /**
201
+ * Enable formatting support for Astro.
202
+ *
203
+ * Currently only support Prettier.
204
+ */
205
+ astro?: 'prettier' | boolean;
200
206
  }
201
207
  interface OptionsComponentExts {
202
208
  /**
package/dist/index.d.ts CHANGED
@@ -197,6 +197,12 @@ interface OptionsFormatters {
197
197
  slidev?: boolean | {
198
198
  files?: string[];
199
199
  };
200
+ /**
201
+ * Enable formatting support for Astro.
202
+ *
203
+ * Currently only support Prettier.
204
+ */
205
+ astro?: 'prettier' | boolean;
200
206
  }
201
207
  interface OptionsComponentExts {
202
208
  /**
package/dist/index.js CHANGED
@@ -723,6 +723,7 @@ async function stylistic(options = {}) {
723
723
  async function formatters(options = {}, stylistic2 = {}) {
724
724
  if (options === true) {
725
725
  options = {
726
+ astro: isPackageExists2("astro"),
726
727
  css: true,
727
728
  graphql: true,
728
729
  html: true,
@@ -732,7 +733,8 @@ async function formatters(options = {}, stylistic2 = {}) {
732
733
  }
733
734
  await ensurePackages([
734
735
  "eslint-plugin-format",
735
- options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0
736
+ options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
737
+ options.astro ? "prettier-plugin-astro" : void 0
736
738
  ]);
737
739
  if (options.slidev && options.markdown !== true && options.markdown !== "prettier")
738
740
  throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
@@ -891,6 +893,27 @@ async function formatters(options = {}, stylistic2 = {}) {
891
893
  });
892
894
  }
893
895
  }
896
+ if (options.astro) {
897
+ configs.push({
898
+ files: [GLOB_ASTRO],
899
+ languageOptions: {
900
+ parser: parserPlain
901
+ },
902
+ name: "antfu:formatter:astro",
903
+ rules: {
904
+ "format/prettier": [
905
+ "error",
906
+ {
907
+ ...prettierOptions,
908
+ parser: "astro",
909
+ plugins: [
910
+ "prettier-plugin-astro"
911
+ ]
912
+ }
913
+ ]
914
+ }
915
+ });
916
+ }
894
917
  if (options.graphql) {
895
918
  configs.push({
896
919
  files: ["**/*.graphql"],
@@ -1890,7 +1913,13 @@ async function astro(options = {}) {
1890
1913
  rules: {
1891
1914
  "astro/no-set-html-directive": "off",
1892
1915
  "astro/semi": "off",
1893
- ...stylistic2 ? {} : {},
1916
+ ...stylistic2 ? {
1917
+ "style/indent": "off",
1918
+ "style/jsx-closing-tag-location": "off",
1919
+ "style/jsx-indent": "off",
1920
+ "style/jsx-one-expression-per-line": "off",
1921
+ "style/no-multiple-empty-lines": "off"
1922
+ } : {},
1894
1923
  ...overrides
1895
1924
  }
1896
1925
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antfu/eslint-config",
3
3
  "type": "module",
4
- "version": "2.7.0",
4
+ "version": "2.8.0",
5
5
  "packageManager": "pnpm@8.15.4",
6
6
  "description": "Anthony's ESLint config",
7
7
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -34,6 +34,7 @@
34
34
  "eslint-plugin-react-hooks": "^4.6.0",
35
35
  "eslint-plugin-react-refresh": "^0.4.4",
36
36
  "eslint-plugin-svelte": "^2.34.1",
37
+ "prettier-plugin-astro": "^0.13.0",
37
38
  "prettier-plugin-slidev": "^1.0.5",
38
39
  "svelte-eslint-parser": "^0.33.1"
39
40
  },
@@ -62,6 +63,9 @@
62
63
  "eslint-plugin-svelte": {
63
64
  "optional": true
64
65
  },
66
+ "prettier-plugin-astro": {
67
+ "optional": true
68
+ },
65
69
  "prettier-plugin-slidev": {
66
70
  "optional": true
67
71
  },
@@ -76,8 +80,8 @@
76
80
  "@eslint-types/typescript-eslint": "^7.0.2",
77
81
  "@eslint-types/unicorn": "^51.0.1",
78
82
  "@stylistic/eslint-plugin": "^1.6.3",
79
- "@typescript-eslint/eslint-plugin": "^7.1.0",
80
- "@typescript-eslint/parser": "^7.1.0",
83
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
84
+ "@typescript-eslint/parser": "^7.1.1",
81
85
  "eslint-config-flat-gitignore": "^0.1.3",
82
86
  "eslint-merge-processors": "^0.1.0",
83
87
  "eslint-plugin-antfu": "^2.1.2",
@@ -118,31 +122,32 @@
118
122
  "@types/yargs": "^17.0.32",
119
123
  "@unocss/eslint-plugin": "^0.58.5",
120
124
  "astro-eslint-parser": "^0.16.3",
121
- "bumpp": "^9.3.0",
122
- "eslint": "npm:eslint-ts-patch@^8.56.0-0",
125
+ "bumpp": "^9.4.0",
126
+ "eslint": "npm:eslint-ts-patch@^8.57.0-0",
123
127
  "eslint-flat-config-viewer": "^0.1.11",
124
128
  "eslint-plugin-astro": "^0.31.4",
125
129
  "eslint-plugin-format": "^0.1.0",
126
- "eslint-plugin-react": "^7.33.2",
130
+ "eslint-plugin-react": "^7.34.0",
127
131
  "eslint-plugin-react-hooks": "^4.6.0",
128
132
  "eslint-plugin-react-refresh": "^0.4.5",
129
133
  "eslint-plugin-svelte": "^2.35.1",
130
- "eslint-ts-patch": "^8.56.0-0",
131
- "esno": "^4.0.0",
134
+ "eslint-ts-patch": "^8.57.0-0",
135
+ "esno": "^4.7.0",
132
136
  "execa": "^8.0.1",
133
137
  "fast-glob": "^3.3.2",
134
138
  "fs-extra": "^11.2.0",
135
139
  "lint-staged": "^15.2.2",
140
+ "prettier-plugin-astro": "^0.13.0",
136
141
  "prettier-plugin-slidev": "^1.0.5",
137
142
  "rimraf": "^5.0.5",
138
- "simple-git-hooks": "^2.9.0",
143
+ "simple-git-hooks": "^2.10.0",
139
144
  "svelte": "^4.2.12",
140
145
  "svelte-eslint-parser": "^0.33.1",
141
146
  "tsup": "^8.0.2",
142
147
  "typescript": "^5.3.3",
143
148
  "vitest": "^1.3.1",
144
149
  "vue": "^3.4.21",
145
- "@antfu/eslint-config": "2.7.0"
150
+ "@antfu/eslint-config": "2.8.0"
146
151
  },
147
152
  "simple-git-hooks": {
148
153
  "pre-commit": "pnpm lint-staged"