@fabdeh/eslint-config 0.6.3 → 0.7.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/index.d.mts DELETED
@@ -1,872 +0,0 @@
1
- import { ConfigArray, ConfigWithExtends } from 'typescript-eslint';
2
- import { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
3
- import { TSESLint } from '@typescript-eslint/utils';
4
- import { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
5
- import { Attributes, Callees, Variables, Tags } from 'eslint-plugin-better-tailwindcss/api/types';
6
-
7
- /**
8
- * Vendor types from Prettier so we don't rely on the dependency.
9
- */
10
- type VendoredPrettierOptions = Partial<VendoredPrettierOptionsRequired>;
11
- interface VendoredPrettierOptionsRequired {
12
- /**
13
- * Specify the line length that the printer will wrap on.
14
- *
15
- * @default 120
16
- */
17
- printWidth: number;
18
- /**
19
- * Specify the number of spaces per indentation-level.
20
- */
21
- tabWidth: number;
22
- /**
23
- * Indent lines with tabs instead of spaces
24
- */
25
- useTabs?: boolean;
26
- /**
27
- * Print semicolons at the ends of statements.
28
- */
29
- semi: boolean;
30
- /**
31
- * Use single quotes instead of double quotes.
32
- */
33
- singleQuote: boolean;
34
- /**
35
- * Use single quotes in JSX.
36
- */
37
- jsxSingleQuote: boolean;
38
- /**
39
- * Print trailing commas wherever possible.
40
- */
41
- trailingComma: 'all' | 'es5' | 'none';
42
- /**
43
- * Print spaces between brackets in object literals.
44
- */
45
- bracketSpacing: boolean;
46
- /**
47
- * Put the `>` of a multi-line HTML (HTML, XML, JSX, Vue, Angular) element at the end of the last line instead of being
48
- * alone on the next line (does not apply to self closing elements).
49
- */
50
- bracketSameLine: boolean;
51
- /**
52
- * Put the `>` of a multi-line JSX element at the end of the last line instead of being alone on the next line.
53
- *
54
- * @deprecated use bracketSameLine instead
55
- */
56
- jsxBracketSameLine: boolean;
57
- /**
58
- * Format only a segment of a file.
59
- */
60
- rangeStart: number;
61
- /**
62
- * Format only a segment of a file.
63
- *
64
- * @default Number.POSITIVE_INFINITY
65
- */
66
- rangeEnd: number;
67
- /**
68
- * By default, Prettier will wrap markdown text as-is since some services use a linebreak-sensitive renderer.
69
- * In some cases you may want to rely on editor/viewer soft wrapping instead, so this option allows you to opt out.
70
- *
71
- * @default "preserve"
72
- */
73
- proseWrap: 'always' | 'never' | 'preserve';
74
- /**
75
- * Include parentheses around a sole arrow function parameter.
76
- *
77
- * @default "always"
78
- */
79
- arrowParens: 'always' | 'avoid';
80
- /**
81
- * Provide ability to support new languages to prettier.
82
- */
83
- plugins: (any | string)[];
84
- /**
85
- * How to handle whitespaces in HTML.
86
- *
87
- * @default "css"
88
- */
89
- htmlWhitespaceSensitivity: 'css' | 'ignore' | 'strict';
90
- /**
91
- * Which end of line characters to apply.
92
- *
93
- * @default "lf"
94
- */
95
- endOfLine: 'auto' | 'cr' | 'crlf' | 'lf';
96
- /**
97
- * Change when properties in objects are quoted.
98
- *
99
- * @default "as-needed"
100
- */
101
- quoteProps: 'as-needed' | 'consistent' | 'preserve';
102
- /**
103
- * Whether or not to indent the code inside <script> and <style> tags in Vue files.
104
- *
105
- * @default false
106
- */
107
- vueIndentScriptAndStyle: boolean;
108
- /**
109
- * Enforce single attribute per line in HTML, XML, Vue and JSX.
110
- *
111
- * @default false
112
- */
113
- singleAttributePerLine: boolean;
114
- /**
115
- * How to handle whitespaces in XML.
116
- *
117
- * @default "preserve"
118
- */
119
- xmlQuoteAttributes: 'double' | 'preserve' | 'single';
120
- /**
121
- * Whether to put a space inside the brackets of self-closing XML elements.
122
- *
123
- * @default true
124
- */
125
- xmlSelfClosingSpace: boolean;
126
- /**
127
- * Whether to sort attributes by key in XML elements.
128
- *
129
- * @default false
130
- */
131
- xmlSortAttributesByKey: boolean;
132
- /**
133
- * How to handle whitespaces in XML.
134
- *
135
- * @default "ignore"
136
- */
137
- xmlWhitespaceSensitivity: 'ignore' | 'preserve' | 'strict';
138
- }
139
-
140
- /**
141
- * A type that can be awaited. Promise<T> or T.
142
- */
143
- type Awaitable<T> = Promise<T> | T;
144
- /**
145
- * Interface representing options for overriding default ESLint rules.
146
- */
147
- interface OverridesOptions {
148
- /**
149
- * Optional property that allows specifying custom rules to override the default ones.
150
- */
151
- overrides?: TSESLint.FlatConfig.Config['rules'];
152
- }
153
- /**
154
- * Options for specifying files.
155
- */
156
- interface FilesOptions {
157
- /**
158
- * Override the `files` option to provide custom globs.
159
- */
160
- files?: string[];
161
- }
162
- /**
163
- * Options for configuring the behavior of the Unicorn config.
164
- */
165
- interface UnicornOptions {
166
- /**
167
- * If set to `true`, enables all recommended settings from unicorn plugin.
168
- *
169
- * @default false
170
- */
171
- allRecommended?: boolean;
172
- }
173
- /**
174
- * An alias for the `StylisticCustomizeOptions` type without the `pluginName` property.
175
- */
176
- type StylisticConfig = Omit<StylisticCustomizeOptions, 'pluginName'>;
177
- /**
178
- * Interface representing the stylistic options.
179
- */
180
- interface StylisticOptions {
181
- /**
182
- * Optional property that allows specifying stylistic options.
183
- */
184
- stylistic?: StylisticConfig | boolean;
185
- }
186
- /**
187
- * Options for configuring the TypeScript parser.
188
- */
189
- interface TypeScriptParserOptions {
190
- /**
191
- * Additional parser options for TypeScript.
192
- */
193
- parserOptions?: TSESLint.FlatConfig.ParserOptions;
194
- }
195
- interface TypeScriptErasableSyntaxOnlyOptions {
196
- /**
197
- * Indicates whether the erasable syntax only rules should be enabled or not.
198
- *
199
- * @default false
200
- */
201
- enableErasableSyntaxOnly?: boolean;
202
- }
203
- /**
204
- * Options for configuring Angular-specific linting rules.
205
- */
206
- interface AngularOptions {
207
- /**
208
- * Whether to enable accessibility rules.
209
- *
210
- * @default true
211
- */
212
- enableAccessibilityRules?: boolean;
213
- /**
214
- * Prefix to use for Angular components, directives, and pipes.
215
- * Can be a single string or an array of strings.
216
- *
217
- * @default 'app'
218
- */
219
- prefix?: string[] | string;
220
- /**
221
- * TypeScript-specific linting rule overrides.
222
- */
223
- tsOverrides?: TSESLint.FlatConfig.Config['rules'];
224
- /**
225
- * HTML-specific linting rule overrides.
226
- */
227
- htmlOverrides?: TSESLint.FlatConfig.Config['rules'];
228
- /**
229
- * A class name pattern that allows service using `@Injectable` decorator to not use `providedIn` option.
230
- */
231
- ignoreClassNamePatternForInjectableProvidedIn?: string;
232
- /**
233
- * Defines whether the `styles`, `styleUrl`, `styleUrls` must be used.
234
- *
235
- * @default 'string'
236
- */
237
- componentStylesMode?: 'array' | 'string';
238
- /**
239
- * Indicates whether all component should use `OnPush` change strategy or not.
240
- *
241
- * @default true
242
- */
243
- preferOnPushOnly?: boolean;
244
- /**
245
- * Disallow using code which is marked as experimental.
246
- *
247
- * @default true
248
- */
249
- banExperimentalApi?: boolean;
250
- /**
251
- * Disallow using code which is marked as developer preview.
252
- *
253
- * @default true
254
- */
255
- banDeveloperPreviewApi?: boolean;
256
- }
257
- /**
258
- * Interface representing configuration options for enforcing NgRx operators rules.
259
- */
260
- interface NgrxOperators {
261
- /**
262
- * Whether to enforce NgRx operators rules.
263
- *
264
- * @default true
265
- */
266
- enforceOperatorsRules?: boolean;
267
- }
268
- /**
269
- * Configuration options for NGRX.
270
- */
271
- interface NgrxOptions {
272
- /**
273
- * Configuration for the NGRX store.
274
- *
275
- * If set to `true`, the default configuration will be used.
276
- * If set to an object, it should contain options for files, NGRX operators, and overrides.
277
- */
278
- store?: boolean | (FilesOptions & NgrxOperators & OverridesOptions);
279
- /**
280
- * Configuration for NGRX effects.
281
- *
282
- * If set to `true`, the default configuration will be used.
283
- * If set to an object, it should contain options for files, NGRX operators, and overrides.
284
- */
285
- effects?: boolean | (FilesOptions & NgrxOperators & OverridesOptions);
286
- /**
287
- * Configuration for NGRX signals.
288
- *
289
- * If set to `true`, the default configuration will be used.
290
- * If set to an object, it should contain options for files, NGRX operators, and overrides.
291
- */
292
- signals?: boolean | (FilesOptions & NgrxOperators & OverridesOptions);
293
- }
294
- /**
295
- * Options for configuring testing utilities.
296
- */
297
- interface TestingOptions {
298
- /**
299
- * Indicates whether to include Jest DOM matchers.
300
- *
301
- * @default auto-detect based on the dependencies.
302
- */
303
- useJestDom?: boolean;
304
- /**
305
- * Indicates whether to include Testing Library utilities.
306
- *
307
- * @default auto-detect based on the dependencies.
308
- */
309
- useTestingLibrary?: boolean;
310
- }
311
- interface FormattersOptions {
312
- css?: boolean;
313
- html?: boolean;
314
- xml?: boolean;
315
- svg?: boolean;
316
- markdown?: boolean;
317
- graphql?: boolean;
318
- options?: VendoredPrettierOptions;
319
- slidev?: boolean | {
320
- files?: string[];
321
- };
322
- }
323
- interface RegExpOptions {
324
- /**
325
- * Override rules level.
326
- */
327
- level?: 'error' | 'warn';
328
- }
329
- /**
330
- * Interface for better-tailwindcss specific options.
331
- */
332
- interface TailwindCssOptions {
333
- /**
334
- * Provides a specific ESLint parser per glob pattern.
335
- */
336
- parsers?: Record<string, TSESLint.FlatConfig.Parser>;
337
- /**
338
- * Use all better-tailwindcss rules or only recommended ones.
339
- *
340
- * @default false
341
- */
342
- enableAllRules?: boolean;
343
- /**
344
- * The path to the entry file of the CSS-based tailwind config (eg: `src/global.css`). If not specified, the plugin will fall back to the default configuration.
345
- * The tailwind config is used to determine the sorting order.
346
- */
347
- entryPoint?: string;
348
- /**
349
- * The path to the `tailwind.config.js` file. If not specified, the plugin will try to find it automatically or falls back to the default configuration.
350
- * The tailwind config is used to determine the sorting order.
351
- */
352
- tailwindConfig?: string;
353
- /**
354
- * The name of the attribute that contains the tailwind classes.
355
- *
356
- * @default Name for `"class"` and strings Matcher for `"class", "className"`.
357
- */
358
- attributes?: Attributes;
359
- /**
360
- * List of function names which arguments should also get linted.
361
- *
362
- * @default Matchers for `"cc", "clb", "clsx", "cn", "cnb", "ctl", "cva", "cx", "dcnb", "objstr", "tv", "twJoin", "twMerge"`.
363
- */
364
- callees?: Callees;
365
- /**
366
- * List of variable names whose initializer should also get linted.
367
- *
368
- * @default strings Matcher for `"className", "classNames", "classes", "style", "styles"`.
369
- */
370
- variables?: Variables;
371
- /**
372
- * List of template literal tag names whose content should get linted.
373
- * When using the `tags` option, it is recommended to use the strings Matcher for your tag names. This will ensure that nested expressions get linted correctly.
374
- *
375
- * @default None
376
- */
377
- tags?: Tags;
378
- }
379
- interface ProjectTypeOptions {
380
- /**
381
- * Type of the project. `lib` will enable more strict rules for libraries.
382
- *
383
- * @default 'app'
384
- */
385
- type?: 'app' | 'lib';
386
- }
387
- /**
388
- * Options for creating an ESLint configuration.
389
- *
390
- * @see createConfig function
391
- */
392
- interface CreateConfigOptions extends ProjectTypeOptions {
393
- /**
394
- * Enable gitignore support.
395
- *
396
- * Passing an object to configure the options.
397
- *
398
- * @see https://github.com/antfu/eslint-config-flat-gitignore
399
- * @default true
400
- */
401
- gitignore?: FlatGitignoreOptions | boolean;
402
- /**
403
- * JavaScript rules overrides. Can't be disabled.
404
- */
405
- javascript?: OverridesOptions;
406
- /**
407
- * TypeScript rules overrides and parser configuration.
408
- *
409
- * @default auto-detected
410
- */
411
- typescript?: boolean | (OverridesOptions & TypeScriptErasableSyntaxOnlyOptions & TypeScriptParserOptions);
412
- /**
413
- * Enable stylistic rules.
414
- *
415
- * @see https://eslint.style/
416
- * @default true
417
- */
418
- stylistic?: boolean | (OverridesOptions & StylisticConfig);
419
- /**
420
- * Enable or disable JSDoc rules.
421
- *
422
- * @default true
423
- */
424
- jsdoc?: boolean;
425
- /**
426
- * Enable regexp rules.
427
- *
428
- * @see https://ota-meshi.github.io/eslint-plugin-regexp/
429
- * @default true
430
- */
431
- regexp?: boolean | (OverridesOptions & RegExpOptions);
432
- /**
433
- * Options for eslint-plugin-unicorn.
434
- *
435
- * @default true
436
- */
437
- unicorn?: UnicornOptions | boolean;
438
- /**
439
- * Options for the angular linting rules
440
- *
441
- * @default auto-detect based on the dependencies.
442
- */
443
- angular?: AngularOptions | boolean;
444
- /**
445
- * Options for the ngrx linting rules.
446
- *
447
- * @default auto-detect based on dependencies.
448
- */
449
- ngrx?: NgrxOptions | boolean;
450
- /**
451
- * Options for the vitest linting rules
452
- *
453
- * @default auto-detect based on dependencies.
454
- */
455
- vitest?: boolean | (OverridesOptions & TestingOptions);
456
- /**
457
- * Options for the TailwindCSS linting rules.
458
- *
459
- * @default false
460
- */
461
- tailwindcss?: boolean | (FilesOptions & OverridesOptions & TailwindCssOptions);
462
- /**
463
- * Enable JSONC support.
464
- *
465
- * @default true
466
- */
467
- jsonc?: OverridesOptions | boolean;
468
- /**
469
- * Enable YAML support.
470
- *
471
- * @default true
472
- */
473
- yaml?: OverridesOptions | boolean;
474
- /**
475
- * Enable TOML support.
476
- *
477
- * @default true
478
- */
479
- toml?: OverridesOptions | boolean;
480
- /**
481
- * Enable linting for **code snippets** in Markdown.
482
- *
483
- * For formatting Markdown content, enable also `formatters.markdown`.
484
- *
485
- * @default true
486
- */
487
- markdown?: OverridesOptions | boolean;
488
- /**
489
- * Use external formatters to format files.
490
- *
491
- * Requires installing:
492
- * - `eslint-plugin-format`
493
- *
494
- * When set to `true`, it will enable all formatters.
495
- *
496
- * @default false
497
- */
498
- formatters?: FormattersOptions | boolean;
499
- }
500
-
501
- /**
502
- * Generates an ESLint configuration for Angular projects.
503
- *
504
- * @param options - Configuration options for Angular ESLint.
505
- * @param options.enableAccessibilityRules - Whether to enable accessibility rules for HTML templates.
506
- * @param options.tsOverrides - Additional TypeScript rule overrides.
507
- * @param options.htmlOverrides - Additional HTML rule overrides.
508
- * @param options.prefix - The prefix to use for Angular component and directive selectors.
509
- * @returns A promise that resolves to an array of ESLint configurations.
510
- */
511
- declare function angular(options?: AngularOptions): Promise<ConfigArray>;
512
-
513
- /**
514
- * Generates a configuration array for ESLint comments rules.
515
- *
516
- * This function returns a configuration array that includes rules for managing
517
- * ESLint comments in the codebase. It uses the `@eslint-community/eslint-comments`
518
- * plugin to enforce best practices and prevent common issues with ESLint comments.
519
- *
520
- * @returns The configuration array for ESLint comments rules.
521
- */
522
- declare function comments(): ConfigArray;
523
-
524
- /**
525
- * Generates a configuration array for ESLint with default and user-defined ignore patterns.
526
- *
527
- * @param userIgnores - An array of user-defined glob patterns to ignore. Defaults to an empty array.
528
- * @returns A ConfigArray object containing the combined ignore patterns.
529
- */
530
- declare function ignores(userIgnores?: string[]): ConfigArray;
531
-
532
- /**
533
- * Generates an ESLint configuration array for import rules.
534
- *
535
- * @param options - An object containing stylistic options.
536
- * @param options.stylistic - A boolean indicating whether to include stylistic rules. Defaults to true.
537
- * @returns A ConfigArray object with the specified import rules.
538
- */
539
- declare function imports(options?: StylisticOptions): ConfigArray;
540
-
541
- /**
542
- * Generates a configuration array for JavaScript projects with ESLint.
543
- *
544
- * This function sets up ESLint configurations for JavaScript projects, including language options,
545
- * linter options, and specific rules. It supports options for Angular decorators and unused imports
546
- * handling based on the environment (editor or not).
547
- *
548
- * @param options - Configuration options for the JavaScript setup.
549
- * @param options.overrides - Additional rule overrides.
550
- * @returns A configuration array for ESLint.
551
- * @example
552
- * ```typescript
553
- * const config = javascript();
554
- * ```
555
- */
556
- declare function javascript(options?: OverridesOptions): ConfigArray;
557
-
558
- /**
559
- * Generates a configuration array for JSDoc rules.
560
- *
561
- * @param options - An object containing stylistic options.
562
- * @param options.stylistic - A boolean indicating whether to include stylistic rules. Defaults to true.
563
- * @returns A configuration array for JSDoc rules.
564
- */
565
- declare function jsdoc(options?: StylisticOptions): ConfigArray;
566
-
567
- /**
568
- * Generates an ESLint configuration for JSONC files.
569
- *
570
- * @param options - Configuration options for the JSONC setup.
571
- * @param options.files - An array of glob patterns to specify the JSONC files to lint. Defaults to `[GLOB_JSON, GLOB_JSON5, GLOB_JSONC]`.
572
- * @param options.overrides - Additional rules or configurations to override the default settings.
573
- * @param options.stylistic - A boolean or object to enable or configure stylistic rules. Defaults to `true`.
574
- * @returns A promise that resolves to a `ConfigArray` containing the ESLint configuration.
575
- * @example
576
- * ```typescript
577
- * const config = await jsonc({
578
- * files: ['**\/*.json'],
579
- * stylistic: {
580
- * indent: 4,
581
- * },
582
- * });
583
- * ```
584
- */
585
- declare function jsonc(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
586
-
587
- /**
588
- * Configures ESLint for Markdown files.
589
- *
590
- * This function sets up ESLint configurations specifically for Markdown files,
591
- * including custom parsers, plugins, processors, and rule overrides.
592
- *
593
- * @param options - An object containing file and override options.
594
- * @param options.files - An array of glob patterns to specify the Markdown files to lint.
595
- * @param options.overrides - An object containing rule overrides.
596
- * @returns A promise that resolves to a ConfigArray containing the ESLint configurations.
597
- * @example
598
- * ```typescript
599
- * const config = await markdown({
600
- * files: ['**\/*.md'],
601
- * overrides: {
602
- * 'no-console': 'warn',
603
- * },
604
- * });
605
- * ```
606
- */
607
- declare function markdown(options?: FilesOptions & OverridesOptions): Promise<ConfigArray>;
608
-
609
- /**
610
- * Generates an ESLint configuration array for NgRx based on the provided options.
611
- *
612
- * @param [options] - The options to configure NgRx rules.
613
- * @param [options.store] - If true or an object, includes NgRx store rules.
614
- * @param [options.effects] - If true or an object, includes NgRx effects rules.
615
- * @param [options.signals] - If true or an object, includes NgRx signals rules.
616
- * @returns A promise that resolves to the ESLint configuration array.
617
- * @example
618
- * // Basic usage
619
- * const config = await ngrx();
620
- * @example
621
- * ```ts
622
- * // With custom options
623
- * const config = await ngrx({
624
- * store: { files: ['**\/*.store.ts'] },
625
- * effects: { files: ['**\/*.effects.ts'] },
626
- * signals: { files: ['**\/*.signals.ts'] }
627
- * });
628
- * ```
629
- */
630
- declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
631
-
632
- /**
633
- * Generates a configuration array for the "perfectionist" ESLint plugin.
634
- *
635
- * This configuration includes rules for sorting various elements in the codebase
636
- * such as exports, imports, intersection types, named exports, named imports,
637
- * switch cases, and union types. The sorting order is set to "ascending" and the
638
- * type is natural.
639
- *
640
- * @returns The configuration array for the "perfectionist" plugin.
641
- * @see https://github.com/azat-io/eslint-plugin-perfectionist
642
- */
643
- declare function perfectionist(): Promise<ConfigArray>;
644
-
645
- /**
646
- * Configure the recommended regexp rules.
647
- *
648
- * @param options - The options
649
- * @returns The ESLint configuration for regexp linting
650
- */
651
- declare function regexp(options?: OverridesOptions & RegExpOptions): ConfigArray;
652
-
653
- /**
654
- * Configures ESLint rules for sorting keys and array values in `package.json` files.
655
- *
656
- * This function returns a configuration array that enforces specific sorting rules
657
- * for various sections of `package.json` files. The rules include:
658
- * - Sorting array values in ascending order for the `files` field.
659
- * - Sorting keys in a predefined order for the root level of `package.json`.
660
- * - Sorting dependency fields (`dependencies`, `devDependencies`, `peerDependencies`, etc.) in ascending order.
661
- * - Sorting specific fields within the `exports` section.
662
- * - Sorting client hooks in a predefined order for `gitHooks`, `husky`, and `simple-git-hooks`.
663
- *
664
- * @returns The ESLint configuration array with sorting rules.
665
- */
666
- declare function sortPackageJson(): ConfigArray;
667
- /**
668
- * Generates a TypeScript ESLint configuration array that enforces sorting rules for `tsconfig.json` files.
669
- *
670
- * The configuration includes rules to:
671
- * - Sort the top-level keys of `tsconfig.json` files in a specific order.
672
- * - Sort the keys within the `compilerOptions` section of `tsconfig.json` files in a specific order.
673
- *
674
- * @returns The TypeScript ESLint configuration array with sorting rules.
675
- */
676
- declare function sortTsConfig(): ConfigArray;
677
-
678
- declare const STYLISTIC_CONFIG_DEFAULT: StylisticConfig;
679
- /**
680
- * Generates a stylistic ESLint configuration.
681
- *
682
- * @param [options] - Optional configuration options to customize the stylistic rules.
683
- * @returns A promise that resolves to an array of ESLint configurations.
684
- * @example
685
- * const config = await stylistic({ semi: false });
686
- */
687
- declare function stylistic(options?: StylisticOptions): Promise<ConfigArray>;
688
-
689
- /**
690
- * Generates an ESLint configuration array for Tailwind CSS using better-tailwindcss plugin.
691
- *
692
- * @param [options] - Optional overrides for the configuration.
693
- * @returns A promise that resolves to the ESLint configuration array.
694
- * @example
695
- * const config = await tailwindcss({
696
- * enableAllRules: true,
697
- * overrides: {
698
- * 'better-tailwindcss/recommended': 'warn',
699
- * },
700
- * });
701
- */
702
- declare function tailwindcss(options?: (FilesOptions & OverridesOptions & TailwindCssOptions)): Promise<ConfigArray>;
703
-
704
- /**
705
- * Generates an ESLint configuration for TOML files.
706
- *
707
- * @param options - The configuration options.
708
- * @param options.files - The glob patterns for the files to lint.
709
- * @param options.overrides - The rules to override the default configuration.
710
- * @param options.stylistic - Whether to apply stylistic rules or a configuration object for stylistic rules.
711
- * @param options.stylistic.indent - The indentation style for stylistic rules.
712
- * @returns A promise that resolves to the ESLint configuration array.
713
- */
714
- declare function toml(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
715
-
716
- /**
717
- * Generates a TypeScript ESLint configuration.
718
- *
719
- * @param options - Configuration options that include overrides, stylistic preferences, and parser options.
720
- * @param options.stylistic - A boolean indicating whether stylistic rules should be included. Defaults to true.
721
- * @param options.parserOptions - Options for the TypeScript parser.
722
- * @param options.overrides - Additional rule overrides.
723
- * @returns A ConfigArray containing the TypeScript ESLint configuration.
724
- */
725
- declare function typescript(options?: OverridesOptions & ProjectTypeOptions & StylisticOptions & TypeScriptErasableSyntaxOnlyOptions & TypeScriptParserOptions): Promise<ConfigArray>;
726
-
727
- /**
728
- * Generates a configuration array for the Unicorn plugin with the specified options.
729
- *
730
- * @param [options] - The options to customize the Unicorn rules.
731
- * @returns The configuration array for the Unicorn plugin.
732
- */
733
- declare function unicorn(options?: UnicornOptions): ConfigArray;
734
-
735
- /**
736
- * Configures and returns an ESLint configuration array for Vitest.
737
- *
738
- * @param [options] - The options to customize the configuration.
739
- * @param [options.overrides] - Custom rule overrides.
740
- * @param [options.useJestDom] - Whether to use the `@testing-library/jest-dom` plugin.
741
- * @param [options.useTestingLibrary] - Whether to use the `@testing-library/angular` plugin.
742
- * @returns A promise that resolves to the ESLint configuration array.
743
- * @example
744
- * const config = await vitest({
745
- * overrides: {
746
- * 'no-console': 'warn',
747
- * },
748
- * useJestDom: true,
749
- * useTestingLibrary: false,
750
- * });
751
- */
752
- declare function vitest(options?: OverridesOptions & TestingOptions): Promise<ConfigArray>;
753
-
754
- /**
755
- * Generates an ESLint configuration for YAML files.
756
- *
757
- * @param options - Configuration options for the YAML setup.
758
- * @param options.files - An array of glob patterns to specify the YAML files to lint. Defaults to `[GLOB_YAML]`.
759
- * @param options.overrides - An object containing rule overrides.
760
- * @param options.stylistic - A boolean or object to specify stylistic rules. Defaults to `true`.
761
- * @param options.stylistic.indent - The number of spaces for indentation or 'tab'. Defaults to `2`.
762
- * @param options.stylistic.quotes - The type of quotes to use ('single', 'double', or 'backtick'). Defaults to `'single'`.
763
- * @returns A promise that resolves to a `ConfigArray` containing the ESLint configuration.
764
- */
765
- declare function yaml(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
766
-
767
- /**
768
- * Creates an ESLint configuration array based on the provided options and user configurations.
769
- *
770
- * @param options - Configuration options that extend `ConfigWithExtends` and `CreateConfigOptions`.
771
- * @param userConfigs - Additional user configurations that can be awaited.
772
- * @returns A promise that resolves to a `ConfigArray`.
773
- * @example
774
- * ```typescript
775
- * const config = await createConfig({ vitest: true, typescript: { parserOptions: { project: './tsconfig.json' } } });
776
- * ```
777
- */
778
- declare function defineConfig(options?: ConfigWithExtends & CreateConfigOptions, ...userConfigs: Awaitable<ConfigWithExtends | ConfigWithExtends[]>[]): Promise<ConfigArray>;
779
-
780
- /**
781
- * A glob pattern that matches JavaScript and TypeScript source files (including JSX/TSX).
782
- */
783
- declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
784
- /**
785
- * A glob pattern that matches JavaScript source files (including JSX).
786
- */
787
- declare const GLOB_JS = "**/*.?([cm])js?(x)";
788
- /**
789
- * A glob pattern that matches TypeScript source files (including TSX).
790
- */
791
- declare const GLOB_TS = "**/*.?([cm])ts?(x)";
792
- /**
793
- * A glob pattern that matches HTML files.
794
- */
795
- declare const GLOB_HTML = "**/*.htm?(l)";
796
- /**
797
- * A glob pattern that matches test files.
798
- */
799
- declare const GLOB_TESTS: string[];
800
-
801
- /**
802
- * A utility function to handle the default export of a module.
803
- *
804
- * This function takes an `Awaitable` module and returns its default export if it exists,
805
- * otherwise, it returns the module itself.
806
- *
807
- * @template T - The type of the module.
808
- * @param m - The module to resolve.
809
- * @returns A promise that resolves to the default export of the module if it exists, otherwise the module itself.
810
- */
811
- declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
812
- default: infer U;
813
- } ? U : T>;
814
- /**
815
- * Retrieves the root directory of the workspace.
816
- *
817
- * This function determines the root directory of the workspace by checking for specific files
818
- * and directories that indicate the presence of an Nx workspace. If the `NX_WORKSPACE_ROOT_PATH`
819
- * environment variable is set, it returns that value. Otherwise, it recursively checks parent
820
- * directories until it finds the workspace root or reaches the filesystem root.
821
- *
822
- * @param dir - The current directory to start the search from.
823
- * @param candidateRoot - The initial candidate root directory.
824
- * @returns The root directory of the workspace.
825
- */
826
- declare function getWorkspaceRoot(dir: string, candidateRoot: string): string;
827
- /**
828
- * Returns the most probable filename for the TsConfig.
829
- *
830
- * @param dir - The directory into which the tsconfig.json is located.
831
- * @returns The tsconfig.*.json file
832
- */
833
- declare function getTsConfigFileName(dir: string): string | undefined;
834
- /**
835
- * Checks if a package is within the specified scope.
836
- *
837
- * @param name - The name of the package to check.
838
- * @returns A boolean indicating whether the package is in scope.
839
- */
840
- declare function isPackageInScope(name: string): boolean;
841
- /**
842
- * Ensures that the specified packages are installed. If running in a CI environment,
843
- * or if the terminal is not interactive, or if the current working directory is not in scope,
844
- * the function will return immediately without doing anything.
845
- *
846
- * The function filters out packages that are already in scope and prompts the user to confirm
847
- * the installation of the remaining packages. If the user confirms, the packages are installed
848
- * as development dependencies.
849
- *
850
- * @param packages - An array of package names (or undefined) to check and install if necessary.
851
- * @returns A promise that resolves when the operation is complete.
852
- */
853
- declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
854
- /**
855
- * Search for the nearest package.json file and return the `name` property value.
856
- *
857
- * @param directoryPath - The folder to start from (default to current working directory).
858
- * @returns The name of the nearest package.json
859
- */
860
- declare function findNearestPackageJsonName(directoryPath?: string): Promise<string>;
861
- type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
862
- /**
863
- * Returns the object representation of the configuration or an empty object if it is a boolean.
864
- *
865
- * @param options - The {@link CreateConfigOptions} object to extract the sub-options from.
866
- * @param key - The property name.
867
- * @returns An object representing the required options.
868
- */
869
- declare function resolveSubOptions<K extends keyof CreateConfigOptions>(options: CreateConfigOptions, key: K): ResolvedOptions<CreateConfigOptions[K]>;
870
-
871
- export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, defineConfig, ensurePackages, findNearestPackageJsonName, getTsConfigFileName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
872
- export type { AngularOptions, Awaitable, CreateConfigOptions, FilesOptions, FormattersOptions, NgrxOperators, NgrxOptions, OverridesOptions, ProjectTypeOptions, RegExpOptions, ResolvedOptions, StylisticConfig, StylisticOptions, TailwindCssOptions, TestingOptions, TypeScriptErasableSyntaxOnlyOptions, TypeScriptParserOptions, UnicornOptions };