|
| 1 | +import type { RuleConfig } from '../rule-config'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Option. |
| 5 | + */ |
| 6 | +export type TypedefOption = { |
| 7 | + /** |
| 8 | + * Whether to enforce type annotations on variables declared using array destructuring. |
| 9 | + * |
| 10 | + * @default false |
| 11 | + * |
| 12 | + * @see [arrayDestructuring](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#arraydestructuring) |
| 13 | + */ |
| 14 | + arrayDestructuring?: boolean; |
| 15 | + /** |
| 16 | + * Whether to enforce type annotations for parameters of arrow functions. |
| 17 | + * |
| 18 | + * @default false |
| 19 | + * |
| 20 | + * @see [arrowParameter](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#arrowparameter) |
| 21 | + */ |
| 22 | + arrowParameter?: boolean; |
| 23 | + /** |
| 24 | + * Whether to enforce type annotations on member variables of classes. |
| 25 | + * |
| 26 | + * @default false |
| 27 | + * |
| 28 | + * @see [memberVariableDeclaration](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#membervariabledeclaration) |
| 29 | + */ |
| 30 | + memberVariableDeclaration?: boolean; |
| 31 | + /** |
| 32 | + * Whether to enforce type annotations on variables declared using object destructuring. |
| 33 | + * |
| 34 | + * @default false |
| 35 | + * |
| 36 | + * @see [objectDestructuring](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#objectdestructuring) |
| 37 | + */ |
| 38 | + objectDestructuring?: boolean; |
| 39 | + /** |
| 40 | + * Whether to enforce type annotations for parameters of functions and methods. |
| 41 | + * |
| 42 | + * @default false |
| 43 | + * |
| 44 | + * @see [parameter](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#parameter) |
| 45 | + */ |
| 46 | + parameter?: boolean; |
| 47 | + /** |
| 48 | + * Whether to enforce type annotations for properties of interfaces and types. |
| 49 | + * |
| 50 | + * @default false |
| 51 | + * |
| 52 | + * @see [propertyDeclaration](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#propertydeclaration) |
| 53 | + */ |
| 54 | + propertyDeclaration?: boolean; |
| 55 | + /** |
| 56 | + * Whether to enforce type annotations for variable declarations, excluding array and object destructuring. |
| 57 | + * |
| 58 | + * @default false |
| 59 | + * |
| 60 | + * @see [variableDeclaration](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#variabledeclaration) |
| 61 | + */ |
| 62 | + variableDeclaration?: boolean; |
| 63 | + /** |
| 64 | + * Ignore variable declarations for non-arrow and arrow functions. |
| 65 | + * |
| 66 | + * @default false |
| 67 | + * |
| 68 | + * @see [variableDeclarationIgnoreFunction](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md#variabledeclarationignorefunction) |
| 69 | + */ |
| 70 | + variableDeclarationIgnoreFunction?: boolean; |
| 71 | +}; |
| 72 | + |
| 73 | +/** |
| 74 | + * Options. |
| 75 | + */ |
| 76 | +export type TypedefOptions = [TypedefOption?]; |
| 77 | + |
| 78 | +/** |
| 79 | + * Requires type annotations to exist. |
| 80 | + * |
| 81 | + * @see [typedef](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md) |
| 82 | + */ |
| 83 | +export type TypedefRuleConfig = RuleConfig<TypedefOptions>; |
| 84 | + |
| 85 | +/** |
| 86 | + * Requires type annotations to exist. |
| 87 | + * |
| 88 | + * @see [typedef](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md) |
| 89 | + */ |
| 90 | +export interface TypedefRule { |
| 91 | + /** |
| 92 | + * Requires type annotations to exist. |
| 93 | + * |
| 94 | + * @see [typedef](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/typedef.md) |
| 95 | + */ |
| 96 | + '@typescript-eslint/typedef': TypedefRuleConfig; |
| 97 | +} |
0 commit comments