[go: nahoru, domu]

Skip to content

Commit

Permalink
docs: [ban-types] update documentation; suggest option and defaults (#…
Browse files Browse the repository at this point in the history
…7002)

* docs: update ban-types default options

* docs: add suggest documentation to ban-types
  • Loading branch information
MatthiasKunnen committed May 7, 2023
1 parent 824e612 commit 30f41ab
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/eslint-plugin/docs/rules/ban-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,24 @@ const defaultTypes = {
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
'- If you want a type meaning "any object", you probably want `object` instead.',
'- If you want a type meaning "any value", you probably want `unknown` instead.',
'- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead.',
].join('\n'),
suggest: ['object', 'unknown', 'NonNullable<unknown>'],
},
'{}': {
message: [
'`{}` actually means "any non-nullish value".',
'- If you want a type meaning "any object", you probably want `object` instead.',
'- If you want a type meaning "any value", you probably want `unknown` instead.',
'- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.',
'- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead.',
].join('\n'),
suggest: [
'object',
'unknown',
'Record<string, never>',
'NonNullable<unknown>',
],
},
};
```
Expand All @@ -139,6 +148,7 @@ The values can be:
- An object with the following properties:
- `message: string` - the message to display when the type is matched.
- `fixWith?: string` - a string to replace the banned type with when the fixer is run. If this is omitted, no fix will be done.
- `suggest?: string[]` - a list of suggested replacements for the banned type.

### `extendDefaults`

Expand Down

0 comments on commit 30f41ab

Please sign in to comment.