Reputation: 2781
Sometimes in const
I store some arrow functions that returns React
component:
export const HomeOutline = (style: ImageStyle): IconElement => (
<Icon {...style} name="home-outline" pack="material" />
);
This is only allowed in this case, otherwise, I use the camelCase
and UPPER_CASE
naming convention in my variables. There is a way to catch const that store arrow functions?
Upvotes: 1
Views: 3001
Reputation: 154
I was looking for something similar to your question, but for decorators.
I did it like this
'@typescript-eslint/naming-convention': [
'warn',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'variable',
modifiers: ['const', 'exported'],
types: ['function'],
format: ['PascalCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
],
Upvotes: 3
Reputation: 2033
Look at this answer: https://stackoverflow.com/a/69244737/4751073
try to use selector as type or variable
Upvotes: 1