Skip to content

Commit

Permalink
Define Extends
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Mar 24, 2021
1 parent 950a4ed commit 0549d94
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/extends/eslint.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Eslint extensions.
*/
export type EslintExtensions = 'eslint:recommended' | 'eslint:all';
14 changes: 14 additions & 0 deletions src/extends/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { LiteralUnion } from '../utility-types';
import type { EslintExtensions } from './eslint';

/**
* All known extensions.
*/
export type KnownExtensions = LiteralUnion<EslintExtensions>;

/**
* Extending Configuration Files.
*
* @see [Extends](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
*/
export type Extends = KnownExtensions | Array<KnownExtensions>;
8 changes: 7 additions & 1 deletion src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Environments } from './env';
import type { Extends } from './extends';
import type { Overrides } from './overrides';
import type { ParserOptions } from './parser-options';
import type { Rules } from './rules';
Expand All @@ -16,7 +17,12 @@ export interface EslintConfig {
* @see [Environments](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments)
*/
env?: Environments;
extends?: string[];
/**
* Extending Configuration Files.
*
* @see [Extends](https://eslint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
*/
extends?: Extends;
parser?: string;
parserOptions?: ParserOptions;
plugins?: string[];
Expand Down
6 changes: 6 additions & 0 deletions src/utility-types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
*
* @see [copied from issue](https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609)
* */
export type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });

0 comments on commit 0549d94

Please sign in to comment.