@fabdeh/eslint-config 0.4.0 → 0.5.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 +26 -26
- package/dist/index.d.mts +28 -104
- package/dist/index.mjs +29 -12
- package/package.json +44 -44
package/README.md
CHANGED
|
@@ -37,9 +37,9 @@ And create an `eslint.config.mjs` in you project root:
|
|
|
37
37
|
|
|
38
38
|
```js
|
|
39
39
|
// eslint.config.mjs
|
|
40
|
-
import {
|
|
40
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
41
41
|
|
|
42
|
-
export default
|
|
42
|
+
export default defineConfig();
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
### Add script for package.json
|
|
@@ -108,22 +108,22 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
108
108
|
|
|
109
109
|
Since the beginning, we used [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new). It provides much better organization and composition.
|
|
110
110
|
|
|
111
|
-
Normally you only need to import the `
|
|
111
|
+
Normally you only need to import the `defineConfig` function:
|
|
112
112
|
|
|
113
113
|
```js
|
|
114
114
|
// eslint.config.js
|
|
115
|
-
import {
|
|
115
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
116
116
|
|
|
117
|
-
export default
|
|
117
|
+
export default defineConfig();
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
And that's it! Or you can configure each integration individually, for example:
|
|
121
121
|
|
|
122
122
|
```js
|
|
123
123
|
// eslint.config.js
|
|
124
|
-
import {
|
|
124
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
125
125
|
|
|
126
|
-
export default
|
|
126
|
+
export default defineConfig({
|
|
127
127
|
// Enable stylistic formatting rules
|
|
128
128
|
// stylistic: true,
|
|
129
129
|
|
|
@@ -148,13 +148,13 @@ export default createConfig({
|
|
|
148
148
|
});
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
The `
|
|
151
|
+
The `defineConfig` factory function also accepts any number of arbitrary custom config overrides:
|
|
152
152
|
|
|
153
153
|
```js
|
|
154
154
|
// eslint.config.js
|
|
155
|
-
import {
|
|
155
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
156
156
|
|
|
157
|
-
export default
|
|
157
|
+
export default defineConfig(
|
|
158
158
|
{
|
|
159
159
|
// Configure the fabdeh's config
|
|
160
160
|
},
|
|
@@ -225,9 +225,9 @@ If you want to override the rules, you need to specify the file extension:
|
|
|
225
225
|
|
|
226
226
|
```js
|
|
227
227
|
// eslint.config.js
|
|
228
|
-
import {
|
|
228
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
229
229
|
|
|
230
|
-
export default
|
|
230
|
+
export default defineConfig(
|
|
231
231
|
{
|
|
232
232
|
typescript: true,
|
|
233
233
|
vitest: true
|
|
@@ -252,9 +252,9 @@ We also provide the `overrides` option in each integration to make it easier:
|
|
|
252
252
|
|
|
253
253
|
```js
|
|
254
254
|
// eslint.config.js
|
|
255
|
-
import {
|
|
255
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
256
256
|
|
|
257
|
-
export default
|
|
257
|
+
export default defineConfig({
|
|
258
258
|
typescript: {
|
|
259
259
|
overrides: {
|
|
260
260
|
'@typescript-eslint/consisten-type-definitions': ['error', 'interface'],
|
|
@@ -292,9 +292,9 @@ You can explicitly enable/disable TypeScript integration manually:
|
|
|
292
292
|
|
|
293
293
|
```js
|
|
294
294
|
// eslint.config.js
|
|
295
|
-
import {
|
|
295
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
296
296
|
|
|
297
|
-
export default
|
|
297
|
+
export default defineConfig({
|
|
298
298
|
typescript: true,
|
|
299
299
|
});
|
|
300
300
|
```
|
|
@@ -313,9 +313,9 @@ You can enable these rules as follow:
|
|
|
313
313
|
|
|
314
314
|
```js
|
|
315
315
|
// eslint.config.js
|
|
316
|
-
import {
|
|
316
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
317
317
|
|
|
318
|
-
export default
|
|
318
|
+
export default defineConfig({
|
|
319
319
|
typescript: {
|
|
320
320
|
enableErasableSyntaxOnly: true,
|
|
321
321
|
},
|
|
@@ -335,9 +335,9 @@ Angular support is detected automatically by checking if `@angular/core` is inst
|
|
|
335
335
|
|
|
336
336
|
```js
|
|
337
337
|
// eslint.config.js
|
|
338
|
-
import {
|
|
338
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
339
339
|
|
|
340
|
-
export default
|
|
340
|
+
export default defineConfig({
|
|
341
341
|
angular: true,
|
|
342
342
|
});
|
|
343
343
|
```
|
|
@@ -355,9 +355,9 @@ As the Angular integration is can be explicitly enabled/disabled:
|
|
|
355
355
|
|
|
356
356
|
```js
|
|
357
357
|
// eslint.config.js
|
|
358
|
-
import {
|
|
358
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
359
359
|
|
|
360
|
-
export default
|
|
360
|
+
export default defineConfig({
|
|
361
361
|
ngrx: true,
|
|
362
362
|
});
|
|
363
363
|
```
|
|
@@ -370,9 +370,9 @@ The vitest integration is detected automatically by checking if `vitest` is inst
|
|
|
370
370
|
|
|
371
371
|
```js
|
|
372
372
|
// eslint.config.js
|
|
373
|
-
import {
|
|
373
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
374
374
|
|
|
375
|
-
export default
|
|
375
|
+
export default defineConfig({
|
|
376
376
|
vitest: true,
|
|
377
377
|
});
|
|
378
378
|
```
|
|
@@ -387,9 +387,9 @@ Use external formatters to format files that ESLint cannot handle yet (`.css`, `
|
|
|
387
387
|
|
|
388
388
|
```js
|
|
389
389
|
// eslint.config.js
|
|
390
|
-
import {
|
|
390
|
+
import { defineConfig } from '@fabdeh/eslint-config';
|
|
391
391
|
|
|
392
|
-
export default
|
|
392
|
+
export default defineConfig({
|
|
393
393
|
formatters: {
|
|
394
394
|
/**
|
|
395
395
|
* Format CSS, LESS, SCSS files
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Vendor types from Prettier so we don't rely on the dependency.
|
|
@@ -136,11 +136,6 @@ interface VendoredPrettierOptionsRequired {
|
|
|
136
136
|
xmlWhitespaceSensitivity: 'ignore' | 'preserve' | 'strict';
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
139
|
/**
|
|
145
140
|
* A type that can be awaited. Promise<T> or T.
|
|
146
141
|
*/
|
|
@@ -229,6 +224,22 @@ interface AngularOptions {
|
|
|
229
224
|
* HTML-specific linting rule overrides.
|
|
230
225
|
*/
|
|
231
226
|
htmlOverrides?: TSESLint.FlatConfig.Config['rules'];
|
|
227
|
+
/**
|
|
228
|
+
* A class name pattern that allows service using `@Injectable` decorator to not use `providedIn` option.
|
|
229
|
+
*/
|
|
230
|
+
ignoreClassNamePatternForInjectableProvidedIn?: string;
|
|
231
|
+
/**
|
|
232
|
+
* Defines whether the `styles`, `styleUrl`, `styleUrls` must be used.
|
|
233
|
+
*
|
|
234
|
+
* @default 'string'
|
|
235
|
+
*/
|
|
236
|
+
componentStylesMode?: 'array' | 'string';
|
|
237
|
+
/**
|
|
238
|
+
* Indicates whether all component should use `OnPush` change strategy or not.
|
|
239
|
+
*
|
|
240
|
+
* @default true
|
|
241
|
+
*/
|
|
242
|
+
preferOnPushOnly?: boolean;
|
|
232
243
|
}
|
|
233
244
|
/**
|
|
234
245
|
* Interface representing configuration options for enforcing NgRx operators rules.
|
|
@@ -423,9 +434,6 @@ interface CreateConfigOptions {
|
|
|
423
434
|
formatters?: FormattersOptions | boolean;
|
|
424
435
|
}
|
|
425
436
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
437
|
/**
|
|
430
438
|
* Generates an ESLint configuration for Angular projects.
|
|
431
439
|
*
|
|
@@ -438,8 +446,6 @@ interface CreateConfigOptions {
|
|
|
438
446
|
*/
|
|
439
447
|
declare function angular(options?: AngularOptions): Promise<ConfigArray>;
|
|
440
448
|
|
|
441
|
-
|
|
442
|
-
|
|
443
449
|
/**
|
|
444
450
|
* Generates a configuration array for ESLint comments rules.
|
|
445
451
|
*
|
|
@@ -451,8 +457,6 @@ declare function angular(options?: AngularOptions): Promise<ConfigArray>;
|
|
|
451
457
|
*/
|
|
452
458
|
declare function comments(): ConfigArray;
|
|
453
459
|
|
|
454
|
-
|
|
455
|
-
|
|
456
460
|
/**
|
|
457
461
|
* Generates a configuration array for ESLint with default and user-defined ignore patterns.
|
|
458
462
|
*
|
|
@@ -461,9 +465,6 @@ declare function comments(): ConfigArray;
|
|
|
461
465
|
*/
|
|
462
466
|
declare function ignores(userIgnores?: string[]): ConfigArray;
|
|
463
467
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
468
|
/**
|
|
468
469
|
* Generates an ESLint configuration array for import rules.
|
|
469
470
|
*
|
|
@@ -473,9 +474,6 @@ declare function ignores(userIgnores?: string[]): ConfigArray;
|
|
|
473
474
|
*/
|
|
474
475
|
declare function imports(options?: StylisticOptions): ConfigArray;
|
|
475
476
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
477
|
/**
|
|
480
478
|
* Generates a configuration array for JavaScript projects with ESLint.
|
|
481
479
|
*
|
|
@@ -494,9 +492,6 @@ declare function imports(options?: StylisticOptions): ConfigArray;
|
|
|
494
492
|
*/
|
|
495
493
|
declare function javascript(options?: OverridesOptions): ConfigArray;
|
|
496
494
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
495
|
/**
|
|
501
496
|
* Generates a configuration array for JSDoc rules.
|
|
502
497
|
*
|
|
@@ -506,13 +501,6 @@ declare function javascript(options?: OverridesOptions): ConfigArray;
|
|
|
506
501
|
*/
|
|
507
502
|
declare function jsdoc(options?: StylisticOptions): ConfigArray;
|
|
508
503
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
504
|
/**
|
|
517
505
|
* Generates an ESLint configuration for JSONC files.
|
|
518
506
|
*
|
|
@@ -533,11 +521,6 @@ declare function jsdoc(options?: StylisticOptions): ConfigArray;
|
|
|
533
521
|
*/
|
|
534
522
|
declare function jsonc(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
|
|
535
523
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
524
|
/**
|
|
542
525
|
* Configures ESLint for Markdown files.
|
|
543
526
|
*
|
|
@@ -560,9 +543,6 @@ declare function jsonc(options?: FilesOptions & OverridesOptions & StylisticOpti
|
|
|
560
543
|
*/
|
|
561
544
|
declare function markdown(options?: FilesOptions & OverridesOptions): Promise<ConfigArray>;
|
|
562
545
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
546
|
/**
|
|
567
547
|
* Generates an ESLint configuration array for NgRx based on the provided options.
|
|
568
548
|
*
|
|
@@ -586,8 +566,6 @@ declare function markdown(options?: FilesOptions & OverridesOptions): Promise<Co
|
|
|
586
566
|
*/
|
|
587
567
|
declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
|
|
588
568
|
|
|
589
|
-
|
|
590
|
-
|
|
591
569
|
/**
|
|
592
570
|
* Generates a configuration array for the "perfectionist" ESLint plugin.
|
|
593
571
|
*
|
|
@@ -601,11 +579,6 @@ declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
|
|
|
601
579
|
*/
|
|
602
580
|
declare function perfectionist(): Promise<ConfigArray>;
|
|
603
581
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
582
|
/**
|
|
610
583
|
* Configure the recommended regexp rules.
|
|
611
584
|
*
|
|
@@ -614,8 +587,6 @@ declare function perfectionist(): Promise<ConfigArray>;
|
|
|
614
587
|
*/
|
|
615
588
|
declare function regexp(options?: OverridesOptions & RegExpOptions): ConfigArray;
|
|
616
589
|
|
|
617
|
-
|
|
618
|
-
|
|
619
590
|
/**
|
|
620
591
|
* Configures ESLint rules for sorting keys and array values in `package.json` files.
|
|
621
592
|
*
|
|
@@ -641,11 +612,6 @@ declare function sortPackageJson(): ConfigArray;
|
|
|
641
612
|
*/
|
|
642
613
|
declare function sortTsConfig(): ConfigArray;
|
|
643
614
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
615
|
declare const STYLISTIC_CONFIG_DEFAULT: StylisticConfig;
|
|
650
616
|
/**
|
|
651
617
|
* Generates a stylistic ESLint configuration.
|
|
@@ -657,13 +623,6 @@ declare const STYLISTIC_CONFIG_DEFAULT: StylisticConfig;
|
|
|
657
623
|
*/
|
|
658
624
|
declare function stylistic(options?: StylisticOptions): Promise<ConfigArray>;
|
|
659
625
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
626
|
/**
|
|
668
627
|
* Generates an ESLint configuration array for Tailwind CSS.
|
|
669
628
|
*
|
|
@@ -678,13 +637,6 @@ declare function stylistic(options?: StylisticOptions): Promise<ConfigArray>;
|
|
|
678
637
|
*/
|
|
679
638
|
declare function tailwindcss(options?: (FilesOptions & OverridesOptions) | (OverridesOptions & TailwindcssParserPerGlobOptions)): Promise<ConfigArray>;
|
|
680
639
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
640
|
/**
|
|
689
641
|
* Generates an ESLint configuration for TOML files.
|
|
690
642
|
*
|
|
@@ -697,15 +649,6 @@ declare function tailwindcss(options?: (FilesOptions & OverridesOptions) | (Over
|
|
|
697
649
|
*/
|
|
698
650
|
declare function toml(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
|
|
699
651
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
652
|
/**
|
|
710
653
|
* Generates a TypeScript ESLint configuration.
|
|
711
654
|
*
|
|
@@ -717,9 +660,6 @@ declare function toml(options?: FilesOptions & OverridesOptions & StylisticOptio
|
|
|
717
660
|
*/
|
|
718
661
|
declare function typescript(options?: OverridesOptions & StylisticOptions & TypeScriptErasableSyntaxOnlyOptions & TypeScriptParserOptions): Promise<ConfigArray>;
|
|
719
662
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
663
|
/**
|
|
724
664
|
* Generates a configuration array for the Unicorn plugin with the specified options.
|
|
725
665
|
*
|
|
@@ -728,11 +668,6 @@ declare function typescript(options?: OverridesOptions & StylisticOptions & Type
|
|
|
728
668
|
*/
|
|
729
669
|
declare function unicorn(options?: UnicornOptions): ConfigArray;
|
|
730
670
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
671
|
/**
|
|
737
672
|
* Configures and returns an ESLint configuration array for Vitest.
|
|
738
673
|
*
|
|
@@ -752,13 +687,6 @@ declare function unicorn(options?: UnicornOptions): ConfigArray;
|
|
|
752
687
|
*/
|
|
753
688
|
declare function vitest(options?: OverridesOptions & TestingOptions): Promise<ConfigArray>;
|
|
754
689
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
690
|
/**
|
|
763
691
|
* Generates an ESLint configuration for YAML files.
|
|
764
692
|
*
|
|
@@ -772,13 +700,6 @@ declare function vitest(options?: OverridesOptions & TestingOptions): Promise<Co
|
|
|
772
700
|
*/
|
|
773
701
|
declare function yaml(options?: FilesOptions & OverridesOptions & StylisticOptions): Promise<ConfigArray>;
|
|
774
702
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
703
|
/**
|
|
783
704
|
* Creates an ESLint configuration array based on the provided options and user configurations.
|
|
784
705
|
*
|
|
@@ -813,10 +734,6 @@ declare const GLOB_HTML = "**/*.htm?(l)";
|
|
|
813
734
|
*/
|
|
814
735
|
declare const GLOB_TESTS: string[];
|
|
815
736
|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
737
|
/**
|
|
821
738
|
* A utility function to handle the default export of a module.
|
|
822
739
|
*
|
|
@@ -843,6 +760,13 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
843
760
|
* @returns The root directory of the workspace.
|
|
844
761
|
*/
|
|
845
762
|
declare function getWorkspaceRoot(dir: string, candidateRoot: string): string;
|
|
763
|
+
/**
|
|
764
|
+
* Returns the most probable filename for the TsConfig.
|
|
765
|
+
*
|
|
766
|
+
* @param dir - The directory into which the tsconfig.json is located.
|
|
767
|
+
* @returns The tsconfig.*.json file
|
|
768
|
+
*/
|
|
769
|
+
declare function getTsConfigFileName(dir: string): string | undefined;
|
|
846
770
|
/**
|
|
847
771
|
* Checks if a package is within the specified scope.
|
|
848
772
|
*
|
|
@@ -880,5 +804,5 @@ type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
|
880
804
|
*/
|
|
881
805
|
declare function resolveSubOptions<K extends keyof CreateConfigOptions>(options: CreateConfigOptions, key: K): ResolvedOptions<CreateConfigOptions[K]>;
|
|
882
806
|
|
|
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 };
|
|
807
|
+
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 };
|
|
884
808
|
export type { AngularOptions, Awaitable, CreateConfigOptions, FilesOptions, FormattersOptions, NgrxOperators, NgrxOptions, OverridesOptions, RegExpOptions, ResolvedOptions, StylisticConfig, StylisticOptions, TailwindcssParserPerGlobOptions, TestingOptions, TypeScriptErasableSyntaxOnlyOptions, TypeScriptParserOptions, UnicornOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,6 @@ import { statSync } from 'node:fs';
|
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { resolve, dirname, join } from 'node:path';
|
|
6
6
|
import process from 'node:process';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
7
|
import eslint from '@eslint/js';
|
|
9
8
|
import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions';
|
|
10
9
|
import unusedImports from 'eslint-plugin-unused-imports';
|
|
@@ -75,7 +74,7 @@ const GLOB_EXCLUDE = [
|
|
|
75
74
|
"**/prettier-types.ts"
|
|
76
75
|
];
|
|
77
76
|
|
|
78
|
-
const SCOPE_URL =
|
|
77
|
+
const SCOPE_URL = import.meta.dirname;
|
|
79
78
|
const IS_CWD_IN_SCOPE = isPackageExists("@fabdeh/eslint-config");
|
|
80
79
|
async function interopDefault(m) {
|
|
81
80
|
const resolved = await m;
|
|
@@ -89,8 +88,8 @@ function fileExists(path) {
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
function getWorkspaceRoot(dir, candidateRoot) {
|
|
92
|
-
if (process.env.
|
|
93
|
-
return process.env.
|
|
91
|
+
if (process.env.NX_WORKSPACE_ROOT) {
|
|
92
|
+
return process.env.NX_WORKSPACE_ROOT;
|
|
94
93
|
}
|
|
95
94
|
if (dirname(dir) === dir) {
|
|
96
95
|
return candidateRoot;
|
|
@@ -104,6 +103,9 @@ function getWorkspaceRoot(dir, candidateRoot) {
|
|
|
104
103
|
return getWorkspaceRoot(dirname(dir), candidateRoot);
|
|
105
104
|
}
|
|
106
105
|
}
|
|
106
|
+
function getTsConfigFileName(dir) {
|
|
107
|
+
return ["tsconfig.base.json", "tsconfig.json"].map((filename) => ({ filename, path: join(dir, filename) })).filter(({ path }) => fileExists(path)).map(({ filename }) => filename).at(0);
|
|
108
|
+
}
|
|
107
109
|
function isPackageInScope(name) {
|
|
108
110
|
return isPackageExists(name, { paths: [SCOPE_URL] });
|
|
109
111
|
}
|
|
@@ -145,7 +147,7 @@ function resolveSubOptions(options, key) {
|
|
|
145
147
|
|
|
146
148
|
async function angular(options = {}) {
|
|
147
149
|
const angularEslint = await interopDefault(import('angular-eslint'));
|
|
148
|
-
const { enableAccessibilityRules = true, tsOverrides = {}, htmlOverrides = {}, prefix = "app" } = options;
|
|
150
|
+
const { enableAccessibilityRules = true, tsOverrides = {}, htmlOverrides = {}, prefix = "app", ignoreClassNamePatternForInjectableProvidedIn: ignoreClassNamePattern, componentStylesMode = "string", preferOnPushOnly = true } = options;
|
|
149
151
|
return tseslint.config(
|
|
150
152
|
{
|
|
151
153
|
name: "fabdeh/angular/rules",
|
|
@@ -193,6 +195,7 @@ async function angular(options = {}) {
|
|
|
193
195
|
style: "kebab-case"
|
|
194
196
|
}
|
|
195
197
|
],
|
|
198
|
+
"@angular-eslint/consistent-component-styles": ["error", componentStylesMode],
|
|
196
199
|
"@angular-eslint/contextual-decorator": "error",
|
|
197
200
|
"@angular-eslint/directive-selector": [
|
|
198
201
|
"error",
|
|
@@ -210,12 +213,18 @@ async function angular(options = {}) {
|
|
|
210
213
|
"@angular-eslint/no-lifecycle-call": "error",
|
|
211
214
|
"@angular-eslint/no-pipe-impure": "error",
|
|
212
215
|
"@angular-eslint/no-queries-metadata-property": "error",
|
|
216
|
+
"@angular-eslint/no-uncalled-signals": "error",
|
|
217
|
+
"@angular-eslint/prefer-output-emitter-ref": "error",
|
|
213
218
|
"@angular-eslint/prefer-output-readonly": "error",
|
|
214
219
|
"@angular-eslint/prefer-signals": "error",
|
|
220
|
+
...preferOnPushOnly ? { "@angular-eslint/prefer-on-push-component-change-detection": "error" } : {},
|
|
215
221
|
"@angular-eslint/relative-url-prefix": "error",
|
|
222
|
+
"@angular-eslint/require-lifecycle-on-prototype": "error",
|
|
223
|
+
"@angular-eslint/sort-keys-in-type-decorator": "error",
|
|
216
224
|
"@angular-eslint/sort-lifecycle-methods": "error",
|
|
217
225
|
"@angular-eslint/use-component-selector": "error",
|
|
218
226
|
"@angular-eslint/use-component-view-encapsulation": "error",
|
|
227
|
+
"@angular-eslint/use-injectable-provided-in": ignoreClassNamePattern ? ["error", { ignoreClassNamePattern }] : "error",
|
|
219
228
|
"@angular-eslint/use-lifecycle-interface": "error",
|
|
220
229
|
...tsOverrides
|
|
221
230
|
}
|
|
@@ -901,7 +910,7 @@ const SORT_UNION_OR_INTERSECTION_GROUPS = [
|
|
|
901
910
|
];
|
|
902
911
|
|
|
903
912
|
async function perfectionist() {
|
|
904
|
-
const
|
|
913
|
+
const rootDir = await findNearestPackageJsonName() === "@fabdeh/eslint-config" ? void 0 : getWorkspaceRoot(process.cwd(), process.cwd());
|
|
905
914
|
return tseslint.config({
|
|
906
915
|
name: "fabdeh/perfectionist/rules",
|
|
907
916
|
files: [GLOB_SRC],
|
|
@@ -914,7 +923,10 @@ async function perfectionist() {
|
|
|
914
923
|
"error",
|
|
915
924
|
{
|
|
916
925
|
groups: SORT_IMPORT_GROUPS,
|
|
917
|
-
|
|
926
|
+
tsconfig: rootDir ? {
|
|
927
|
+
rootDir,
|
|
928
|
+
filename: getTsConfigFileName(rootDir)
|
|
929
|
+
} : void 0,
|
|
918
930
|
order: "asc",
|
|
919
931
|
type: "natural",
|
|
920
932
|
newlinesBetween: "never"
|
|
@@ -1344,6 +1356,8 @@ async function typescript(options = {}) {
|
|
|
1344
1356
|
erasableSyntaxOnlyPlugin = erasableSyntaxOnly;
|
|
1345
1357
|
erasableSyntaxOnlyRules = erasableSyntaxOnly.configs.recommended.rules;
|
|
1346
1358
|
}
|
|
1359
|
+
const tsconfigRootDir = getWorkspaceRoot(process.cwd(), process.cwd());
|
|
1360
|
+
const defaultProject = getTsConfigFileName(tsconfigRootDir);
|
|
1347
1361
|
return tseslint.config(
|
|
1348
1362
|
{
|
|
1349
1363
|
name: "fabdeh/typescript/setup",
|
|
@@ -1355,9 +1369,9 @@ async function typescript(options = {}) {
|
|
|
1355
1369
|
sourceType: "module",
|
|
1356
1370
|
projectService: {
|
|
1357
1371
|
allowDefaultProject: ["*.js"],
|
|
1358
|
-
defaultProject
|
|
1372
|
+
defaultProject
|
|
1359
1373
|
},
|
|
1360
|
-
tsconfigRootDir
|
|
1374
|
+
tsconfigRootDir,
|
|
1361
1375
|
...parserOptions
|
|
1362
1376
|
}
|
|
1363
1377
|
}
|
|
@@ -1465,7 +1479,6 @@ function unicorn(options = {}) {
|
|
|
1465
1479
|
"unicorn/no-anonymous-default-export": "error",
|
|
1466
1480
|
"unicorn/no-array-for-each": "error",
|
|
1467
1481
|
"unicorn/no-array-method-this-argument": "error",
|
|
1468
|
-
"unicorn/no-array-push-push": "error",
|
|
1469
1482
|
"unicorn/no-array-reduce": "error",
|
|
1470
1483
|
"unicorn/no-await-expression-member": "error",
|
|
1471
1484
|
"unicorn/no-await-in-promise-methods": "error",
|
|
@@ -1476,7 +1489,6 @@ function unicorn(options = {}) {
|
|
|
1476
1489
|
"unicorn/no-instanceof-builtins": "error",
|
|
1477
1490
|
"unicorn/no-invalid-fetch-options": "error",
|
|
1478
1491
|
"unicorn/no-invalid-remove-event-listener": "error",
|
|
1479
|
-
"unicorn/no-length-as-slice-end": "error",
|
|
1480
1492
|
"unicorn/no-lonely-if": "error",
|
|
1481
1493
|
"unicorn/no-magic-array-flat-depth": "error",
|
|
1482
1494
|
"unicorn/no-negated-condition": "error",
|
|
@@ -1490,6 +1502,9 @@ function unicorn(options = {}) {
|
|
|
1490
1502
|
"unicorn/no-this-assignment": "error",
|
|
1491
1503
|
"unicorn/no-typeof-undefined": "error",
|
|
1492
1504
|
"unicorn/no-unnecessary-await": "error",
|
|
1505
|
+
"unicorn/no-unnecessary-array-flat-depth": "error",
|
|
1506
|
+
"unicorn/no-unnecessary-array-splice-count": "error",
|
|
1507
|
+
"unicorn/no-unnecessary-slice-end": "error",
|
|
1493
1508
|
"unicorn/no-unused-properties": "warn",
|
|
1494
1509
|
"unicorn/no-useless-fallback-in-spread": "error",
|
|
1495
1510
|
"unicorn/no-useless-length-check": "error",
|
|
@@ -1510,6 +1525,7 @@ function unicorn(options = {}) {
|
|
|
1510
1525
|
"unicorn/prefer-date-now": "error",
|
|
1511
1526
|
"unicorn/prefer-default-parameters": "error",
|
|
1512
1527
|
"unicorn/prefer-export-from": "error",
|
|
1528
|
+
"unicorn/prefer-import-meta-properties": "error",
|
|
1513
1529
|
"unicorn/prefer-includes": "error",
|
|
1514
1530
|
"unicorn/prefer-keyboard-event-key": "error",
|
|
1515
1531
|
"unicorn/prefer-logical-operator-over-ternary": "error",
|
|
@@ -1525,6 +1541,7 @@ function unicorn(options = {}) {
|
|
|
1525
1541
|
"unicorn/prefer-regexp-test": "error",
|
|
1526
1542
|
"unicorn/prefer-set-has": "error",
|
|
1527
1543
|
"unicorn/prefer-set-size": "error",
|
|
1544
|
+
"unicorn/prefer-single-call": "error",
|
|
1528
1545
|
"unicorn/prefer-spread": "error",
|
|
1529
1546
|
"unicorn/prefer-string-raw": "error",
|
|
1530
1547
|
"unicorn/prefer-string-replace-all": "error",
|
|
@@ -2016,4 +2033,4 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
2016
2033
|
return tseslint.config(...await Promise.all(configs), ...await Promise.all(userConfigs));
|
|
2017
2034
|
}
|
|
2018
2035
|
|
|
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 };
|
|
2036
|
+
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 };
|
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.5.0",
|
|
5
|
+
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39",
|
|
6
6
|
"description": "My personal eslint config preset",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Fabien Dehopré",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dist"
|
|
38
38
|
],
|
|
39
39
|
"engines": {
|
|
40
|
-
"node": "
|
|
40
|
+
"node": "^20.11.1 || ^22.11.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "unbuild",
|
|
@@ -78,63 +78,63 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@antfu/install-pkg": "^1.
|
|
82
|
-
"@clack/prompts": "^0.10.
|
|
83
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.
|
|
84
|
-
"@eslint/js": "^9.
|
|
85
|
-
"@eslint/markdown": "^6.
|
|
86
|
-
"@ngrx/eslint-plugin": "^19.
|
|
87
|
-
"@stylistic/eslint-plugin": "^4.
|
|
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": "^
|
|
81
|
+
"@antfu/install-pkg": "^1.1.0",
|
|
82
|
+
"@clack/prompts": "^0.10.1",
|
|
83
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
84
|
+
"@eslint/js": "^9.28.0",
|
|
85
|
+
"@eslint/markdown": "^6.5.0",
|
|
86
|
+
"@ngrx/eslint-plugin": "^19.2.1",
|
|
87
|
+
"@stylistic/eslint-plugin": "^4.4.1",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^8.33.1",
|
|
89
|
+
"@typescript-eslint/parser": "^8.33.1",
|
|
90
|
+
"@typescript-eslint/utils": "^8.33.1",
|
|
91
|
+
"@vitest/eslint-plugin": "^1.2.1",
|
|
92
|
+
"angular-eslint": "^20.0.0",
|
|
93
93
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
94
|
-
"eslint-flat-config-utils": "^2.0
|
|
94
|
+
"eslint-flat-config-utils": "^2.1.0",
|
|
95
95
|
"eslint-merge-processors": "^2.0.0",
|
|
96
|
-
"eslint-plugin-import-x": "^4.
|
|
96
|
+
"eslint-plugin-import-x": "^4.15.1",
|
|
97
97
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
98
|
-
"eslint-plugin-jsdoc": "^50.
|
|
99
|
-
"eslint-plugin-jsonc": "^2.
|
|
100
|
-
"eslint-plugin-perfectionist": "^4.
|
|
98
|
+
"eslint-plugin-jsdoc": "^50.7.1",
|
|
99
|
+
"eslint-plugin-jsonc": "^2.20.1",
|
|
100
|
+
"eslint-plugin-perfectionist": "^4.14.0",
|
|
101
101
|
"eslint-plugin-prefer-arrow-functions": "^3.6.2",
|
|
102
|
-
"eslint-plugin-regexp": "^2.
|
|
103
|
-
"eslint-plugin-testing-library": "^7.
|
|
102
|
+
"eslint-plugin-regexp": "^2.8.0",
|
|
103
|
+
"eslint-plugin-testing-library": "^7.4.0",
|
|
104
104
|
"eslint-plugin-toml": "^0.12.0",
|
|
105
|
-
"eslint-plugin-unicorn": "^
|
|
105
|
+
"eslint-plugin-unicorn": "^59.0.1",
|
|
106
106
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
107
|
-
"eslint-plugin-yml": "^1.
|
|
108
|
-
"globals": "^16.
|
|
107
|
+
"eslint-plugin-yml": "^1.18.0",
|
|
108
|
+
"globals": "^16.2.0",
|
|
109
109
|
"jsonc-eslint-parser": "^2.4.0",
|
|
110
110
|
"local-pkg": "^1.1.1",
|
|
111
111
|
"toml-eslint-parser": "^0.10.0",
|
|
112
|
-
"typescript-eslint": "^8.
|
|
112
|
+
"typescript-eslint": "^8.33.1",
|
|
113
113
|
"yaml-eslint-parser": "^1.3.0"
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@angular/core": "^
|
|
117
|
-
"@commitlint/cli": "^19.8.
|
|
118
|
-
"@commitlint/config-conventional": "^19.8.
|
|
119
|
-
"@commitlint/cz-commitlint": "^19.8.
|
|
116
|
+
"@angular/core": "^20.0.2",
|
|
117
|
+
"@commitlint/cli": "^19.8.1",
|
|
118
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
119
|
+
"@commitlint/cz-commitlint": "^19.8.1",
|
|
120
120
|
"@fabdeh/eslint-config": "workspace:*",
|
|
121
|
-
"@ngrx/effects": "^19.
|
|
122
|
-
"@ngrx/operators": "^19.
|
|
123
|
-
"@ngrx/signals": "^19.
|
|
124
|
-
"@ngrx/store": "^19.
|
|
121
|
+
"@ngrx/effects": "^19.2.1",
|
|
122
|
+
"@ngrx/operators": "^19.2.1",
|
|
123
|
+
"@ngrx/signals": "^19.2.1",
|
|
124
|
+
"@ngrx/store": "^19.2.1",
|
|
125
125
|
"@prettier/plugin-xml": "^3.4.1",
|
|
126
|
-
"@testing-library/angular": "^17.
|
|
126
|
+
"@testing-library/angular": "^17.4.0",
|
|
127
127
|
"@testing-library/jest-dom": "^6.6.3",
|
|
128
128
|
"@types/fs-extra": "^11.0.4",
|
|
129
|
-
"@types/node": "^22.
|
|
130
|
-
"bumpp": "^10.1.
|
|
131
|
-
"changelogithub": "^13.
|
|
129
|
+
"@types/node": "^22.15.30",
|
|
130
|
+
"bumpp": "^10.1.1",
|
|
131
|
+
"changelogithub": "^13.15.0",
|
|
132
132
|
"commitizen": "^4.3.1",
|
|
133
|
-
"eslint": "^9.
|
|
134
|
-
"eslint-plugin-erasable-syntax-only": "^0.3.
|
|
133
|
+
"eslint": "^9.28.0",
|
|
134
|
+
"eslint-plugin-erasable-syntax-only": "^0.3.1",
|
|
135
135
|
"eslint-plugin-format": "^1.0.1",
|
|
136
136
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
137
|
-
"execa": "^9.
|
|
137
|
+
"execa": "^9.6.0",
|
|
138
138
|
"fast-glob": "^3.3.3",
|
|
139
139
|
"fs-extra": "^11.3.0",
|
|
140
140
|
"inquirer": "^9.3.7",
|
|
@@ -142,11 +142,11 @@
|
|
|
142
142
|
"jiti": "^2.4.2",
|
|
143
143
|
"nano-staged": "^0.8.0",
|
|
144
144
|
"prettier-plugin-slidev": "^1.0.5",
|
|
145
|
-
"simple-git-hooks": "^2.
|
|
145
|
+
"simple-git-hooks": "^2.13.0",
|
|
146
146
|
"tailwindcss": "^3.4.17",
|
|
147
|
-
"typescript": "^5.8.
|
|
147
|
+
"typescript": "^5.8.3",
|
|
148
148
|
"unbuild": "^3.5.0",
|
|
149
|
-
"vitest": "^3.
|
|
149
|
+
"vitest": "^3.2.2"
|
|
150
150
|
},
|
|
151
151
|
"pnpm": {
|
|
152
152
|
"overrides": {
|