|
| 1 | +import type { RuleConfig } from '../rule-config'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Option. |
| 5 | + */ |
| 6 | +export type ExplicitFunctionReturnTypeOption = { |
| 7 | + /** |
| 8 | + * If `true`, only functions which are part of a declaration will be checked. |
| 9 | + * |
| 10 | + * @default false |
| 11 | + */ |
| 12 | + allowExpressions?: boolean; |
| 13 | + /** |
| 14 | + * If `true`, type annotations are also allowed on the variable of a function expression rather than on the function directly. |
| 15 | + * |
| 16 | + * @default true |
| 17 | + */ |
| 18 | + allowTypedFunctionExpressions?: boolean; |
| 19 | + /** |
| 20 | + * If `true`, functions immediately returning another function expression will not be checked. |
| 21 | + * |
| 22 | + * @default true |
| 23 | + */ |
| 24 | + allowHigherOrderFunctions?: boolean; |
| 25 | + /** |
| 26 | + * If `true`, arrow functions immediately returning a `as const` value will not be checked. |
| 27 | + * |
| 28 | + * @default true |
| 29 | + */ |
| 30 | + allowDirectConstAssertionInArrowFunctions?: boolean; |
| 31 | + /** |
| 32 | + * If `true`, concise arrow functions that start with the void keyword will not be checked. |
| 33 | + * |
| 34 | + * @default false |
| 35 | + */ |
| 36 | + allowConciseArrowFunctionExpressionsStartingWithVoid?: boolean; |
| 37 | +}; |
| 38 | + |
| 39 | +/** |
| 40 | + * Options. |
| 41 | + */ |
| 42 | +export type ExplicitFunctionReturnTypeOptions = [ExplicitFunctionReturnTypeOption?]; |
| 43 | + |
| 44 | +/** |
| 45 | + * Require explicit return types on functions and class methods. |
| 46 | + * |
| 47 | + * @see [explicit-function-return-type](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) |
| 48 | + */ |
| 49 | +export type ExplicitFunctionReturnTypeRuleConfig = RuleConfig<ExplicitFunctionReturnTypeOptions>; |
| 50 | + |
| 51 | +/** |
| 52 | + * Require explicit return types on functions and class methods. |
| 53 | + * |
| 54 | + * @see [explicit-function-return-type](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) |
| 55 | + */ |
| 56 | +export interface ExplicitFunctionReturnTypeRule { |
| 57 | + /** |
| 58 | + * Require explicit return types on functions and class methods. |
| 59 | + * |
| 60 | + * @see [explicit-function-return-type](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md) |
| 61 | + */ |
| 62 | + '@typescript-eslint/explicit-function-return-type': ExplicitFunctionReturnTypeRuleConfig; |
| 63 | +} |
0 commit comments