|
| 1 | +import type { RuleConfig } from '../rule-config'; |
| 2 | + |
| 3 | +/** |
| 4 | + * Option. |
| 5 | + */ |
| 6 | +export type BanTypesOption = { |
| 7 | + /** |
| 8 | + * An object whose keys are the types you want to ban, and the values are error messages. |
| 9 | + * |
| 10 | + * @see [types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 11 | + */ |
| 12 | + types?: Record< |
| 13 | + string, |
| 14 | + | false |
| 15 | + | string |
| 16 | + | { |
| 17 | + /** |
| 18 | + * The message to display when the type is matched. |
| 19 | + * |
| 20 | + * @see [types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 21 | + */ |
| 22 | + message: string; |
| 23 | + /** |
| 24 | + * A string to replace the banned type with when the fixer is run. If this is omitted, no fix will be done. |
| 25 | + * |
| 26 | + * @see [types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 27 | + */ |
| 28 | + fixWith?: string; |
| 29 | + } |
| 30 | + >; |
| 31 | + |
| 32 | + /** |
| 33 | + * If you're specifying custom `types`, you can set this to `true` to extend the default types configuration. |
| 34 | + * |
| 35 | + * @see [extendDefaults](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 36 | + */ |
| 37 | + extendDefaults?: boolean; |
| 38 | +}; |
| 39 | + |
| 40 | +/** |
| 41 | + * Options. |
| 42 | + */ |
| 43 | +export type BanTypesOptions = [BanTypesOption?]; |
| 44 | + |
| 45 | +/** |
| 46 | + * Bans specific types from being used. |
| 47 | + * |
| 48 | + * @see [ban-types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 49 | + */ |
| 50 | +export type BanTypesRuleConfig = RuleConfig<BanTypesOptions>; |
| 51 | + |
| 52 | +/** |
| 53 | + * Bans specific types from being used. |
| 54 | + * |
| 55 | + * @see [ban-types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 56 | + */ |
| 57 | +export interface BanTypesRule { |
| 58 | + /** |
| 59 | + * Bans specific types from being used. |
| 60 | + * |
| 61 | + * @see [ban-types](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/ban-types.md) |
| 62 | + */ |
| 63 | + '@typescript-eslint/ban-types': BanTypesRuleConfig; |
| 64 | +} |
0 commit comments