@fabdeh/eslint-config 0.1.2 → 0.2.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 +2 -3
- package/dist/index.d.mts +15 -64
- package/dist/index.mjs +135 -191
- package/package.json +70 -38
- package/dist/index.cjs +0 -2001
- package/dist/index.d.cts +0 -782
- package/dist/index.d.ts +0 -782
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- Designed to work with TypeScript, JSX, etc. Out-of-box.
|
|
10
10
|
- Opinionated, but [very customizable](#customization)
|
|
11
11
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new), compose easily!
|
|
12
|
-
- Automatic [Angular](#angular), [NGRX](#ngrx), [TailwindCSS](#tailwindcc), [
|
|
12
|
+
- Automatic [Angular](#angular), [NGRX](#ngrx), [TailwindCSS](#tailwindcc), [Vitest](#vitest) support when the corresponding dependency is detected.
|
|
13
13
|
<!--- - Optional [formatters](#formatters) support for formatting CSS, HTML, XML, etc. --->
|
|
14
14
|
- **Style principle**: Minimal for reading, stable for diff, consistent
|
|
15
15
|
- Sorted imports, dangling commas
|
|
@@ -121,8 +121,7 @@ export default createConfig({
|
|
|
121
121
|
angular: true,
|
|
122
122
|
ngrx: true,
|
|
123
123
|
|
|
124
|
-
// Disable
|
|
125
|
-
jest: false,
|
|
124
|
+
// Disable vitest
|
|
126
125
|
vitest: false,
|
|
127
126
|
|
|
128
127
|
// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
|
package/dist/index.d.mts
CHANGED
|
@@ -140,15 +140,6 @@ interface VendoredPrettierOptionsRequired {
|
|
|
140
140
|
* A type that can be awaited. Promise<T> or T.
|
|
141
141
|
*/
|
|
142
142
|
type Awaitable<T> = Promise<T> | T;
|
|
143
|
-
/**
|
|
144
|
-
* Options for determining if the code is running in an editor environment.
|
|
145
|
-
*/
|
|
146
|
-
interface IsInEditorOptions {
|
|
147
|
-
/**
|
|
148
|
-
* Optional property that allows specifying if the code is running in an editor environment.
|
|
149
|
-
*/
|
|
150
|
-
isInEditor?: boolean;
|
|
151
|
-
}
|
|
152
143
|
/**
|
|
153
144
|
* Interface representing options for overriding default ESLint rules.
|
|
154
145
|
*/
|
|
@@ -343,13 +334,7 @@ interface CreateConfigOptions {
|
|
|
343
334
|
*/
|
|
344
335
|
ngrx?: NgrxOptions | boolean;
|
|
345
336
|
/**
|
|
346
|
-
* Options for the
|
|
347
|
-
*
|
|
348
|
-
* @default auto-detect based on dependencies.
|
|
349
|
-
*/
|
|
350
|
-
jest?: boolean | (OverridesOptions & TestingOptions);
|
|
351
|
-
/**
|
|
352
|
-
* Options for the vitest linting rules. This option is mutually exclusive with jest.
|
|
337
|
+
* Options for the vitest linting rules
|
|
353
338
|
*
|
|
354
339
|
* @default auto-detect based on dependencies.
|
|
355
340
|
*/
|
|
@@ -397,12 +382,6 @@ interface CreateConfigOptions {
|
|
|
397
382
|
* @default false
|
|
398
383
|
*/
|
|
399
384
|
formatters?: FormattersOptions | boolean;
|
|
400
|
-
/**
|
|
401
|
-
* Control to disable some rules in editors.
|
|
402
|
-
*
|
|
403
|
-
* @default auto-detect based on the process.env
|
|
404
|
-
*/
|
|
405
|
-
isInEditor?: boolean;
|
|
406
385
|
}
|
|
407
386
|
|
|
408
387
|
/**
|
|
@@ -453,30 +432,15 @@ declare function imports(options?: StylisticOptions): ConfigArray;
|
|
|
453
432
|
* handling based on the environment (editor or not).
|
|
454
433
|
*
|
|
455
434
|
* @param options - Configuration options for the JavaScript setup.
|
|
456
|
-
* @param options.isInEditor - Indicates if the configuration is being used in an editor.
|
|
457
435
|
* @param options.overrides - Additional rule overrides.
|
|
458
436
|
* @param options.allowAngularDecorator - Allows specific Angular decorators to be used without new-cap errors.
|
|
459
437
|
* @returns A configuration array for ESLint.
|
|
460
438
|
* @example
|
|
461
439
|
* ```typescript
|
|
462
|
-
* const config = javascript({
|
|
440
|
+
* const config = javascript({ allowAngularDecorator: true });
|
|
463
441
|
* ```
|
|
464
442
|
*/
|
|
465
|
-
declare function javascript(options?:
|
|
466
|
-
allowAngularDecorator?: boolean;
|
|
467
|
-
}): ConfigArray;
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Generates an ESLint configuration for Jest testing environments.
|
|
471
|
-
*
|
|
472
|
-
* @param options - Configuration options for the Jest setup.
|
|
473
|
-
* @param options.overrides - Custom rule overrides to apply.
|
|
474
|
-
* @param options.useJestDom - Whether to include `@testing-library/jest-dom` plugin. Defaults to checking if the package exists.
|
|
475
|
-
* @param options.useTestingLibrary - Whether to include `@testing-library/angular` plugin. Defaults to checking if the package exists.
|
|
476
|
-
* @param options.stylistic - Whether to include stylistic rules. Defaults to `true`.
|
|
477
|
-
* @returns A promise that resolves to a `ConfigArray` containing the ESLint configuration.
|
|
478
|
-
*/
|
|
479
|
-
declare function jest(options?: OverridesOptions & StylisticOptions & TestingOptions): Promise<ConfigArray>;
|
|
443
|
+
declare function javascript(options?: OverridesOptions): ConfigArray;
|
|
480
444
|
|
|
481
445
|
/**
|
|
482
446
|
* Generates a configuration array for JSDoc rules.
|
|
@@ -557,12 +521,13 @@ declare function ngrx(options?: NgrxOptions): Promise<ConfigArray>;
|
|
|
557
521
|
*
|
|
558
522
|
* This configuration includes rules for sorting various elements in the codebase
|
|
559
523
|
* such as exports, imports, intersection types, named exports, named imports,
|
|
560
|
-
* switch cases, and union types. The sorting order is set to ascending and the
|
|
524
|
+
* switch cases, and union types. The sorting order is set to "ascending" and the
|
|
561
525
|
* type is natural.
|
|
562
526
|
*
|
|
563
527
|
* @returns The configuration array for the "perfectionist" plugin.
|
|
528
|
+
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
564
529
|
*/
|
|
565
|
-
declare function perfectionist(): ConfigArray
|
|
530
|
+
declare function perfectionist(): Promise<ConfigArray>;
|
|
566
531
|
|
|
567
532
|
/**
|
|
568
533
|
* Configures ESLint rules for sorting keys and array values in `package.json` files.
|
|
@@ -683,10 +648,9 @@ declare function yaml(options?: FilesOptions & OverridesOptions & StylisticOptio
|
|
|
683
648
|
* @param options - Configuration options that extend `ConfigWithExtends` and `CreateConfigOptions`.
|
|
684
649
|
* @param userConfigs - Additional user configurations that can be awaited.
|
|
685
650
|
* @returns A promise that resolves to a `ConfigArray`.
|
|
686
|
-
* @throws Will throw an error if both `jest` and `vitest` are enabled.
|
|
687
651
|
* @example
|
|
688
652
|
* ```typescript
|
|
689
|
-
* const config = await createConfig({
|
|
653
|
+
* const config = await createConfig({ vitest: true, typescript: { parserOptions: { project: './tsconfig.json' } } });
|
|
690
654
|
* ```
|
|
691
655
|
*/
|
|
692
656
|
declare function createConfig(options?: ConfigWithExtends & CreateConfigOptions, ...userConfigs: Awaitable<ConfigWithExtends | ConfigWithExtends[]>[]): Promise<ConfigArray>;
|
|
@@ -712,26 +676,6 @@ declare const GLOB_HTML = "**/*.htm?(l)";
|
|
|
712
676
|
*/
|
|
713
677
|
declare const GLOB_TESTS: string[];
|
|
714
678
|
|
|
715
|
-
/**
|
|
716
|
-
* Determines if the current environment is an editor environment.
|
|
717
|
-
*
|
|
718
|
-
* This function checks various environment variables to determine if the code
|
|
719
|
-
* is running within a known editor environment such as VSCode, IntelliJ, JetBrains,
|
|
720
|
-
* Vim, or NeoVim. It also ensures that the code is not running in a CI environment
|
|
721
|
-
* or within git hooks.
|
|
722
|
-
*
|
|
723
|
-
* @returns `true` if the code is running in an editor environment, otherwise `false`.
|
|
724
|
-
*/
|
|
725
|
-
declare function isInEditorEnv(): boolean;
|
|
726
|
-
/**
|
|
727
|
-
* Converts a value to an array. If the value is already an array, it returns the value as is.
|
|
728
|
-
* Otherwise, it wraps the value in an array.
|
|
729
|
-
*
|
|
730
|
-
* @template T - The type of the value.
|
|
731
|
-
* @param value - The value to convert to an array.
|
|
732
|
-
* @returns The value converted to an array.
|
|
733
|
-
*/
|
|
734
|
-
declare function toArray<T>(value: T | T[]): T[];
|
|
735
679
|
/**
|
|
736
680
|
* A utility function to handle the default export of a module.
|
|
737
681
|
*
|
|
@@ -778,5 +722,12 @@ declare function isPackageInScope(name: string): boolean;
|
|
|
778
722
|
* @returns A promise that resolves when the operation is complete.
|
|
779
723
|
*/
|
|
780
724
|
declare function ensurePackages(packages: (string | undefined)[]): Promise<void>;
|
|
725
|
+
/**
|
|
726
|
+
* Search for the nearest package.json file and return the `name` property value.
|
|
727
|
+
*
|
|
728
|
+
* @param directoryPath - The folder to start from (default to current working directory).
|
|
729
|
+
* @returns The name of the nearest package.json
|
|
730
|
+
*/
|
|
731
|
+
declare function findNearestPackageJsonName(directoryPath?: string): Promise<string>;
|
|
781
732
|
|
|
782
|
-
export { type AngularOptions, type Awaitable, type CreateConfigOptions, type FilesOptions, type FormattersOptions, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, type
|
|
733
|
+
export { type AngularOptions, type Awaitable, type CreateConfigOptions, type FilesOptions, type FormattersOptions, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, type NgrxOperators, type NgrxOptions, type OverridesOptions, STYLISTIC_CONFIG_DEFAULT, type StylisticConfig, type StylisticOptions, type TestingOptions, type TypeScriptParserOptions, type UnicornOptions, angular, comments, createConfig, ensurePackages, findNearestPackageJsonName, getWorkspaceRoot, ignores, imports, interopDefault, isPackageInScope, javascript, jsdoc, jsonc, markdown, ngrx, perfectionist, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
|