@fabdeh/eslint-config 0.1.3 → 0.2.1
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 +16 -64
- package/dist/index.mjs +201 -198
- package/package.json +69 -38
- package/dist/index.cjs +0 -1988
- package/dist/index.d.cts +0 -790
- package/dist/index.d.ts +0 -790
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
|
*/
|
|
@@ -196,7 +187,7 @@ interface StylisticOptions {
|
|
|
196
187
|
*/
|
|
197
188
|
interface TypeScriptParserOptions {
|
|
198
189
|
/**
|
|
199
|
-
*
|
|
190
|
+
* Additional parser options for TypeScript.
|
|
200
191
|
*/
|
|
201
192
|
parserOptions?: TSESLint.FlatConfig.ParserOptions;
|
|
202
193
|
}
|
|
@@ -316,7 +307,7 @@ interface CreateConfigOptions {
|
|
|
316
307
|
*
|
|
317
308
|
* @default auto-detected
|
|
318
309
|
*/
|
|
319
|
-
typescript?: OverridesOptions & TypeScriptParserOptions;
|
|
310
|
+
typescript?: boolean | (OverridesOptions & TypeScriptParserOptions);
|
|
320
311
|
/**
|
|
321
312
|
* Enable stylistic rules.
|
|
322
313
|
*
|
|
@@ -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.
|
|
@@ -684,10 +648,9 @@ declare function yaml(options?: FilesOptions & OverridesOptions & StylisticOptio
|
|
|
684
648
|
* @param options - Configuration options that extend `ConfigWithExtends` and `CreateConfigOptions`.
|
|
685
649
|
* @param userConfigs - Additional user configurations that can be awaited.
|
|
686
650
|
* @returns A promise that resolves to a `ConfigArray`.
|
|
687
|
-
* @throws Will throw an error if both `jest` and `vitest` are enabled.
|
|
688
651
|
* @example
|
|
689
652
|
* ```typescript
|
|
690
|
-
* const config = await createConfig({
|
|
653
|
+
* const config = await createConfig({ vitest: true, typescript: { parserOptions: { project: './tsconfig.json' } } });
|
|
691
654
|
* ```
|
|
692
655
|
*/
|
|
693
656
|
declare function createConfig(options?: ConfigWithExtends & CreateConfigOptions, ...userConfigs: Awaitable<ConfigWithExtends | ConfigWithExtends[]>[]): Promise<ConfigArray>;
|
|
@@ -713,26 +676,6 @@ declare const GLOB_HTML = "**/*.htm?(l)";
|
|
|
713
676
|
*/
|
|
714
677
|
declare const GLOB_TESTS: string[];
|
|
715
678
|
|
|
716
|
-
/**
|
|
717
|
-
* Determines if the current environment is an editor environment.
|
|
718
|
-
*
|
|
719
|
-
* This function checks various environment variables to determine if the code
|
|
720
|
-
* is running within a known editor environment such as VSCode, IntelliJ, JetBrains,
|
|
721
|
-
* Vim, or NeoVim. It also ensures that the code is not running in a CI environment
|
|
722
|
-
* or within git hooks.
|
|
723
|
-
*
|
|
724
|
-
* @returns `true` if the code is running in an editor environment, otherwise `false`.
|
|
725
|
-
*/
|
|
726
|
-
declare function isInEditorEnv(): boolean;
|
|
727
|
-
/**
|
|
728
|
-
* Converts a value to an array. If the value is already an array, it returns the value as is.
|
|
729
|
-
* Otherwise, it wraps the value in an array.
|
|
730
|
-
*
|
|
731
|
-
* @template T - The type of the value.
|
|
732
|
-
* @param value - The value to convert to an array.
|
|
733
|
-
* @returns The value converted to an array.
|
|
734
|
-
*/
|
|
735
|
-
declare function toArray<T>(value: T | T[]): T[];
|
|
736
679
|
/**
|
|
737
680
|
* A utility function to handle the default export of a module.
|
|
738
681
|
*
|
|
@@ -786,5 +729,14 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
786
729
|
* @returns The name of the nearest package.json
|
|
787
730
|
*/
|
|
788
731
|
declare function findNearestPackageJsonName(directoryPath?: string): Promise<string>;
|
|
732
|
+
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
733
|
+
/**
|
|
734
|
+
* Returns the object representation of the configuration or an empty object if it is a boolean.
|
|
735
|
+
*
|
|
736
|
+
* @param options - The {@link CreateConfigOptions} object to extract the sub-options from.
|
|
737
|
+
* @param key - The property name.
|
|
738
|
+
* @returns An object representing the required options.
|
|
739
|
+
*/
|
|
740
|
+
declare function resolveSubOptions<K extends keyof CreateConfigOptions>(options: CreateConfigOptions, key: K): ResolvedOptions<CreateConfigOptions[K]>;
|
|
789
741
|
|
|
790
|
-
export { type AngularOptions, type Awaitable, type CreateConfigOptions, type FilesOptions, type FormattersOptions, GLOB_HTML, GLOB_JS, GLOB_SRC, GLOB_TESTS, GLOB_TS, type
|
|
742
|
+
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, type ResolvedOptions, 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, resolveSubOptions, sortPackageJson, sortTsConfig, stylistic, tailwindcss, toml, typescript, unicorn, vitest, yaml };
|