Skip to content

Commit

Permalink
feat(typescript): allow generic names starting with "K" (#116)
Browse files Browse the repository at this point in the history
We accept only generic type names starting with "T" but sometimes, accepting "K" also makes sense. This is the case when using the TypeScript keyword `keyof`:

```ts
type StateToWidgets = {
  [KParameter in keyof IndexUiState]: Array<Widget['$$type']>;
};
```

See https://www.typescriptlang.org/docs/handbook/release-n
otes/typescript-2-1.html#example
  • Loading branch information
francoischalifour committed Sep 27, 2019
1 parent 6a4ed7e commit 2148fe4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rules/typescript.js
Expand Up @@ -17,7 +17,10 @@ module.exports = {
],
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/explicit-member-accessibility': ['error'],
'@typescript-eslint/generic-type-naming': ['error', '^T[A-Z][a-zA-Z]+$'],
'@typescript-eslint/generic-type-naming': [
'error',
'^(T|K)[A-Z][a-zA-Z]+$',
],
'@typescript-eslint/indent': ['off'],
'@typescript-eslint/interface-name-prefix': ['error', 'never'],
'@typescript-eslint/member-delimiter-style': ['off'],
Expand Down

0 comments on commit 2148fe4

Please sign in to comment.