Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 0549d94

Browse files
committed
Define Extends
1 parent 950a4ed commit 0549d94

File tree

4 files changed

+31
-1
lines changed

4 files changed

+31
-1
lines changed

src/extends/eslint.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Eslint extensions.
3+
*/
4+
export type EslintExtensions = 'eslint:recommended' | 'eslint:all';

src/extends/index.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { LiteralUnion } from '../utility-types';
2+
import type { EslintExtensions } from './eslint';
3+
4+
/**
5+
* All known extensions.
6+
*/
7+
export type KnownExtensions = LiteralUnion<EslintExtensions>;
8+
9+
/**
10+
* Extending Configuration Files.
11+
*
12+
* @see [Extends](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
13+
*/
14+
export type Extends = KnownExtensions | Array<KnownExtensions>;

src/index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Environments } from './env';
2+
import type { Extends } from './extends';
23
import type { Overrides } from './overrides';
34
import type { ParserOptions } from './parser-options';
45
import type { Rules } from './rules';
@@ -16,7 +17,12 @@ export interface EslintConfig {
1617
* @see [Environments](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments)
1718
*/
1819
env?: Environments;
19-
extends?: string[];
20+
/**
21+
* Extending Configuration Files.
22+
*
23+
* @see [Extends](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
24+
*/
25+
extends?: Extends;
2026
parser?: string;
2127
parserOptions?: ParserOptions;
2228
plugins?: string[];

src/utility-types.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
3+
*
4+
* @see [copied from issue](https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609)
5+
* */
6+
export type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });

0 commit comments

Comments
 (0)