|
| 1 | +import { LiteralUnion } from './utility-types'; |
| 2 | + |
1 | 3 | /**
|
| 4 | + * Set to 3, 5 (default), 6, 7, 8, 9, 10, 11, or 12 to specify the version of ECMAScript syntax you want to use. You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), or 2021 (same as 12) to use the year-based naming. |
2 | 5 | *
|
| 6 | + * @default 5 |
3 | 7 | */
|
4 |
| -export interface ParserOptions { |
5 |
| - ecmaVersion?: 2020; |
| 8 | +export type EcmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021; |
| 9 | + |
| 10 | +/** |
| 11 | + * Set to "script" (default) or "module" if your code is in ECMAScript modules. |
| 12 | + */ |
| 13 | +export type SourceType = 'script' | 'module'; |
| 14 | + |
| 15 | +/** Lib. */ |
| 16 | +export type Lib = LiteralUnion< |
| 17 | + | 'es5' |
| 18 | + | 'es6' |
| 19 | + | 'es2015' |
| 20 | + | 'es7' |
| 21 | + | 'es2016' |
| 22 | + | 'es2017' |
| 23 | + | 'es2018' |
| 24 | + | 'es2019' |
| 25 | + | 'es2020' |
| 26 | + | 'esnext' |
| 27 | + | 'dom' |
| 28 | + | 'dom.iterable' |
| 29 | + | 'webworker' |
| 30 | + | 'webworker.importscripts' |
| 31 | + | 'webworker.iterable' |
| 32 | + | 'scripthost' |
| 33 | + | 'es2015.core' |
| 34 | + | 'es2015.collection' |
| 35 | + | 'es2015.generator' |
| 36 | + | 'es2015.iterable' |
| 37 | + | 'es2015.promise' |
| 38 | + | 'es2015.proxy' |
| 39 | + | 'es2015.reflect' |
| 40 | + | 'es2015.symbol' |
| 41 | + | 'es2015.symbol.wellknown' |
| 42 | + | 'es2016.array.include' |
| 43 | + | 'es2017.object' |
| 44 | + | 'es2017.sharedmemory' |
| 45 | + | 'es2017.string' |
| 46 | + | 'es2017.intl' |
| 47 | + | 'es2017.typedarrays' |
| 48 | + | 'es2018.asyncgenerator' |
| 49 | + | 'es2018.asynciterable' |
| 50 | + | 'es2018.intl' |
| 51 | + | 'es2018.promise' |
| 52 | + | 'es2018.regexp' |
| 53 | + | 'es2019.array' |
| 54 | + | 'es2019.object' |
| 55 | + | 'es2019.string' |
| 56 | + | 'es2019.symbol' |
| 57 | + | 'es2020.bigint' |
| 58 | + | 'es2020.promise' |
| 59 | + | 'es2020.sharedmemory' |
| 60 | + | 'es2020.string' |
| 61 | + | 'es2020.symbol.wellknown' |
| 62 | + | 'es2020.intl' |
| 63 | + | 'esnext.array' |
| 64 | + | 'esnext.symbol' |
| 65 | + | 'esnext.asynciterable' |
| 66 | + | 'esnext.intl' |
| 67 | + | 'esnext.bigint' |
| 68 | + | 'esnext.string' |
| 69 | + | 'esnext.promise' |
| 70 | + | 'esnext.weakref' |
| 71 | + | 'es2016.full' |
| 72 | + | 'es2017.full' |
| 73 | + | 'es2018.full' |
| 74 | + | 'es2019.full' |
| 75 | + | 'es2020.full' |
| 76 | + | 'esnext.full' |
| 77 | + | 'lib' |
| 78 | +>; |
| 79 | + |
| 80 | +/** DebugLevel. */ |
| 81 | +export type DebugLevel = boolean | Array<'eslint' | 'typescript' | 'typescript-eslint'>; |
| 82 | + |
| 83 | +/** |
| 84 | + * Parser options. |
| 85 | + * |
| 86 | + * @see [Specifying Parser Options](https://eslint.org/docs/user-guide/configuring/language-options#specifying-parser-options) |
| 87 | + */ |
| 88 | +export interface ParserOptions extends Partial<Record<string, unknown>> { |
| 89 | + /** |
| 90 | + * Set to 3, 5 (default), 6, 7, 8, 9, 10, 11, or 12 to specify the version of ECMAScript syntax you want to use. You can also set to 2015 (same as 6), 2016 (same as 7), 2017 (same as 8), 2018 (same as 9), 2019 (same as 10), 2020 (same as 11), or 2021 (same as 12) to use the year-based naming. |
| 91 | + * |
| 92 | + * @default 5 |
| 93 | + */ |
| 94 | + ecmaVersion?: EcmaVersion; |
| 95 | + /** |
| 96 | + * Set to "script" (default) or "module" if your code is in ECMAScript modules. |
| 97 | + */ |
| 98 | + sourceType?: SourceType; |
| 99 | + /** |
| 100 | + * An object indicating which additional language features you'd like to use. |
| 101 | + */ |
| 102 | + ecmaFeatures?: { |
| 103 | + /** |
| 104 | + * Allow `return` statements in the global scope. |
| 105 | + */ |
| 106 | + globalReturn?: boolean; |
| 107 | + /** |
| 108 | + * Enable global [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) (if `ecmaVersion` is 5 or greater). |
| 109 | + */ |
| 110 | + impliedStrict?: boolean; |
| 111 | + /** |
| 112 | + * Enable [JSX](https://facebook.github.io/jsx/). |
| 113 | + */ |
| 114 | + jsx?: boolean; |
| 115 | + }; |
| 116 | + jsxPragma?: string; |
| 117 | + jsxFragmentName?: string | null; |
| 118 | + lib?: Lib[]; |
| 119 | + comment?: boolean; |
| 120 | + debugLevel?: DebugLevel; |
| 121 | + errorOnTypeScriptSyntacticAndSemanticIssues?: boolean; |
| 122 | + errorOnUnknownASTType?: boolean; |
| 123 | + extraFileExtensions?: string[]; |
| 124 | + filePath?: string; |
| 125 | + loc?: boolean; |
| 126 | + /** |
| 127 | + * Parser. |
| 128 | + * |
| 129 | + * @see [Working with Custom Parsers](https://eslint.org/docs/developer-guide/working-with-custom-parsers) |
| 130 | + * @see [Specifying Parser](https://eslint.org/docs/user-guide/configuring/plugins#specifying-parser) |
| 131 | + */ |
6 | 132 | parser?: string;
|
7 |
| - project?: any; |
8 |
| - sourceType?: 'module' | '...'; |
| 133 | + project?: string | string[]; |
| 134 | + projectFolderIgnoreList?: Array<string | RegExp>; |
| 135 | + range?: boolean; |
| 136 | + tokens?: boolean; |
| 137 | + tsconfigRootDir?: string; |
| 138 | + useJSXTextNode?: boolean; |
9 | 139 | warnOnUnsupportedTypeScriptVersion?: boolean;
|
10 | 140 | }
|
0 commit comments