@hexadrop/eslint-config 0.0.1-beta.2 → 0.0.1-beta.4

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.cjs CHANGED
@@ -874,6 +874,7 @@ async function typescript(options) {
874
874
  var IMPORTS_CONFIG_NAME = `${plugin_prefix_default}/imports`;
875
875
  var IMPORTS_CONFIG_NAME_SETUP = `${IMPORTS_CONFIG_NAME}/setup`;
876
876
  var IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT = `${IMPORTS_CONFIG_NAME_SETUP}/typescript`;
877
+ var IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT_DTS = `${IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT}/dts`;
877
878
  var IMPORTS_CONFIG_NAME_RULES = `${IMPORTS_CONFIG_NAME}/rules`;
878
879
  var IMPORTS_CONFIG_NAME_RULES_WARNINGS = `${IMPORTS_CONFIG_NAME_RULES}/warnings`;
879
880
  var IMPORTS_CONFIG_NAME_RULES_WARNINGS_ESLINT_CONFIG = `${IMPORTS_CONFIG_NAME_RULES_WARNINGS}/eslint-config`;
@@ -920,23 +921,32 @@ async function imports(options) {
920
921
  if (typescript2) {
921
922
  const typeScriptExtensions = [".ts", ".tsx"];
922
923
  const allExtensions = [...typeScriptExtensions, ".js", ".jsx"];
923
- configs.push({
924
- files: TYPESCRIPT_GLOBS,
925
- name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT,
926
- settings: {
927
- [`${importXPlugin}/extensions`]: typeScriptExtensions,
928
- [`${importXPlugin}/external-module-folders`]: ["node_modules", "node_modules/@types"],
929
- [`${importXPlugin}/parsers`]: {
930
- "@typescript-eslint/parser": [...typeScriptExtensions, ".cts", ".mts"]
931
- },
932
- [`${importXPlugin}/resolver`]: {
933
- node: {
934
- extensions: allExtensions
924
+ configs.push(
925
+ {
926
+ files: TYPESCRIPT_GLOBS,
927
+ name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT,
928
+ settings: {
929
+ [`${importXPlugin}/extensions`]: typeScriptExtensions,
930
+ [`${importXPlugin}/external-module-folders`]: ["node_modules", "node_modules/@types"],
931
+ [`${importXPlugin}/parsers`]: {
932
+ "@typescript-eslint/parser": [...typeScriptExtensions, ".cts", ".mts"]
935
933
  },
936
- typescript: true
934
+ [`${importXPlugin}/resolver`]: {
935
+ node: {
936
+ extensions: allExtensions
937
+ },
938
+ typescript: true
939
+ }
940
+ }
941
+ },
942
+ {
943
+ files: DTS_GLOBS,
944
+ name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT_DTS,
945
+ settings: {
946
+ [`${importXPlugin}/prefer-default-export`]: "off"
937
947
  }
938
948
  }
939
- });
949
+ );
940
950
  }
941
951
  configs.push(
942
952
  {
@@ -1883,13 +1893,19 @@ function defaultOptions(options = {}) {
1883
1893
  } else if (installedTypescript) {
1884
1894
  if (options.typescript === void 0) {
1885
1895
  typescript2 = getCwdTsconfigPath() ?? true;
1886
- } else if (options.typescript === "string" || Array.isArray(options.typescript)) {
1896
+ } else if (options.typescript === "string") {
1887
1897
  typescript2 = options.typescript.length > 0 ? options.typescript : true;
1898
+ } else if (Array.isArray(options.typescript)) {
1899
+ typescript2 = options.typescript.length > 0 ? options.typescript.filter(Boolean) : true;
1888
1900
  }
1889
1901
  }
1890
1902
  return {
1891
1903
  astro: options.astro ?? installedAstro,
1892
- ignore: options.ignore ?? true,
1904
+ ignore: typeof options.ignore === "object" ? {
1905
+ ...options.ignore,
1906
+ files: typeof options.ignore.files === "string" ? options.ignore.files : options.ignore.files?.filter(Boolean) ?? [],
1907
+ globs: options.ignore.globs?.filter(Boolean) ?? []
1908
+ } : options.ignore ?? true,
1893
1909
  imports: options.imports ?? true,
1894
1910
  json: options.json ?? true,
1895
1911
  markdown: options.markdown ?? true,
@@ -1899,7 +1915,11 @@ function defaultOptions(options = {}) {
1899
1915
  node: true,
1900
1916
  webpack: false,
1901
1917
  ...options.module,
1902
- ignore: [String.raw`bun\:.*`, String.raw`astro\:.*`, ...options.module?.ignore ?? []]
1918
+ ignore: [
1919
+ String.raw`bun\:.*`,
1920
+ String.raw`astro\:.*`,
1921
+ ...options.module?.ignore?.filter(Boolean) ?? []
1922
+ ]
1903
1923
  },
1904
1924
  node: options.node ?? true,
1905
1925
  react: options.react ?? installedReact,
package/dist/index.d.cts CHANGED
@@ -2,226 +2,6 @@ import { ResolvableFlatConfig, FlatConfigComposer } from 'eslint-flat-config-uti
2
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
3
  import { Linter } from 'eslint';
4
4
 
5
- interface HexadropEslintIgnoreOptions extends Omit<FlatGitignoreOptions, 'name'> {
6
- /**
7
- * Additional ignore patterns.
8
- */
9
- globs?: string[];
10
- }
11
-
12
- interface HexadropEslintModulesOptions {
13
- amd: boolean;
14
- commonjs: boolean;
15
- ignore: string[];
16
- /**
17
- * Enable use of core node modules.
18
- *
19
- * @default true
20
- */
21
- node: boolean;
22
- /**
23
- * Enable webpack support.
24
- *
25
- * @default false
26
- */
27
- webpack: boolean;
28
- }
29
-
30
- interface HexadropEslintStylisticOptions {
31
- /**
32
- * Include parentheses around a sole arrow function parameter.
33
- *
34
- * @default 'avoid'
35
- */
36
- arrowParens: 'always' | 'avoid';
37
- /**
38
- * Which brace style to use
39
- *
40
- * @default '1tbs'
41
- */
42
- braceStyle: '1tbs' | 'allman' | 'stroustrup';
43
- /**
44
- * Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element
45
- * at the end of the last line instead of being alone on the next line.
46
- *
47
- * @default true
48
- */
49
- bracketSameLine: boolean;
50
- /**
51
- * Use spaces between brackets in object literals.
52
- *
53
- * @default true
54
- */
55
- bracketSpacing: boolean;
56
- /**
57
- * End of line character.
58
- *
59
- * @default 'lf'
60
- */
61
- endOfLine: 'auto' | 'cr' | 'crlf' | 'lf';
62
- /**
63
- * Enable formatting rules.
64
- *
65
- * @default true
66
- */
67
- format: boolean;
68
- /**
69
- * Enable import rules.
70
- *
71
- * @default true
72
- */
73
- imports: boolean;
74
- /**
75
- * Indentation style.
76
- *
77
- * @default 'tab'
78
- */
79
- indent: 'space' | 'tab';
80
- /**
81
- * Number of spaces to use for indentation.
82
- *
83
- * @default 4
84
- */
85
- indentSize: number;
86
- /**
87
- * Enable perfectionist rules.
88
- *
89
- * @default true
90
- */
91
- perfectionist: boolean;
92
- /**
93
- * Specify the line length that the printer will wrap on.
94
- *
95
- * @default 120
96
- */
97
- printWidth: number;
98
- /**
99
- * Change when properties in objects are quoted.
100
- *
101
- * @default 'as-needed'
102
- */
103
- quoteProps: 'as-needed' | 'consistent' | 'preserve';
104
- /**
105
- * Quote style.
106
- *
107
- * @default 'single'
108
- */
109
- quotes: 'double' | 'single';
110
- /**
111
- * Use semicolons at the end of statements.
112
- *
113
- * @default true
114
- */
115
- semicolons: boolean;
116
- /**
117
- * Use single attribute per line in HTML, Vue and JSX.
118
- *
119
- * @default false
120
- */
121
- singleAttributePerLine: boolean;
122
- /**
123
- * Use trailing commas in multi-line object literals.
124
- *
125
- * @default 'es5'
126
- */
127
- trailingComma: 'all' | 'es5' | 'none';
128
- /**
129
- * Enable unicorn rules.
130
- *
131
- * @default true
132
- */
133
- unicorn: boolean;
134
- }
135
-
136
- interface HexadropEslintOptions {
137
- /**
138
- * Enable astro support.
139
- *
140
- * If `false`, astro support will be disabled.
141
- * If `true`, or empty it will be enabled.
142
- */
143
- astro: boolean;
144
- /**
145
- * Enable ignore support.
146
- *
147
- * Passing an object to configure the options.
148
- *
149
- * @see https://github.com/antfu/eslint-config-flat-gitignore
150
- *
151
- * @default true
152
- */
153
- ignore: HexadropEslintIgnoreOptions | boolean;
154
- /**
155
- * Enable import rules.
156
- *
157
- * @default true
158
- */
159
- imports: boolean;
160
- /**
161
- * Enable json support.
162
- *
163
- * @default true
164
- */
165
- json: boolean;
166
- /**
167
- * Enable markdown support.
168
- *
169
- * @default true
170
- */
171
- markdown: boolean;
172
- /**
173
- * Configure module imports.
174
- *
175
- * @default { amd: false, commonjs: false, node: true, webpack: false }
176
- */
177
- module: HexadropEslintModulesOptions;
178
- /**
179
- * Use node rules.
180
- *
181
- * @default true
182
- */
183
- node: boolean;
184
- /**
185
- * Enable react support.
186
- *
187
- * If `false`, react support will be disabled.
188
- * If `true`, or empty it will be enabled.
189
- */
190
- react: boolean;
191
- /**
192
- * Configure stylistic rules.
193
- *
194
- * @default {
195
- * arrowParens: 'avoid',
196
- * braceStyle: '1tbs',
197
- * bracketSameLine: true,
198
- * bracketSpacing: true,
199
- * endOfLine: 'lf',
200
- * format: true,
201
- * imports: true,
202
- * indent: 'tab',
203
- * indentSize: 4,
204
- * perfectionist: true,
205
- * quoteProps: 'as-needed',
206
- * quotes: 'single',
207
- * semicolons: true,
208
- * singleAttributePerLine: true,
209
- * trailingComma: 'es5',
210
- * unicorn: true,
211
- * }
212
- */
213
- stylistic: HexadropEslintStylisticOptions | false;
214
- /**
215
- * Configure typescript support.
216
- *
217
- * If `false`, typescript support will be disabled.
218
- * If `true`, typescript support will be enabled with default options.
219
- * If you leave empty, automatic detection will be used.
220
- *
221
- */
222
- typescript: boolean | string | string[];
223
- }
224
-
225
5
  type Awaitable<T> = Promise<T> | T;
226
6
 
227
7
  declare const ASTRO_CONFIG_NAME_SETUP: "hexadrop/astro/setup";
@@ -287,6 +67,10 @@ type TypescriptConfigNames = typeof TYPESCRIPT_CONFIG_NAME_RULES | typeof TYPESC
287
67
 
288
68
  type ConfigNames = AstroConfigNames | CoreConfigNames | IgnoreConfigNames | JsonConfigNames | MarkdownConfigNames | ReactConfigNames | StylisticConfigNames | TypescriptConfigNames;
289
69
 
70
+ type RecursivePartial<T> = {
71
+ [P in keyof T]?: RecursivePartial<T[P]>;
72
+ };
73
+
290
74
  /* eslint-disable */
291
75
  /* prettier-ignore */
292
76
 
@@ -10809,7 +10593,227 @@ type TypedFlatConfigItem = {
10809
10593
  rules?: Linter.RulesRecord & Rules;
10810
10594
  } & Linter.FlatConfig;
10811
10595
 
10812
- declare function hexadrop(optionsOrFlatConfigItem?: Partial<HexadropEslintOptions> & TypedFlatConfigItem, ...configs: ResolvableFlatConfig<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
10596
+ interface HexadropEslintIgnoreOptions extends Omit<FlatGitignoreOptions, 'name'> {
10597
+ /**
10598
+ * Additional ignore patterns.
10599
+ */
10600
+ globs?: string[];
10601
+ }
10602
+
10603
+ interface HexadropEslintModulesOptions {
10604
+ amd: boolean;
10605
+ commonjs: boolean;
10606
+ ignore: string[];
10607
+ /**
10608
+ * Enable use of core node modules.
10609
+ *
10610
+ * @default true
10611
+ */
10612
+ node: boolean;
10613
+ /**
10614
+ * Enable webpack support.
10615
+ *
10616
+ * @default false
10617
+ */
10618
+ webpack: boolean;
10619
+ }
10620
+
10621
+ interface HexadropEslintStylisticOptions {
10622
+ /**
10623
+ * Include parentheses around a sole arrow function parameter.
10624
+ *
10625
+ * @default 'avoid'
10626
+ */
10627
+ arrowParens: 'always' | 'avoid';
10628
+ /**
10629
+ * Which brace style to use
10630
+ *
10631
+ * @default '1tbs'
10632
+ */
10633
+ braceStyle: '1tbs' | 'allman' | 'stroustrup';
10634
+ /**
10635
+ * Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element
10636
+ * at the end of the last line instead of being alone on the next line.
10637
+ *
10638
+ * @default true
10639
+ */
10640
+ bracketSameLine: boolean;
10641
+ /**
10642
+ * Use spaces between brackets in object literals.
10643
+ *
10644
+ * @default true
10645
+ */
10646
+ bracketSpacing: boolean;
10647
+ /**
10648
+ * End of line character.
10649
+ *
10650
+ * @default 'lf'
10651
+ */
10652
+ endOfLine: 'auto' | 'cr' | 'crlf' | 'lf';
10653
+ /**
10654
+ * Enable formatting rules.
10655
+ *
10656
+ * @default true
10657
+ */
10658
+ format: boolean;
10659
+ /**
10660
+ * Enable import rules.
10661
+ *
10662
+ * @default true
10663
+ */
10664
+ imports: boolean;
10665
+ /**
10666
+ * Indentation style.
10667
+ *
10668
+ * @default 'tab'
10669
+ */
10670
+ indent: 'space' | 'tab';
10671
+ /**
10672
+ * Number of spaces to use for indentation.
10673
+ *
10674
+ * @default 4
10675
+ */
10676
+ indentSize: number;
10677
+ /**
10678
+ * Enable perfectionist rules.
10679
+ *
10680
+ * @default true
10681
+ */
10682
+ perfectionist: boolean;
10683
+ /**
10684
+ * Specify the line length that the printer will wrap on.
10685
+ *
10686
+ * @default 120
10687
+ */
10688
+ printWidth: number;
10689
+ /**
10690
+ * Change when properties in objects are quoted.
10691
+ *
10692
+ * @default 'as-needed'
10693
+ */
10694
+ quoteProps: 'as-needed' | 'consistent' | 'preserve';
10695
+ /**
10696
+ * Quote style.
10697
+ *
10698
+ * @default 'single'
10699
+ */
10700
+ quotes: 'double' | 'single';
10701
+ /**
10702
+ * Use semicolons at the end of statements.
10703
+ *
10704
+ * @default true
10705
+ */
10706
+ semicolons: boolean;
10707
+ /**
10708
+ * Use single attribute per line in HTML, Vue and JSX.
10709
+ *
10710
+ * @default false
10711
+ */
10712
+ singleAttributePerLine: boolean;
10713
+ /**
10714
+ * Use trailing commas in multi-line object literals.
10715
+ *
10716
+ * @default 'es5'
10717
+ */
10718
+ trailingComma: 'all' | 'es5' | 'none';
10719
+ /**
10720
+ * Enable unicorn rules.
10721
+ *
10722
+ * @default true
10723
+ */
10724
+ unicorn: boolean;
10725
+ }
10726
+
10727
+ interface HexadropEslintOptions {
10728
+ /**
10729
+ * Enable astro support.
10730
+ *
10731
+ * If `false`, astro support will be disabled.
10732
+ * If `true`, or empty it will be enabled.
10733
+ */
10734
+ astro: boolean;
10735
+ /**
10736
+ * Enable ignore support.
10737
+ *
10738
+ * Passing an object to configure the options.
10739
+ *
10740
+ * @see https://github.com/antfu/eslint-config-flat-gitignore
10741
+ *
10742
+ * @default true
10743
+ */
10744
+ ignore: HexadropEslintIgnoreOptions | boolean;
10745
+ /**
10746
+ * Enable import rules.
10747
+ *
10748
+ * @default true
10749
+ */
10750
+ imports: boolean;
10751
+ /**
10752
+ * Enable json support.
10753
+ *
10754
+ * @default true
10755
+ */
10756
+ json: boolean;
10757
+ /**
10758
+ * Enable markdown support.
10759
+ *
10760
+ * @default true
10761
+ */
10762
+ markdown: boolean;
10763
+ /**
10764
+ * Configure module imports.
10765
+ *
10766
+ * @default { amd: false, commonjs: false, node: true, webpack: false }
10767
+ */
10768
+ module: HexadropEslintModulesOptions;
10769
+ /**
10770
+ * Use node rules.
10771
+ *
10772
+ * @default true
10773
+ */
10774
+ node: boolean;
10775
+ /**
10776
+ * Enable react support.
10777
+ *
10778
+ * If `false`, react support will be disabled.
10779
+ * If `true`, or empty it will be enabled.
10780
+ */
10781
+ react: boolean;
10782
+ /**
10783
+ * Configure stylistic rules.
10784
+ *
10785
+ * @default {
10786
+ * arrowParens: 'avoid',
10787
+ * braceStyle: '1tbs',
10788
+ * bracketSameLine: true,
10789
+ * bracketSpacing: true,
10790
+ * endOfLine: 'lf',
10791
+ * format: true,
10792
+ * imports: true,
10793
+ * indent: 'tab',
10794
+ * indentSize: 4,
10795
+ * perfectionist: true,
10796
+ * quoteProps: 'as-needed',
10797
+ * quotes: 'single',
10798
+ * semicolons: true,
10799
+ * singleAttributePerLine: true,
10800
+ * trailingComma: 'es5',
10801
+ * unicorn: true,
10802
+ * }
10803
+ */
10804
+ stylistic: HexadropEslintStylisticOptions | false;
10805
+ /**
10806
+ * Configure typescript support.
10807
+ *
10808
+ * If `false`, typescript support will be disabled.
10809
+ * If `true`, typescript support will be enabled with default options.
10810
+ * If you leave empty, automatic detection will be used.
10811
+ *
10812
+ */
10813
+ typescript: boolean | string | string[];
10814
+ }
10815
+
10816
+ declare function hexadrop(optionsOrFlatConfigItem?: RecursivePartial<HexadropEslintOptions> & TypedFlatConfigItem, ...configs: ResolvableFlatConfig<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
10813
10817
 
10814
10818
  /**
10815
10819
  * Combine array and non-array configs into a single array.
package/dist/index.d.ts CHANGED
@@ -2,226 +2,6 @@ import { ResolvableFlatConfig, FlatConfigComposer } from 'eslint-flat-config-uti
2
2
  import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
3
3
  import { Linter } from 'eslint';
4
4
 
5
- interface HexadropEslintIgnoreOptions extends Omit<FlatGitignoreOptions, 'name'> {
6
- /**
7
- * Additional ignore patterns.
8
- */
9
- globs?: string[];
10
- }
11
-
12
- interface HexadropEslintModulesOptions {
13
- amd: boolean;
14
- commonjs: boolean;
15
- ignore: string[];
16
- /**
17
- * Enable use of core node modules.
18
- *
19
- * @default true
20
- */
21
- node: boolean;
22
- /**
23
- * Enable webpack support.
24
- *
25
- * @default false
26
- */
27
- webpack: boolean;
28
- }
29
-
30
- interface HexadropEslintStylisticOptions {
31
- /**
32
- * Include parentheses around a sole arrow function parameter.
33
- *
34
- * @default 'avoid'
35
- */
36
- arrowParens: 'always' | 'avoid';
37
- /**
38
- * Which brace style to use
39
- *
40
- * @default '1tbs'
41
- */
42
- braceStyle: '1tbs' | 'allman' | 'stroustrup';
43
- /**
44
- * Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element
45
- * at the end of the last line instead of being alone on the next line.
46
- *
47
- * @default true
48
- */
49
- bracketSameLine: boolean;
50
- /**
51
- * Use spaces between brackets in object literals.
52
- *
53
- * @default true
54
- */
55
- bracketSpacing: boolean;
56
- /**
57
- * End of line character.
58
- *
59
- * @default 'lf'
60
- */
61
- endOfLine: 'auto' | 'cr' | 'crlf' | 'lf';
62
- /**
63
- * Enable formatting rules.
64
- *
65
- * @default true
66
- */
67
- format: boolean;
68
- /**
69
- * Enable import rules.
70
- *
71
- * @default true
72
- */
73
- imports: boolean;
74
- /**
75
- * Indentation style.
76
- *
77
- * @default 'tab'
78
- */
79
- indent: 'space' | 'tab';
80
- /**
81
- * Number of spaces to use for indentation.
82
- *
83
- * @default 4
84
- */
85
- indentSize: number;
86
- /**
87
- * Enable perfectionist rules.
88
- *
89
- * @default true
90
- */
91
- perfectionist: boolean;
92
- /**
93
- * Specify the line length that the printer will wrap on.
94
- *
95
- * @default 120
96
- */
97
- printWidth: number;
98
- /**
99
- * Change when properties in objects are quoted.
100
- *
101
- * @default 'as-needed'
102
- */
103
- quoteProps: 'as-needed' | 'consistent' | 'preserve';
104
- /**
105
- * Quote style.
106
- *
107
- * @default 'single'
108
- */
109
- quotes: 'double' | 'single';
110
- /**
111
- * Use semicolons at the end of statements.
112
- *
113
- * @default true
114
- */
115
- semicolons: boolean;
116
- /**
117
- * Use single attribute per line in HTML, Vue and JSX.
118
- *
119
- * @default false
120
- */
121
- singleAttributePerLine: boolean;
122
- /**
123
- * Use trailing commas in multi-line object literals.
124
- *
125
- * @default 'es5'
126
- */
127
- trailingComma: 'all' | 'es5' | 'none';
128
- /**
129
- * Enable unicorn rules.
130
- *
131
- * @default true
132
- */
133
- unicorn: boolean;
134
- }
135
-
136
- interface HexadropEslintOptions {
137
- /**
138
- * Enable astro support.
139
- *
140
- * If `false`, astro support will be disabled.
141
- * If `true`, or empty it will be enabled.
142
- */
143
- astro: boolean;
144
- /**
145
- * Enable ignore support.
146
- *
147
- * Passing an object to configure the options.
148
- *
149
- * @see https://github.com/antfu/eslint-config-flat-gitignore
150
- *
151
- * @default true
152
- */
153
- ignore: HexadropEslintIgnoreOptions | boolean;
154
- /**
155
- * Enable import rules.
156
- *
157
- * @default true
158
- */
159
- imports: boolean;
160
- /**
161
- * Enable json support.
162
- *
163
- * @default true
164
- */
165
- json: boolean;
166
- /**
167
- * Enable markdown support.
168
- *
169
- * @default true
170
- */
171
- markdown: boolean;
172
- /**
173
- * Configure module imports.
174
- *
175
- * @default { amd: false, commonjs: false, node: true, webpack: false }
176
- */
177
- module: HexadropEslintModulesOptions;
178
- /**
179
- * Use node rules.
180
- *
181
- * @default true
182
- */
183
- node: boolean;
184
- /**
185
- * Enable react support.
186
- *
187
- * If `false`, react support will be disabled.
188
- * If `true`, or empty it will be enabled.
189
- */
190
- react: boolean;
191
- /**
192
- * Configure stylistic rules.
193
- *
194
- * @default {
195
- * arrowParens: 'avoid',
196
- * braceStyle: '1tbs',
197
- * bracketSameLine: true,
198
- * bracketSpacing: true,
199
- * endOfLine: 'lf',
200
- * format: true,
201
- * imports: true,
202
- * indent: 'tab',
203
- * indentSize: 4,
204
- * perfectionist: true,
205
- * quoteProps: 'as-needed',
206
- * quotes: 'single',
207
- * semicolons: true,
208
- * singleAttributePerLine: true,
209
- * trailingComma: 'es5',
210
- * unicorn: true,
211
- * }
212
- */
213
- stylistic: HexadropEslintStylisticOptions | false;
214
- /**
215
- * Configure typescript support.
216
- *
217
- * If `false`, typescript support will be disabled.
218
- * If `true`, typescript support will be enabled with default options.
219
- * If you leave empty, automatic detection will be used.
220
- *
221
- */
222
- typescript: boolean | string | string[];
223
- }
224
-
225
5
  type Awaitable<T> = Promise<T> | T;
226
6
 
227
7
  declare const ASTRO_CONFIG_NAME_SETUP: "hexadrop/astro/setup";
@@ -287,6 +67,10 @@ type TypescriptConfigNames = typeof TYPESCRIPT_CONFIG_NAME_RULES | typeof TYPESC
287
67
 
288
68
  type ConfigNames = AstroConfigNames | CoreConfigNames | IgnoreConfigNames | JsonConfigNames | MarkdownConfigNames | ReactConfigNames | StylisticConfigNames | TypescriptConfigNames;
289
69
 
70
+ type RecursivePartial<T> = {
71
+ [P in keyof T]?: RecursivePartial<T[P]>;
72
+ };
73
+
290
74
  /* eslint-disable */
291
75
  /* prettier-ignore */
292
76
 
@@ -10809,7 +10593,227 @@ type TypedFlatConfigItem = {
10809
10593
  rules?: Linter.RulesRecord & Rules;
10810
10594
  } & Linter.FlatConfig;
10811
10595
 
10812
- declare function hexadrop(optionsOrFlatConfigItem?: Partial<HexadropEslintOptions> & TypedFlatConfigItem, ...configs: ResolvableFlatConfig<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
10596
+ interface HexadropEslintIgnoreOptions extends Omit<FlatGitignoreOptions, 'name'> {
10597
+ /**
10598
+ * Additional ignore patterns.
10599
+ */
10600
+ globs?: string[];
10601
+ }
10602
+
10603
+ interface HexadropEslintModulesOptions {
10604
+ amd: boolean;
10605
+ commonjs: boolean;
10606
+ ignore: string[];
10607
+ /**
10608
+ * Enable use of core node modules.
10609
+ *
10610
+ * @default true
10611
+ */
10612
+ node: boolean;
10613
+ /**
10614
+ * Enable webpack support.
10615
+ *
10616
+ * @default false
10617
+ */
10618
+ webpack: boolean;
10619
+ }
10620
+
10621
+ interface HexadropEslintStylisticOptions {
10622
+ /**
10623
+ * Include parentheses around a sole arrow function parameter.
10624
+ *
10625
+ * @default 'avoid'
10626
+ */
10627
+ arrowParens: 'always' | 'avoid';
10628
+ /**
10629
+ * Which brace style to use
10630
+ *
10631
+ * @default '1tbs'
10632
+ */
10633
+ braceStyle: '1tbs' | 'allman' | 'stroustrup';
10634
+ /**
10635
+ * Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element
10636
+ * at the end of the last line instead of being alone on the next line.
10637
+ *
10638
+ * @default true
10639
+ */
10640
+ bracketSameLine: boolean;
10641
+ /**
10642
+ * Use spaces between brackets in object literals.
10643
+ *
10644
+ * @default true
10645
+ */
10646
+ bracketSpacing: boolean;
10647
+ /**
10648
+ * End of line character.
10649
+ *
10650
+ * @default 'lf'
10651
+ */
10652
+ endOfLine: 'auto' | 'cr' | 'crlf' | 'lf';
10653
+ /**
10654
+ * Enable formatting rules.
10655
+ *
10656
+ * @default true
10657
+ */
10658
+ format: boolean;
10659
+ /**
10660
+ * Enable import rules.
10661
+ *
10662
+ * @default true
10663
+ */
10664
+ imports: boolean;
10665
+ /**
10666
+ * Indentation style.
10667
+ *
10668
+ * @default 'tab'
10669
+ */
10670
+ indent: 'space' | 'tab';
10671
+ /**
10672
+ * Number of spaces to use for indentation.
10673
+ *
10674
+ * @default 4
10675
+ */
10676
+ indentSize: number;
10677
+ /**
10678
+ * Enable perfectionist rules.
10679
+ *
10680
+ * @default true
10681
+ */
10682
+ perfectionist: boolean;
10683
+ /**
10684
+ * Specify the line length that the printer will wrap on.
10685
+ *
10686
+ * @default 120
10687
+ */
10688
+ printWidth: number;
10689
+ /**
10690
+ * Change when properties in objects are quoted.
10691
+ *
10692
+ * @default 'as-needed'
10693
+ */
10694
+ quoteProps: 'as-needed' | 'consistent' | 'preserve';
10695
+ /**
10696
+ * Quote style.
10697
+ *
10698
+ * @default 'single'
10699
+ */
10700
+ quotes: 'double' | 'single';
10701
+ /**
10702
+ * Use semicolons at the end of statements.
10703
+ *
10704
+ * @default true
10705
+ */
10706
+ semicolons: boolean;
10707
+ /**
10708
+ * Use single attribute per line in HTML, Vue and JSX.
10709
+ *
10710
+ * @default false
10711
+ */
10712
+ singleAttributePerLine: boolean;
10713
+ /**
10714
+ * Use trailing commas in multi-line object literals.
10715
+ *
10716
+ * @default 'es5'
10717
+ */
10718
+ trailingComma: 'all' | 'es5' | 'none';
10719
+ /**
10720
+ * Enable unicorn rules.
10721
+ *
10722
+ * @default true
10723
+ */
10724
+ unicorn: boolean;
10725
+ }
10726
+
10727
+ interface HexadropEslintOptions {
10728
+ /**
10729
+ * Enable astro support.
10730
+ *
10731
+ * If `false`, astro support will be disabled.
10732
+ * If `true`, or empty it will be enabled.
10733
+ */
10734
+ astro: boolean;
10735
+ /**
10736
+ * Enable ignore support.
10737
+ *
10738
+ * Passing an object to configure the options.
10739
+ *
10740
+ * @see https://github.com/antfu/eslint-config-flat-gitignore
10741
+ *
10742
+ * @default true
10743
+ */
10744
+ ignore: HexadropEslintIgnoreOptions | boolean;
10745
+ /**
10746
+ * Enable import rules.
10747
+ *
10748
+ * @default true
10749
+ */
10750
+ imports: boolean;
10751
+ /**
10752
+ * Enable json support.
10753
+ *
10754
+ * @default true
10755
+ */
10756
+ json: boolean;
10757
+ /**
10758
+ * Enable markdown support.
10759
+ *
10760
+ * @default true
10761
+ */
10762
+ markdown: boolean;
10763
+ /**
10764
+ * Configure module imports.
10765
+ *
10766
+ * @default { amd: false, commonjs: false, node: true, webpack: false }
10767
+ */
10768
+ module: HexadropEslintModulesOptions;
10769
+ /**
10770
+ * Use node rules.
10771
+ *
10772
+ * @default true
10773
+ */
10774
+ node: boolean;
10775
+ /**
10776
+ * Enable react support.
10777
+ *
10778
+ * If `false`, react support will be disabled.
10779
+ * If `true`, or empty it will be enabled.
10780
+ */
10781
+ react: boolean;
10782
+ /**
10783
+ * Configure stylistic rules.
10784
+ *
10785
+ * @default {
10786
+ * arrowParens: 'avoid',
10787
+ * braceStyle: '1tbs',
10788
+ * bracketSameLine: true,
10789
+ * bracketSpacing: true,
10790
+ * endOfLine: 'lf',
10791
+ * format: true,
10792
+ * imports: true,
10793
+ * indent: 'tab',
10794
+ * indentSize: 4,
10795
+ * perfectionist: true,
10796
+ * quoteProps: 'as-needed',
10797
+ * quotes: 'single',
10798
+ * semicolons: true,
10799
+ * singleAttributePerLine: true,
10800
+ * trailingComma: 'es5',
10801
+ * unicorn: true,
10802
+ * }
10803
+ */
10804
+ stylistic: HexadropEslintStylisticOptions | false;
10805
+ /**
10806
+ * Configure typescript support.
10807
+ *
10808
+ * If `false`, typescript support will be disabled.
10809
+ * If `true`, typescript support will be enabled with default options.
10810
+ * If you leave empty, automatic detection will be used.
10811
+ *
10812
+ */
10813
+ typescript: boolean | string | string[];
10814
+ }
10815
+
10816
+ declare function hexadrop(optionsOrFlatConfigItem?: RecursivePartial<HexadropEslintOptions> & TypedFlatConfigItem, ...configs: ResolvableFlatConfig<TypedFlatConfigItem>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
10813
10817
 
10814
10818
  /**
10815
10819
  * Combine array and non-array configs into a single array.
package/dist/index.js CHANGED
@@ -837,6 +837,7 @@ async function typescript(options) {
837
837
  var IMPORTS_CONFIG_NAME = `${plugin_prefix_default}/imports`;
838
838
  var IMPORTS_CONFIG_NAME_SETUP = `${IMPORTS_CONFIG_NAME}/setup`;
839
839
  var IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT = `${IMPORTS_CONFIG_NAME_SETUP}/typescript`;
840
+ var IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT_DTS = `${IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT}/dts`;
840
841
  var IMPORTS_CONFIG_NAME_RULES = `${IMPORTS_CONFIG_NAME}/rules`;
841
842
  var IMPORTS_CONFIG_NAME_RULES_WARNINGS = `${IMPORTS_CONFIG_NAME_RULES}/warnings`;
842
843
  var IMPORTS_CONFIG_NAME_RULES_WARNINGS_ESLINT_CONFIG = `${IMPORTS_CONFIG_NAME_RULES_WARNINGS}/eslint-config`;
@@ -883,23 +884,32 @@ async function imports(options) {
883
884
  if (typescript2) {
884
885
  const typeScriptExtensions = [".ts", ".tsx"];
885
886
  const allExtensions = [...typeScriptExtensions, ".js", ".jsx"];
886
- configs.push({
887
- files: TYPESCRIPT_GLOBS,
888
- name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT,
889
- settings: {
890
- [`${importXPlugin}/extensions`]: typeScriptExtensions,
891
- [`${importXPlugin}/external-module-folders`]: ["node_modules", "node_modules/@types"],
892
- [`${importXPlugin}/parsers`]: {
893
- "@typescript-eslint/parser": [...typeScriptExtensions, ".cts", ".mts"]
894
- },
895
- [`${importXPlugin}/resolver`]: {
896
- node: {
897
- extensions: allExtensions
887
+ configs.push(
888
+ {
889
+ files: TYPESCRIPT_GLOBS,
890
+ name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT,
891
+ settings: {
892
+ [`${importXPlugin}/extensions`]: typeScriptExtensions,
893
+ [`${importXPlugin}/external-module-folders`]: ["node_modules", "node_modules/@types"],
894
+ [`${importXPlugin}/parsers`]: {
895
+ "@typescript-eslint/parser": [...typeScriptExtensions, ".cts", ".mts"]
898
896
  },
899
- typescript: true
897
+ [`${importXPlugin}/resolver`]: {
898
+ node: {
899
+ extensions: allExtensions
900
+ },
901
+ typescript: true
902
+ }
903
+ }
904
+ },
905
+ {
906
+ files: DTS_GLOBS,
907
+ name: IMPORTS_CONFIG_NAME_SETUP_TYPESCRIPT_DTS,
908
+ settings: {
909
+ [`${importXPlugin}/prefer-default-export`]: "off"
900
910
  }
901
911
  }
902
- });
912
+ );
903
913
  }
904
914
  configs.push(
905
915
  {
@@ -1846,13 +1856,19 @@ function defaultOptions(options = {}) {
1846
1856
  } else if (installedTypescript) {
1847
1857
  if (options.typescript === void 0) {
1848
1858
  typescript2 = getCwdTsconfigPath() ?? true;
1849
- } else if (options.typescript === "string" || Array.isArray(options.typescript)) {
1859
+ } else if (options.typescript === "string") {
1850
1860
  typescript2 = options.typescript.length > 0 ? options.typescript : true;
1861
+ } else if (Array.isArray(options.typescript)) {
1862
+ typescript2 = options.typescript.length > 0 ? options.typescript.filter(Boolean) : true;
1851
1863
  }
1852
1864
  }
1853
1865
  return {
1854
1866
  astro: options.astro ?? installedAstro,
1855
- ignore: options.ignore ?? true,
1867
+ ignore: typeof options.ignore === "object" ? {
1868
+ ...options.ignore,
1869
+ files: typeof options.ignore.files === "string" ? options.ignore.files : options.ignore.files?.filter(Boolean) ?? [],
1870
+ globs: options.ignore.globs?.filter(Boolean) ?? []
1871
+ } : options.ignore ?? true,
1856
1872
  imports: options.imports ?? true,
1857
1873
  json: options.json ?? true,
1858
1874
  markdown: options.markdown ?? true,
@@ -1862,7 +1878,11 @@ function defaultOptions(options = {}) {
1862
1878
  node: true,
1863
1879
  webpack: false,
1864
1880
  ...options.module,
1865
- ignore: [String.raw`bun\:.*`, String.raw`astro\:.*`, ...options.module?.ignore ?? []]
1881
+ ignore: [
1882
+ String.raw`bun\:.*`,
1883
+ String.raw`astro\:.*`,
1884
+ ...options.module?.ignore?.filter(Boolean) ?? []
1885
+ ]
1866
1886
  },
1867
1887
  node: options.node ?? true,
1868
1888
  react: options.react ?? installedReact,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexadrop/eslint-config",
3
- "version": "0.0.1-beta.2",
3
+ "version": "0.0.1-beta.4",
4
4
  "description": "Opinionated ESLint ruleset designed for large teams and projects",
5
5
  "keywords": [
6
6
  "lint",
@@ -77,7 +77,7 @@
77
77
  "@hexadrop/tsconfig": "0.0.3",
78
78
  "@types/bun": "1.1.3",
79
79
  "@types/eslint": "8.56.10",
80
- "astro": "4.8.7",
80
+ "astro": "4.9.1",
81
81
  "eslint": "9.3.0",
82
82
  "eslint-typegen": "0.2.4",
83
83
  "esno": "4.7.0",