@fabdeh/eslint-config 0.3.0 → 0.4.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/README.md +1 -1
- package/dist/index.d.mts +112 -6
- package/dist/index.mjs +61 -47
- package/package.json +30 -30
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
- Single quotes, no semi
|
|
17
17
|
- Using [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic)
|
|
18
18
|
- Respects `.gitignore` by default
|
|
19
|
-
- Requires ESLint v9.
|
|
19
|
+
- Requires ESLint v9.21.0+
|
|
20
20
|
|
|
21
21
|
> [!WARNING]
|
|
22
22
|
> Please keep in mind that this is **_a personal config_** with a lot opinions. Changes might not always be pleased by everyone and every use cases.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
1
|
+
import type { ConfigArray, ConfigWithExtends } from 'typescript-eslint';
|
|
2
|
+
import type { StylisticCustomizeOptions } from '@stylistic/eslint-plugin';
|
|
3
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
4
|
+
import type { FlatGitignoreOptions } from 'eslint-config-flat-gitignore';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Vendor types from Prettier so we don't rely on the dependency.
|
|
@@ -136,6 +136,11 @@ interface VendoredPrettierOptionsRequired {
|
|
|
136
136
|
xmlWhitespaceSensitivity: 'ignore' | 'preserve' | 'strict';
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
139
144
|
/**
|
|
140
145
|
* A type that can be awaited. Promise<T> or T.
|
|
141
146
|
*/
|
|
@@ -336,6 +341,12 @@ interface CreateConfigOptions {
|
|
|
336
341
|
* @default true
|
|
337
342
|
*/
|
|
338
343
|
stylistic?: boolean | (OverridesOptions & StylisticConfig);
|
|
344
|
+
/**
|
|
345
|
+
* Enable or disable JSDoc rules.
|
|
346
|
+
*
|
|
347
|
+
* @default true
|
|
348
|
+
*/
|
|
349
|
+
jsdoc?: boolean;
|
|
339
350
|
/**
|
|
340
351
|
* Enable regexp rules.
|
|
341
352
|
*
|
|
@@ -412,6 +423,9 @@ interface CreateConfigOptions {
|
|
|
412
423
|
formatters?: FormattersOptions | boolean;
|
|
413
424
|
}
|
|
414
425
|
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
415
429
|
/**
|
|
416
430
|
* Generates an ESLint configuration for Angular projects.
|
|
417
431
|
*
|
|
@@ -424,6 +438,8 @@ interface CreateConfigOptions {
|
|
|
424
438
|
*/
|
|
425
439
|
declare function angular(options?: AngularOptions): Promise<ConfigArray>;
|
|
426
440
|
|
|
441
|
+
|
|
442
|
+
|
|
427
443
|
/**
|
|
428
444
|
* Generates a configuration array for ESLint comments rules.
|
|
429
445
|
*
|
|
@@ -435,6 +451,8 @@ declare function angular(options?: AngularOptions): Promise<ConfigArray>;
|
|
|
435
451
|
*/
|
|
436
452
|
declare function comments(): ConfigArray;
|
|
437
453
|
|
|
454
|
+
|
|
455
|
+
|
|
438
456
|
/**
|
|
439
457
|
* Generates a configuration array for ESLint with default and user-defined ignore patterns.
|
|
440
458
|
*
|
|
@@ -443,6 +461,9 @@ declare function comments(): ConfigArray;
|
|
|
443
461
|
*/
|
|
444
462
|
declare function ignores(userIgnores?: string[]): ConfigArray;
|
|
445
463
|
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
446
467
|
/**
|
|
447
468
|
* Generates an ESLint configuration array for import rules.
|
|
448
469
|
*
|
|
@@ -452,6 +473,9 @@ declare function ignores(userIgnores?: string[]): ConfigArray;
|
|
|
452
473
|
*/
|
|
453
474
|
declare function imports(options?: StylisticOptions): ConfigArray;
|
|
454
475
|
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
455
479
|
/**
|
|
456
480
|
* Generates a configuration array for JavaScript projects with ESLint.
|
|
457
481
|
*
|
|
@@ -470,6 +494,9 @@ declare function imports(options?: StylisticOptions): ConfigArray;
|
|
|
470
494
|
*/
|
|
471
495
|
declare function javascript(options?: OverridesOptions): ConfigArray;
|
|
472
496
|
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
|
|
473
500
|
/**
|
|
474
501
|
* Generates a configuration array for JSDoc rules.
|
|
475
502
|
*
|
|
@@ -479,6 +506,13 @@ declare function javascript(options?: OverridesOptions): ConfigArray;
|
|
|
479
506
|
*/
|
|
480
507
|
declare function jsdoc(options?: StylisticOptions): ConfigArray;
|
|
481
508
|
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
482
516
|
/**
|
|
483
517
|
* Generates an ESLint configuration for JSONC files.
|
|
484
518
|
*
|
|
@@ -499,6 +533,11 @@ declare function jsdoc(options?: StylisticOptions): ConfigArray;
|
|
|
499
533
|
*/
|
|
500
534
|
declare function jsonc(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
|
|
501
535
|
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
502
541
|
/**
|
|
503
542
|
* Configures ESLint for Markdown files.
|
|
504
543
|
*
|
|
@@ -521,6 +560,9 @@ declare function jsonc(options?: FilesOptions & OverridesOptions & StylisticOpti
|
|
|
521
560
|
*/
|
|
522
561
|
declare function markdown(options?: FilesOptions & OverridesOptions): Promise<ConfigArray>;
|
|
523
562
|
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
524
566
|
/**
|
|
525
567
|
* Generates an ESLint configuration array for NgRx based on the provided options.
|
|
526
568
|
*
|
|
@@ -544,6 +586,8 @@ declare function markdown(options?: FilesOptions & OverridesOptions): Promise<Co
|
|
|
544
586
|
*/
|
|
545
587
|
declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
|
|
546
588
|
|
|
589
|
+
|
|
590
|
+
|
|
547
591
|
/**
|
|
548
592
|
* Generates a configuration array for the "perfectionist" ESLint plugin.
|
|
549
593
|
*
|
|
@@ -557,6 +601,11 @@ declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
|
|
|
557
601
|
*/
|
|
558
602
|
declare function perfectionist(): Promise<ConfigArray>;
|
|
559
603
|
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
560
609
|
/**
|
|
561
610
|
* Configure the recommended regexp rules.
|
|
562
611
|
*
|
|
@@ -565,6 +614,8 @@ declare function perfectionist(): Promise<ConfigArray>;
|
|
|
565
614
|
*/
|
|
566
615
|
declare function regexp(options?: OverridesOptions & RegExpOptions): ConfigArray;
|
|
567
616
|
|
|
617
|
+
|
|
618
|
+
|
|
568
619
|
/**
|
|
569
620
|
* Configures ESLint rules for sorting keys and array values in `package.json` files.
|
|
570
621
|
*
|
|
@@ -590,6 +641,11 @@ declare function sortPackageJson(): ConfigArray;
|
|
|
590
641
|
*/
|
|
591
642
|
declare function sortTsConfig(): ConfigArray;
|
|
592
643
|
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
593
649
|
declare const STYLISTIC_CONFIG_DEFAULT: StylisticConfig;
|
|
594
650
|
/**
|
|
595
651
|
* Generates a stylistic ESLint configuration.
|
|
@@ -601,6 +657,13 @@ declare const STYLISTIC_CONFIG_DEFAULT: StylisticConfig;
|
|
|
601
657
|
*/
|
|
602
658
|
declare function stylistic(options?: StylisticOptions): Promise<ConfigArray>;
|
|
603
659
|
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
604
667
|
/**
|
|
605
668
|
* Generates an ESLint configuration array for Tailwind CSS.
|
|
606
669
|
*
|
|
@@ -615,6 +678,13 @@ declare function stylistic(options?: StylisticOptions): Promise<ConfigArray>;
|
|
|
615
678
|
*/
|
|
616
679
|
declare function tailwindcss(options?: (FilesOptions & OverridesOptions) | (OverridesOptions & TailwindcssParserPerGlobOptions)): Promise<ConfigArray>;
|
|
617
680
|
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
618
688
|
/**
|
|
619
689
|
* Generates an ESLint configuration for TOML files.
|
|
620
690
|
*
|
|
@@ -627,6 +697,15 @@ declare function tailwindcss(options?: (FilesOptions & OverridesOptions) | (Over
|
|
|
627
697
|
*/
|
|
628
698
|
declare function toml(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
|
|
629
699
|
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
630
709
|
/**
|
|
631
710
|
* Generates a TypeScript ESLint configuration.
|
|
632
711
|
*
|
|
@@ -638,6 +717,9 @@ declare function toml(options?: FilesOptions & OverridesOptions & StylisticOptio
|
|
|
638
717
|
*/
|
|
639
718
|
declare function typescript(options?: OverridesOptions & StylisticOptions & TypeScriptErasableSyntaxOnlyOptions & TypeScriptParserOptions): Promise<ConfigArray>;
|
|
640
719
|
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
641
723
|
/**
|
|
642
724
|
* Generates a configuration array for the Unicorn plugin with the specified options.
|
|
643
725
|
*
|
|
@@ -646,6 +728,11 @@ declare function typescript(options?: OverridesOptions & StylisticOptions & Type
|
|
|
646
728
|
*/
|
|
647
729
|
declare function unicorn(options?: UnicornOptions): ConfigArray;
|
|
648
730
|
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
649
736
|
/**
|
|
650
737
|
* Configures and returns an ESLint configuration array for Vitest.
|
|
651
738
|
*
|
|
@@ -665,6 +752,13 @@ declare function unicorn(options?: UnicornOptions): ConfigArray;
|
|
|
665
752
|
*/
|
|
666
753
|
declare function vitest(options?: OverridesOptions & TestingOptions): Promise<ConfigArray>;
|
|
667
754
|
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
668
762
|
/**
|
|
669
763
|
* Generates an ESLint configuration for YAML files.
|
|
670
764
|
*
|
|
@@ -678,6 +772,13 @@ declare function vitest(options?: OverridesOptions & TestingOptions): Promise<Co
|
|
|
678
772
|
*/
|
|
679
773
|
declare function yaml(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
|
|
680
774
|
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
|
|
681
782
|
/**
|
|
682
783
|
* Creates an ESLint configuration array based on the provided options and user configurations.
|
|
683
784
|
*
|
|
@@ -689,7 +790,7 @@ declare function yaml(options?: FilesOptions & OverridesOptions & StylisticOptio
|
|
|
689
790
|
* const config = await createConfig({ vitest: true, typescript: { parserOptions: { project: './tsconfig.json' } } });
|
|
690
791
|
* ```
|
|
691
792
|
*/
|
|
692
|
-
declare function
|
|
793
|
+
declare function defineConfig(options?: ConfigWithExtends & CreateConfigOptions, ...userConfigs: Awaitable<ConfigWithExtends | ConfigWithExtends[]>[]): Promise<ConfigArray>;
|
|
693
794
|
|
|
694
795
|
/**
|
|
695
796
|
* A glob pattern that matches JavaScript and TypeScript source files (including JSX/TSX).
|
|
@@ -712,6 +813,10 @@ declare const GLOB_HTML = "**/*.htm?(l)";
|
|
|
712
813
|
*/
|
|
713
814
|
declare const GLOB_TESTS: string[];
|
|
714
815
|
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
715
820
|
/**
|
|
716
821
|
* A utility function to handle the default export of a module.
|
|
717
822
|
*
|
|
@@ -775,4 +880,5 @@ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
|
775
880
|
*/
|
|
776
881
|
declare function resolveSubOptions<K extends keyof CreateConfigOptions>(options: CreateConfigOptions, key: K): ResolvedOptions<CreateConfigOptions[K]>;
|
|
777
882
|
|
|
778
|
-
export {
|
|
883
|
+
export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, defineConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
|
|
884
|
+
export type { AngularOptions, Awaitable, CreateConfigOptions, FilesOptions, FormattersOptions, NgrxOperators, NgrxOptions, OverridesOptions, RegExpOptions, ResolvedOptions, StylisticConfig, StylisticOptions, TailwindcssParserPerGlobOptions, TestingOptions, TypeScriptErasableSyntaxOnlyOptions, TypeScriptParserOptions, UnicornOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -10,9 +10,9 @@ import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';
|
|
|
10
10
|
import unusedImports from 'eslint-plugin-unused-imports';
|
|
11
11
|
import globals from 'globals';
|
|
12
12
|
import eslintComments from '@eslint-community/eslint-plugin-eslint-comments';
|
|
13
|
-
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
14
13
|
import * as importX from 'eslint-plugin-import-x';
|
|
15
14
|
import perfectionistPlugin from 'eslint-plugin-perfectionist';
|
|
15
|
+
import jsdocPlugin from 'eslint-plugin-jsdoc';
|
|
16
16
|
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
17
17
|
import { configs } from 'eslint-plugin-regexp';
|
|
18
18
|
import { mergeProcessors, processorPassThrough } from 'eslint-merge-processors';
|
|
@@ -470,6 +470,54 @@ function javascript(options = {}) {
|
|
|
470
470
|
);
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
+
function getJsDocRules(level, stylistic, mode) {
|
|
474
|
+
return {
|
|
475
|
+
...mode === "both" || mode === "jsOnly" ? {
|
|
476
|
+
"jsdoc/check-access": level,
|
|
477
|
+
"jsdoc/check-param-names": level,
|
|
478
|
+
"jsdoc/check-property-names": level,
|
|
479
|
+
"jsdoc/check-tag-names": level,
|
|
480
|
+
"jsdoc/check-types": level,
|
|
481
|
+
"jsdoc/check-values": level,
|
|
482
|
+
"jsdoc/empty-tags": level,
|
|
483
|
+
"jsdoc/implements-on-classes": level,
|
|
484
|
+
"jsdoc/no-defaults": level,
|
|
485
|
+
"jsdoc/no-undefined-types": level,
|
|
486
|
+
"jsdoc/require-jsdoc": level,
|
|
487
|
+
"jsdoc/require-param": level,
|
|
488
|
+
"jsdoc/require-param-description": level,
|
|
489
|
+
"jsdoc/require-param-name": level,
|
|
490
|
+
"jsdoc/require-param-type": level,
|
|
491
|
+
"jsdoc/require-property": level,
|
|
492
|
+
"jsdoc/require-property-description": level,
|
|
493
|
+
"jsdoc/require-property-name": level,
|
|
494
|
+
"jsdoc/require-property-type": level,
|
|
495
|
+
"jsdoc/require-returns": level,
|
|
496
|
+
"jsdoc/require-returns-check": level,
|
|
497
|
+
"jsdoc/require-returns-description": level,
|
|
498
|
+
"jsdoc/require-returns-type": level,
|
|
499
|
+
"jsdoc/require-yields": level,
|
|
500
|
+
"jsdoc/require-yields-check": level,
|
|
501
|
+
"jsdoc/valid-types": level,
|
|
502
|
+
...stylistic ? {
|
|
503
|
+
"jsdoc/check-alignment": level,
|
|
504
|
+
"jsdoc/multiline-blocks": level,
|
|
505
|
+
"jsdoc/no-multi-asterisks": level,
|
|
506
|
+
"jsdoc/require-asterisk-prefix": level,
|
|
507
|
+
"jsdoc/require-hyphen-before-param-description": level,
|
|
508
|
+
"jsdoc/tag-lines": [level, "never", { startLines: 1 }]
|
|
509
|
+
} : {}
|
|
510
|
+
} : {},
|
|
511
|
+
...mode === "both" || mode === "tsOnly" ? {
|
|
512
|
+
"jsdoc/check-tag-names": [level, { typed: true }],
|
|
513
|
+
"jsdoc/no-types": level,
|
|
514
|
+
"jsdoc/no-undefined-types": "off",
|
|
515
|
+
"jsdoc/require-param-type": "off",
|
|
516
|
+
"jsdoc/require-property-type": "off",
|
|
517
|
+
"jsdoc/require-returns-type": "off"
|
|
518
|
+
} : {}
|
|
519
|
+
};
|
|
520
|
+
}
|
|
473
521
|
function jsdoc(options = {}) {
|
|
474
522
|
const { stylistic = true } = options;
|
|
475
523
|
return tseslint.config(
|
|
@@ -477,52 +525,12 @@ function jsdoc(options = {}) {
|
|
|
477
525
|
name: "fabdeh/jsdoc/rules",
|
|
478
526
|
files: [GLOB_SRC],
|
|
479
527
|
plugins: { jsdoc: jsdocPlugin },
|
|
480
|
-
rules:
|
|
481
|
-
"jsdoc/check-access": "warn",
|
|
482
|
-
"jsdoc/check-param-names": "warn",
|
|
483
|
-
"jsdoc/check-property-names": "warn",
|
|
484
|
-
"jsdoc/check-tag-names": "warn",
|
|
485
|
-
"jsdoc/check-types": "warn",
|
|
486
|
-
"jsdoc/check-values": "warn",
|
|
487
|
-
"jsdoc/empty-tags": "warn",
|
|
488
|
-
"jsdoc/implements-on-classes": "warn",
|
|
489
|
-
"jsdoc/no-defaults": "warn",
|
|
490
|
-
"jsdoc/no-multi-asterisks": "warn",
|
|
491
|
-
"jsdoc/no-undefined-types": "warn",
|
|
492
|
-
"jsdoc/require-jsdoc": "warn",
|
|
493
|
-
"jsdoc/require-param": "warn",
|
|
494
|
-
"jsdoc/require-param-description": "warn",
|
|
495
|
-
"jsdoc/require-param-name": "warn",
|
|
496
|
-
"jsdoc/require-param-type": "warn",
|
|
497
|
-
"jsdoc/require-property": "warn",
|
|
498
|
-
"jsdoc/require-property-description": "warn",
|
|
499
|
-
"jsdoc/require-property-name": "warn",
|
|
500
|
-
"jsdoc/require-property-type": "warn",
|
|
501
|
-
"jsdoc/require-returns": "warn",
|
|
502
|
-
"jsdoc/require-returns-check": "warn",
|
|
503
|
-
"jsdoc/require-returns-description": "warn",
|
|
504
|
-
"jsdoc/require-returns-type": "warn",
|
|
505
|
-
"jsdoc/require-yields": "warn",
|
|
506
|
-
"jsdoc/require-yields-check": "warn",
|
|
507
|
-
"jsdoc/tag-lines": ["warn", "never", { startLines: 1 }],
|
|
508
|
-
"jsdoc/valid-types": "warn",
|
|
509
|
-
...stylistic ? {
|
|
510
|
-
"jsdoc/check-alignment": "warn",
|
|
511
|
-
"jsdoc/multiline-blocks": "warn"
|
|
512
|
-
} : {}
|
|
513
|
-
}
|
|
528
|
+
rules: getJsDocRules("warn", !!stylistic, "jsOnly")
|
|
514
529
|
},
|
|
515
530
|
{
|
|
516
531
|
name: "fabdeh/jsdoc/ts-only/rules",
|
|
517
532
|
files: [GLOB_TS],
|
|
518
|
-
rules:
|
|
519
|
-
"jsdoc/check-tag-names": ["warn", { typed: true }],
|
|
520
|
-
"jsdoc/no-types": "warn",
|
|
521
|
-
"jsdoc/no-undefined-types": "off",
|
|
522
|
-
"jsdoc/require-param-type": "off",
|
|
523
|
-
"jsdoc/require-property-type": "off",
|
|
524
|
-
"jsdoc/require-returns-type": "off"
|
|
525
|
-
}
|
|
533
|
+
rules: getJsDocRules("warn", !!stylistic, "tsOnly")
|
|
526
534
|
}
|
|
527
535
|
);
|
|
528
536
|
}
|
|
@@ -1596,6 +1604,7 @@ async function vitest(options = {}) {
|
|
|
1596
1604
|
"vitest/prefer-todo": "error",
|
|
1597
1605
|
"vitest/prefer-vi-mocked": "error",
|
|
1598
1606
|
"vitest/require-top-level-describe": "error",
|
|
1607
|
+
...getJsDocRules("off", true, "both"),
|
|
1599
1608
|
...overrides
|
|
1600
1609
|
}
|
|
1601
1610
|
});
|
|
@@ -1883,10 +1892,11 @@ const FLAT_CONFIG_PROPS = [
|
|
|
1883
1892
|
"extends"
|
|
1884
1893
|
];
|
|
1885
1894
|
const NGRX_PACKAGES = ["@ngrx/store", "@ngrx/effects", "@ngrx/signals", "@ngrx/operators"];
|
|
1886
|
-
async function
|
|
1895
|
+
async function defineConfig(options = {}, ...userConfigs) {
|
|
1887
1896
|
const {
|
|
1888
1897
|
angular: enableAngular = isPackageExists("@angular/core"),
|
|
1889
1898
|
gitignore: enableGitignore = true,
|
|
1899
|
+
jsdoc: enableJsdoc = true,
|
|
1890
1900
|
ngrx: enableNgrx = NGRX_PACKAGES.some((p) => isPackageExists(p)),
|
|
1891
1901
|
regexp: enableRegexp = true,
|
|
1892
1902
|
tailwindcss: enableTailwind = false,
|
|
@@ -1894,6 +1904,9 @@ async function createConfig(options = {}, ...userConfigs) {
|
|
|
1894
1904
|
unicorn: enableUnicorn = true,
|
|
1895
1905
|
vitest: enableVitest = isPackageExists("vitest")
|
|
1896
1906
|
} = options;
|
|
1907
|
+
if (enableNgrx && !enableAngular) {
|
|
1908
|
+
throw new Error("NgRx rules can only be enabled if Angular rules are also enabled.");
|
|
1909
|
+
}
|
|
1897
1910
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1898
1911
|
const configs = [];
|
|
1899
1912
|
if (enableGitignore) {
|
|
@@ -1915,11 +1928,12 @@ async function createConfig(options = {}, ...userConfigs) {
|
|
|
1915
1928
|
ignores(options.ignores),
|
|
1916
1929
|
javascript({ overrides: options.javascript?.overrides }),
|
|
1917
1930
|
comments(),
|
|
1918
|
-
// TODO: add node rules ???
|
|
1919
|
-
jsdoc({ stylistic: stylisticOptions }),
|
|
1920
1931
|
imports({ stylistic: stylisticOptions }),
|
|
1921
1932
|
perfectionist()
|
|
1922
1933
|
);
|
|
1934
|
+
if (enableJsdoc) {
|
|
1935
|
+
configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
1936
|
+
}
|
|
1923
1937
|
if (enableUnicorn) {
|
|
1924
1938
|
const unicornOptions = resolveSubOptions(options, "unicorn");
|
|
1925
1939
|
configs.push(unicorn(unicornOptions));
|
|
@@ -2002,4 +2016,4 @@ async function createConfig(options = {}, ...userConfigs) {
|
|
|
2002
2016
|
return tseslint.config(...await Promise.all(configs), ...await Promise.all(userConfigs));
|
|
2003
2017
|
}
|
|
2004
2018
|
|
|
2005
|
-
export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments,
|
|
2019
|
+
export { GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, STYLISTIC_CONFIG_DEFAULT, angular, comments, defineConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, regexp, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabdeh/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@10.
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af",
|
|
6
6
|
"description": "My personal eslint config preset",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Fabien Dehopré",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@prettier/plugin-xml": "^3.4.1",
|
|
57
|
-
"eslint": "^9.
|
|
58
|
-
"eslint-plugin-erasable-syntax-only": "^0.
|
|
57
|
+
"eslint": "^9.21.0",
|
|
58
|
+
"eslint-plugin-erasable-syntax-only": "^0.3.0",
|
|
59
59
|
"eslint-plugin-format": "^1.0.1",
|
|
60
60
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
61
61
|
"prettier-plugin-slidev": "^1.0.5"
|
|
@@ -81,23 +81,23 @@
|
|
|
81
81
|
"@antfu/install-pkg": "^1.0.0",
|
|
82
82
|
"@clack/prompts": "^0.10.0",
|
|
83
83
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
84
|
-
"@eslint/js": "^9.
|
|
85
|
-
"@eslint/markdown": "^6.
|
|
84
|
+
"@eslint/js": "^9.22.0",
|
|
85
|
+
"@eslint/markdown": "^6.3.0",
|
|
86
86
|
"@ngrx/eslint-plugin": "^19.0.1",
|
|
87
|
-
"@stylistic/eslint-plugin": "^4.0
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
89
|
-
"@typescript-eslint/parser": "^8.
|
|
90
|
-
"@typescript-eslint/utils": "^8.
|
|
91
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
92
|
-
"angular-eslint": "^19.1
|
|
87
|
+
"@stylistic/eslint-plugin": "^4.2.0",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
89
|
+
"@typescript-eslint/parser": "^8.26.1",
|
|
90
|
+
"@typescript-eslint/utils": "^8.26.1",
|
|
91
|
+
"@vitest/eslint-plugin": "^1.1.38",
|
|
92
|
+
"angular-eslint": "^19.2.1",
|
|
93
93
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
94
94
|
"eslint-flat-config-utils": "^2.0.1",
|
|
95
95
|
"eslint-merge-processors": "^2.0.0",
|
|
96
|
-
"eslint-plugin-import-x": "^4.
|
|
96
|
+
"eslint-plugin-import-x": "^4.9.0",
|
|
97
97
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
98
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
98
|
+
"eslint-plugin-jsdoc": "^50.6.8",
|
|
99
99
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
100
|
-
"eslint-plugin-perfectionist": "^4.
|
|
100
|
+
"eslint-plugin-perfectionist": "^4.10.1",
|
|
101
101
|
"eslint-plugin-prefer-arrow-functions": "^3.6.2",
|
|
102
102
|
"eslint-plugin-regexp": "^2.7.0",
|
|
103
103
|
"eslint-plugin-testing-library": "^7.1.1",
|
|
@@ -107,16 +107,16 @@
|
|
|
107
107
|
"eslint-plugin-yml": "^1.17.0",
|
|
108
108
|
"globals": "^16.0.0",
|
|
109
109
|
"jsonc-eslint-parser": "^2.4.0",
|
|
110
|
-
"local-pkg": "^1.
|
|
110
|
+
"local-pkg": "^1.1.1",
|
|
111
111
|
"toml-eslint-parser": "^0.10.0",
|
|
112
|
-
"typescript-eslint": "^8.
|
|
113
|
-
"yaml-eslint-parser": "^1.
|
|
112
|
+
"typescript-eslint": "^8.26.1",
|
|
113
|
+
"yaml-eslint-parser": "^1.3.0"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@angular/core": "^19.
|
|
117
|
-
"@commitlint/cli": "^19.
|
|
118
|
-
"@commitlint/config-conventional": "^19.
|
|
119
|
-
"@commitlint/cz-commitlint": "^19.
|
|
116
|
+
"@angular/core": "^19.2.2",
|
|
117
|
+
"@commitlint/cli": "^19.8.0",
|
|
118
|
+
"@commitlint/config-conventional": "^19.8.0",
|
|
119
|
+
"@commitlint/cz-commitlint": "^19.8.0",
|
|
120
120
|
"@fabdeh/eslint-config": "workspace:*",
|
|
121
121
|
"@ngrx/effects": "^19.0.1",
|
|
122
122
|
"@ngrx/operators": "^19.0.1",
|
|
@@ -126,12 +126,12 @@
|
|
|
126
126
|
"@testing-library/angular": "^17.3.6",
|
|
127
127
|
"@testing-library/jest-dom": "^6.6.3",
|
|
128
128
|
"@types/fs-extra": "^11.0.4",
|
|
129
|
-
"@types/node": "^22.13.
|
|
130
|
-
"bumpp": "^10.0
|
|
131
|
-
"changelogithub": "^13.
|
|
129
|
+
"@types/node": "^22.13.10",
|
|
130
|
+
"bumpp": "^10.1.0",
|
|
131
|
+
"changelogithub": "^13.13.0",
|
|
132
132
|
"commitizen": "^4.3.1",
|
|
133
|
-
"eslint": "^9.
|
|
134
|
-
"eslint-plugin-erasable-syntax-only": "^0.
|
|
133
|
+
"eslint": "^9.22.0",
|
|
134
|
+
"eslint-plugin-erasable-syntax-only": "^0.3.0",
|
|
135
135
|
"eslint-plugin-format": "^1.0.1",
|
|
136
136
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
137
137
|
"execa": "^9.5.2",
|
|
@@ -144,9 +144,9 @@
|
|
|
144
144
|
"prettier-plugin-slidev": "^1.0.5",
|
|
145
145
|
"simple-git-hooks": "^2.11.1",
|
|
146
146
|
"tailwindcss": "^3.4.17",
|
|
147
|
-
"typescript": "^5.
|
|
148
|
-
"unbuild": "^3.
|
|
149
|
-
"vitest": "^3.0.
|
|
147
|
+
"typescript": "^5.8.2",
|
|
148
|
+
"unbuild": "^3.5.0",
|
|
149
|
+
"vitest": "^3.0.9"
|
|
150
150
|
},
|
|
151
151
|
"pnpm": {
|
|
152
152
|
"overrides": {
|