-
Notifications
You must be signed in to change notification settings - Fork 149
/
.semgrep.yml
36 lines (33 loc) · 974 Bytes
/
.semgrep.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
rules:
- id: consistent_react_prop_type_naming
pattern-either:
- pattern-regex: 'const (\w+): FC<\s*(?:\1)?Props\s*>'
- pattern-regex: 'function (\w+)\(\s*props:\s*(?:\1)?Props\s*'
message:
Make the prop type/interface have the same name as the React component.
languages: [ts]
severity: ERROR
- id: consistent_react_fc
pattern-regex: 'React\.FC'
message: Use FC instead of React.FC
languages: [ts]
severity: ERROR
paths:
exclude:
- '**/types/react.d.ts'
- id: consistent_react_node
pattern-regex: 'React\.ReactNode'
message: Use ReactNode instead of React.FC
languages: [ts]
severity: ERROR
paths:
exclude:
- '**/types/react.d.ts'
- id: named_prop_types
pattern-either:
- pattern-regex: ': FC<[{]'
message:
Extract the component prop types into its own interface with the same name
as the prop
languages: [ts]
severity: ERROR