Reputation: 8498
Stateless React components should be named in PascalCase, so React can distinguish between native elements and components. Typescripts naming convention dictates that we should use lowerCamelCase or UPPER_CASE for the name of const variables.
How can I satisfy both (React and tslint)?
Upvotes: 6
Views: 3872
Reputation: 968
You can add the following rule in you tslint.json:
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"]
Upvotes: 2
Reputation: 4520
I found a compromise, using a function declaration instead of a variable declaration for my component:
Upvotes: 0
Reputation: 22352
I think you have two options here:
Use where appopriate comment like this
/* tslint:disable-next-line:variable-name */
to disable tslint warning at that particular line
Use class components instead of functional ones.
Upvotes: 4