Skip to content

Commit

Permalink
Update config and JSDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Quadflieg , Christopher committed Jan 2, 2023
1 parent 8ca5721 commit b58f401
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 38 deletions.
33 changes: 29 additions & 4 deletions src/config/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,50 @@ export interface Environments extends Partial<Record<string, boolean>> {
'shared-node-browser'?: boolean;

/**
* Enable all ECMAScript 6 features except for modules (this automatically sets the ecmaVersion parser option to 6).
* Enable all ECMAScript 6 features except for modules (this automatically sets the `ecmaVersion` parser option to 6).
*/
es6?: boolean;

/**
* Adds all ECMAScript 2017 globals and automatically sets the ecmaVersion parser option to 8.
* Adds all ECMAScript 2016 globals and automatically sets the `ecmaVersion` parser option to 7.
*/
es2016?: boolean;

/**
* Adds all ECMAScript 2017 globals and automatically sets the `ecmaVersion` parser option to 8.
*/
es2017?: boolean;

/**
* Adds all ECMAScript 2020 globals and automatically sets the ecmaVersion parser option to 11.
* Adds all ECMAScript 2018 globals and automatically sets the `ecmaVersion` parser option to 9.
*/
es2018?: boolean;

/**
* Adds all ECMAScript 2019 globals and automatically sets the `ecmaVersion` parser option to 10.
*/
es2019?: boolean;

/**
* Adds all ECMAScript 2020 globals and automatically sets the `ecmaVersion` parser option to 11.
*/
es2020?: boolean;

/**
* Adds all ECMAScript 2021 globals and automatically sets the ecmaVersion parser option to 12.
* Adds all ECMAScript 2021 globals and automatically sets the `ecmaVersion` parser option to 12.
*/
es2021?: boolean;

/**
* Adds all ECMAScript 2022 globals and automatically sets the `ecmaVersion` parser option to 13.
*/
es2022?: boolean;

/**
* Adds all ECMAScript 2023 globals and automatically sets the `ecmaVersion` parser option to 14.
*/
es2023?: boolean;

/**
* Web workers global variables.
*/
Expand Down
5 changes: 3 additions & 2 deletions src/config/extends/typescript-eslint.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/**
* Typescript eslint extensions.
*
* @see [Typescript eslint extensions](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md#configuration)
* @see [Typescript eslint extensions](https://typescript-eslint.io/linting/configs#recommended-configurations)
*/
export type TypescriptEslintExtensions =
| 'plugin:@typescript-eslint/recommended'
| 'plugin:@typescript-eslint/recommended-requiring-type-checking';
| 'plugin:@typescript-eslint/recommended-requiring-type-checking'
| 'plugin:@typescript-eslint/strict';
34 changes: 17 additions & 17 deletions src/config/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ import type { Settings } from './settings';
/**
* ESLint Configuration.
*
* @see [ESLint Configuration](https://ESLint.org/docs/user-guide/configuring/)
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/)
*/
export interface ESLintConfig {
/**
* @see [Using Configuration Files](https://ESLint.org/docs/user-guide/configuring/configuration-files#using-configuration-files)
* @see [Using Configuration Files](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#using-configuration-files)
*/
root?: boolean;

/**
* Tell ESLint to ignore specific files and directories.
*
* @see [Ignore Patterns](https://ESLint.org/docs/user-guide/configuring/ignoring-code)
* @see [Ignore Patterns](https://eslint.org/docs/latest/user-guide/configuring/ignoring-code)
*/
ignorePatterns?: string[];

/**
* An environment provides predefined global variables.
*
* @see [Environments](https://ESLint.org/docs/user-guide/configuring/language-options#specifying-environments)
* @see [Environments](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-environments)
*/
env?: Environments;

/**
* Extending Configuration Files.
*
* @see [Extends](https://ESLint.org/docs/user-guide/configuring/configuration-files#extending-configuration-files)
* @see [Extends](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#extending-configuration-files)
*/
extends?: Extends;

/**
* Specifying Globals.
*
* @see [Globals](https://ESLint.org/docs/user-guide/configuring/language-options#specifying-globals)
* @see [Globals](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-globals)
*/
globals?: Record<
string,
Expand All @@ -51,65 +51,65 @@ export interface ESLintConfig {
/**
* Parser.
*
* @see [Working with Custom Parsers](https://ESLint.org/docs/developer-guide/working-with-custom-parsers)
* @see [Specifying Parser](https://ESLint.org/docs/user-guide/configuring/plugins#specifying-parser)
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers)
* @see [Specifying Parser](https://eslint.org/docs/latest/user-guide/configuring/plugins#configure-a-parser)
*/
parser?: Parser;

/**
* Parser Options.
*
* @see [Working with Custom Parsers](https://ESLint.org/docs/developer-guide/working-with-custom-parsers)
* @see [Specifying Parser Options](https://ESLint.org/docs/user-guide/configuring/language-options#specifying-parser-options)
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/developer-guide/working-with-custom-parsers)
* @see [Specifying Parser Options](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options)
*/
parserOptions?: ParserOptions;

/**
* Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
*
* @see [Configuring Plugins](https://ESLint.org/docs/user-guide/configuring/plugins#configuring-plugins)
* @see [Configuring Plugins](https://eslint.org/docs/latest/user-guide/configuring/plugins#configure-plugins)
*/
plugins?: Plugin[];

/**
* Specifying Processor.
*
* @see [processor](https://ESLint.org/docs/user-guide/configuring/plugins#specifying-processor)
* @see [processor](https://eslint.org/docs/latest/user-guide/configuring/plugins#specify-a-processor)
*/
processor?: string;

/**
* Rules.
*
* @see [Rules](https://ESLint.org/docs/user-guide/configuring/rules)
* @see [Rules](https://eslint.org/docs/latest/user-guide/configuring/rules)
*/
rules?: Rules;

/**
* Overrides.
*
* @see [How do overrides work](https://ESLint.org/docs/user-guide/configuring/configuration-files#how-do-overrides-work)
* @see [How do overrides work](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#how-do-overrides-work)
*/
overrides?: Overrides;

/**
* Settings.
*
* @see [Settings](https://ESLint.org/docs/user-guide/configuring/configuration-files#adding-shared-settings)
* @see [Settings](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#adding-shared-settings)
*/
settings?: Settings;

/**
* Disabling Inline Comments.
*
* @see [Disabling Inline Comments](https://ESLint.org/docs/user-guide/configuring/rules#disabling-inline-comments)
* @see [Disabling Inline Comments](https://eslint.org/docs/latest/user-guide/configuring/rules#disabling-inline-comments)
*/
noInlineConfig?: boolean;

/**
* Report unused `ESLint-disable` comments.
*
* @see [Report unused `ESLint-disable` comments](https://ESLint.org/docs/user-guide/configuring/rules#report-unused-ESLint-disable-comments)
* @see [Report unused `ESLint-disable` comments](https://eslint.org/docs/latest/user-guide/configuring/rules#report-unused-eslint-disable-comments)
*/
reportUnusedDisableDirectives?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/overrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface Override {
/**
* Specifying Globals.
*
* @see [Globals](https://ESLint.org/docs/user-guide/configuring/language-options#specifying-globals)
* @see [Globals](https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-globals)
*/
globals?: Record<
string,
Expand Down
90 changes: 76 additions & 14 deletions src/parser-options.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type { LiteralUnion } from './utility-types';
/**
* Any valid ECMAScript version number or 'latest':
*
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, ...
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, ...
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ...
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ...
* - 'latest'
*
* @see https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsecmaversion
* @see https://typescript-eslint.io/architecture/parser/#ecmaversion
*/
export type EcmaVersion =
| 3
Expand All @@ -22,6 +22,7 @@ export type EcmaVersion =
| 11
| 12
| 13
| 14
| 2015
| 2016
| 2017
Expand All @@ -30,6 +31,7 @@ export type EcmaVersion =
| 2020
| 2021
| 2022
| 2023
| 'latest';

/**
Expand All @@ -39,6 +41,9 @@ export type SourceType = 'script' | 'module';

/**
* An object indicating which additional language features you'd like to use.
*
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options
* @see https://typescript-eslint.io/architecture/parser#ecmafeatures
*/
export interface EcmaFeatures extends Partial<Record<string, boolean>> {
/**
Expand Down Expand Up @@ -141,35 +146,76 @@ export interface ParserOptions extends Partial<Record<string, unknown>> {
/**
* Accepts any valid ECMAScript version number or `'latest'`:
*
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, ..., or
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, ..., or
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or
* - `'latest'`
*
* When it's a version or a year, the value must be a number - so do not include the `es` prefix.
*
* Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default
*
* @default 2018
* @see https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsecmaversion
*
* @see https://typescript-eslint.io/architecture/parser/#ecmaversion
*/
ecmaVersion?: EcmaVersion;

/**
* Set to "script" (default) or "module" if your code is in ECMAScript modules.
*
* @default 'script'
*
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options
*/
sourceType?: SourceType;

/**
* An object indicating which additional language features you'd like to use.
*
* @see https://eslint.org/docs/latest/user-guide/configuring/language-options#specifying-parser-options
* @see https://typescript-eslint.io/architecture/parser#ecmafeatures
*/
ecmaFeatures?: EcmaFeatures;

/**
* The identifier that's used for JSX Elements creation (after transpilation).
* If you're using a library other than React (like `preact`), then you should change this value.
* If you are using the [new JSX transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) you can set this to `null`.
*
* This should not be a member expression - just the root identifier (i.e. use `"React"` instead of `"React.createElement"`).
*
* If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler.
*
* @default 'React'
*
* @see [jsxPragma](https://typescript-eslint.io/architecture/parser#jsxpragma)
*/
jsxPragma?: string;

/**
* The identifier that's used for JSX fragment elements (after transpilation).
* If `null`, assumes transpilation will always use a member of the configured `jsxPragma`.
* This should not be a member expression - just the root identifier (i.e. use `"h"` instead of `"h.Fragment"`).
*
* If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler.
*
* @default null
*
* @see [jsxFragmentName](https://typescript-eslint.io/architecture/parser#jsxfragmentname)
*/
jsxFragmentName?: string | null;

/**
* @see [lib](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionslib)
* For valid options, see the [TypeScript compiler options](https://www.typescriptlang.org/tsconfig#lib).
*
* Specifies the TypeScript `libs` that are available.
* This is used by the scope analyser to ensure there are global variables declared for the types exposed by TypeScript.
*
* If you provide `parserOptions.project`, you do not need to set this, as it will automatically detected from the compiler.
*
* @default ['es2018']
*
* @see [lib](https://typescript-eslint.io/architecture/parser/#lib)
*/
lib?: Lib[];

Expand All @@ -187,7 +233,7 @@ export interface ParserOptions extends Partial<Record<string, unknown>> {
* The default extensions are `.ts`, `.tsx`, `.js`, and `.jsx`. Add extensions starting with `.`, followed by the file extension.
* E.g. for a `.vue` file use `"extraFileExtensions: [".vue"]`.
*
* @see [extraFileExtensions](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsextrafileextensions)
* @see [extraFileExtensions](https://typescript-eslint.io/architecture/parser/#extrafileextensions)
*/
extraFileExtensions?: string[];

Expand All @@ -204,12 +250,28 @@ export interface ParserOptions extends Partial<Record<string, unknown>> {
parser?: Parser;

/**
* @see [project](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsproject)
* This option allows you to provide a path to your project's `tsconfig.json`.
* **This setting is required if you want to use rules which require type information.**
* Relative paths are interpreted relative to the current working directory if `tsconfigRootDir` is not set.
* If you intend on running ESLint from directories other than the project root, you should consider using `tsconfigRootDir`.
*
* @default undefined
*
* @see [project](https://typescript-eslint.io/architecture/parser/#project)
*/
project?: string | string[];

/**
* @see [projectFolderIgnoreList](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionsprojectfolderignorelist)
* This option allows you to ignore folders from being included in your provided list of `project`s.
* This is useful if you have configured glob patterns, but want to make sure you ignore certain folders.
*
* It accepts an array of globs to exclude from the `project` globs.
*
* For example, by default it will ensure that a glob like `./**‎/tsconfig.json` will not match any `tsconfigs` within your `node_modules` folder (some npm packages do not exclude their source files from their published packages).
*
* @default ['**‎/node_modules/**']
*
* @see [projectFolderIgnoreList](https://typescript-eslint.io/architecture/parser/#projectfolderignorelist)
*/
projectFolderIgnoreList?: Array<string | RegExp>;

Expand All @@ -220,7 +282,7 @@ export interface ParserOptions extends Partial<Record<string, unknown>> {
/**
* This option allows you to provide the root directory for relative tsconfig paths specified in the `project` option above.
*
* @see [tsconfigRootDir](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#parseroptionstsconfigrootdir)
* @see [tsconfigRootDir](https://typescript-eslint.io/architecture/parser/#tsconfigrootdir)
*/
tsconfigRootDir?: string;

Expand All @@ -231,17 +293,17 @@ export interface ParserOptions extends Partial<Record<string, unknown>> {
*
* @default true
*
* @see [warnOnUnsupportedTypeScriptVersion](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionswarnonunsupportedtypescriptversion)
* @see [warnOnUnsupportedTypeScriptVersion](https://typescript-eslint.io/architecture/parser/#warnonunsupportedtypescriptversion)
*/
warnOnUnsupportedTypeScriptVersion?: boolean;

/**
* This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](https://typescript-eslint.io/docs/linting/type-linting/).
* This option allow you to tell parser to act as if `emitDecoratorMetadata: true` is set in `tsconfig.json`, but without [type-aware linting](https://typescript-eslint.io/linting/typed-linting).
* In other words, you don't have to specify `parserOptions.project` in this case, making the linting process faster.
*
* @default undefined
*
* @see [emitDecoratorMetadata](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser#parseroptionsemitdecoratormetadata)
* @see [emitDecoratorMetadata](https://typescript-eslint.io/architecture/parser/#emitdecoratormetadata)
*/
emitDecoratorMetadata?: boolean;

Expand Down

0 comments on commit b58f401

Please sign in to comment.