Skip to content

Commit 9bd9e16

Browse files
committed
a bit less hardcoded (still)
1 parent c5b3d2f commit 9bd9e16

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

validator/rules/no-native-types.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ import { ESLintUtils } from '@typescript-eslint/utils';
2020

2121
const createRule = ESLintUtils.RuleCreator(name => `https://example.com/rule/${name}`)
2222

23+
const TYPES_TO_AVOID = ['Record', 'Partial', 'Required', 'Pick', 'Omit'];
24+
2325
export default createRule({
2426
name: 'no-native-types',
2527
create(context) {
2628
return {
2729
TSTypeReference(node) {
28-
if (node.typeName.name === 'Record' || node.typeName.name === 'Map' ) {
30+
if (TYPES_TO_AVOID.includes(node.typeName.name)) {
2931
context.report({ node, messageId: 'stringKey' })
3032
}
3133
},

0 commit comments

Comments
 (0)