@antfu/eslint-config 2.3.0 → 2.3.1

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
@@ -120,6 +120,7 @@ Add the following settings to your `.vscode/settings.json`:
120
120
  // Silent the stylistic rules in you IDE, but still auto fix them
121
121
  "eslint.rules.customizations": [
122
122
  { "rule": "style/*", "severity": "off" },
123
+ { "rule": "format/*", "severity": "off" },
123
124
  { "rule": "*-indent", "severity": "off" },
124
125
  { "rule": "*-spacing", "severity": "off" },
125
126
  { "rule": "*-spaces", "severity": "off" },
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.1";
50
50
  var devDependencies = {
51
51
  "@antfu/eslint-config": "workspace:*",
52
52
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
@@ -100,7 +100,7 @@ var vscodeSettingsString = `
100
100
  // Silent the stylistic rules in you IDE, but still auto fix them
101
101
  "eslint.rules.customizations": [
102
102
  { "rule": "style/*", "severity": "off" },
103
- { "rule": "prettier/*", "severity": "off" },
103
+ { "rule": "format/*", "severity": "off" },
104
104
  { "rule": "*-indent", "severity": "off" },
105
105
  { "rule": "*-spacing", "severity": "off" },
106
106
  { "rule": "*-spaces", "severity": "off" },
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.1";
21
21
  var devDependencies = {
22
22
  "@antfu/eslint-config": "workspace:*",
23
23
  "@antfu/eslint-plugin-prettier": "^5.0.1-1",
@@ -71,7 +71,7 @@ var vscodeSettingsString = `
71
71
  // Silent the stylistic rules in you IDE, but still auto fix them
72
72
  "eslint.rules.customizations": [
73
73
  { "rule": "style/*", "severity": "off" },
74
- { "rule": "prettier/*", "severity": "off" },
74
+ { "rule": "format/*", "severity": "off" },
75
75
  { "rule": "*-indent", "severity": "off" },
76
76
  { "rule": "*-spacing", "severity": "off" },
77
77
  { "rule": "*-spaces", "severity": "off" },
package/dist/index.cjs CHANGED
@@ -782,6 +782,15 @@ async function formatters(options = {}, stylistic2 = {}) {
782
782
  await ensurePackages([
783
783
  "eslint-plugin-format"
784
784
  ]);
785
+ if (options === true) {
786
+ options = {
787
+ css: true,
788
+ graphql: true,
789
+ html: true,
790
+ markdown: true,
791
+ toml: true
792
+ };
793
+ }
785
794
  const {
786
795
  indent,
787
796
  quotes,
@@ -928,6 +937,24 @@ async function formatters(options = {}, stylistic2 = {}) {
928
937
  }
929
938
  });
930
939
  }
940
+ if (options.graphql) {
941
+ configs.push({
942
+ files: ["**/*.graphql"],
943
+ languageOptions: {
944
+ parser: pluginFormat.parserPlain
945
+ },
946
+ name: "antfu:formatter:graphql",
947
+ rules: {
948
+ "format/prettier": [
949
+ "error",
950
+ {
951
+ ...prettierOptions,
952
+ parser: "graphql"
953
+ }
954
+ ]
955
+ }
956
+ });
957
+ }
931
958
  return configs;
932
959
  }
933
960
 
@@ -1794,7 +1821,7 @@ async function antfu(options = {}, ...userConfigs) {
1794
1821
  componentExts,
1795
1822
  overrides: overrides.markdown
1796
1823
  },
1797
- !!options.formatters?.markdown
1824
+ options.formatters === true || !!(options.formatters || {})?.markdown
1798
1825
  )
1799
1826
  );
1800
1827
  }
package/dist/index.d.cts CHANGED
@@ -157,6 +157,10 @@ interface OptionsFormatters {
157
157
  * When set to `true`, it will use Prettier.
158
158
  */
159
159
  markdown?: 'prettier' | 'dprint' | boolean;
160
+ /**
161
+ * Enable formatting support for GraphQL.
162
+ */
163
+ graphql?: 'prettier' | boolean;
160
164
  /**
161
165
  * Custom options for Prettier.
162
166
  *
@@ -306,9 +310,11 @@ interface OptionsConfig extends OptionsComponentExts {
306
310
  * Requires installing:
307
311
  * - `eslint-plugin-format`
308
312
  *
313
+ * When set to `true`, it will enable all formatters.
314
+ *
309
315
  * @default false
310
316
  */
311
- formatters?: OptionsFormatters;
317
+ formatters?: boolean | OptionsFormatters;
312
318
  /**
313
319
  * Control to disable some rules in editors.
314
320
  * @default auto-detect based on the process.env
@@ -357,7 +363,7 @@ declare function node(): Promise<FlatConfigItem[]>;
357
363
  */
358
364
  declare function perfectionist(): Promise<FlatConfigItem[]>;
359
365
 
360
- declare function formatters(options?: OptionsFormatters, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
366
+ declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
361
367
 
362
368
  declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
363
369
 
package/dist/index.d.ts CHANGED
@@ -157,6 +157,10 @@ interface OptionsFormatters {
157
157
  * When set to `true`, it will use Prettier.
158
158
  */
159
159
  markdown?: 'prettier' | 'dprint' | boolean;
160
+ /**
161
+ * Enable formatting support for GraphQL.
162
+ */
163
+ graphql?: 'prettier' | boolean;
160
164
  /**
161
165
  * Custom options for Prettier.
162
166
  *
@@ -306,9 +310,11 @@ interface OptionsConfig extends OptionsComponentExts {
306
310
  * Requires installing:
307
311
  * - `eslint-plugin-format`
308
312
  *
313
+ * When set to `true`, it will enable all formatters.
314
+ *
309
315
  * @default false
310
316
  */
311
- formatters?: OptionsFormatters;
317
+ formatters?: boolean | OptionsFormatters;
312
318
  /**
313
319
  * Control to disable some rules in editors.
314
320
  * @default auto-detect based on the process.env
@@ -357,7 +363,7 @@ declare function node(): Promise<FlatConfigItem[]>;
357
363
  */
358
364
  declare function perfectionist(): Promise<FlatConfigItem[]>;
359
365
 
360
- declare function formatters(options?: OptionsFormatters, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
366
+ declare function formatters(options?: OptionsFormatters | true, stylistic?: StylisticConfig): Promise<FlatConfigItem[]>;
361
367
 
362
368
  declare function react(options?: OptionsHasTypeScript & OptionsOverrides & OptionsFiles): Promise<FlatConfigItem[]>;
363
369
 
package/dist/index.js CHANGED
@@ -696,6 +696,15 @@ async function formatters(options = {}, stylistic2 = {}) {
696
696
  await ensurePackages([
697
697
  "eslint-plugin-format"
698
698
  ]);
699
+ if (options === true) {
700
+ options = {
701
+ css: true,
702
+ graphql: true,
703
+ html: true,
704
+ markdown: true,
705
+ toml: true
706
+ };
707
+ }
699
708
  const {
700
709
  indent,
701
710
  quotes,
@@ -842,6 +851,24 @@ async function formatters(options = {}, stylistic2 = {}) {
842
851
  }
843
852
  });
844
853
  }
854
+ if (options.graphql) {
855
+ configs.push({
856
+ files: ["**/*.graphql"],
857
+ languageOptions: {
858
+ parser: pluginFormat.parserPlain
859
+ },
860
+ name: "antfu:formatter:graphql",
861
+ rules: {
862
+ "format/prettier": [
863
+ "error",
864
+ {
865
+ ...prettierOptions,
866
+ parser: "graphql"
867
+ }
868
+ ]
869
+ }
870
+ });
871
+ }
845
872
  return configs;
846
873
  }
847
874
 
@@ -1708,7 +1735,7 @@ async function antfu(options = {}, ...userConfigs) {
1708
1735
  componentExts,
1709
1736
  overrides: overrides.markdown
1710
1737
  },
1711
- !!options.formatters?.markdown
1738
+ options.formatters === true || !!(options.formatters || {})?.markdown
1712
1739
  )
1713
1740
  );
1714
1741
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antfu/eslint-config",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "packageManager": "pnpm@8.11.0",
6
6
  "description": "Anthony's ESLint config",
7
7
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
@@ -110,7 +110,7 @@
110
110
  "tsup": "^8.0.1",
111
111
  "typescript": "^5.3.2",
112
112
  "vitest": "^0.34.6",
113
- "@antfu/eslint-config": "2.3.0"
113
+ "@antfu/eslint-config": "2.3.1"
114
114
  },
115
115
  "simple-git-hooks": {
116
116
  "pre-commit": "pnpm lint-staged"