I using @typescript-eslint/naming-convention to enforce my variable names.
I set a rule that allow by default to every variable to be camelCase syntax, except class and object.
But when I use destructuring assignment with import function, I got eslint error that consider the BarClass as variable and apply the rule of camelCase instead of class rule:
Variable name
BarClassmust match one of the following formats: camelCase 12:11 - 12:19
Is there a way to fix that? How I make eslint to know that is a class and not variable?
typescript-eslint.io playground
class BarClass {
}
const geClass = async() => {
return { BarClass };
}
const bla = true;
(async () => {
const { BarClass } = await geClass();
})();
eslint config:
{
"rules": {
"@typescript-eslint/naming-convention": [
"error",
{
"selector": [
"default"
],
"format": [
"camelCase"
]
},
{
"selector": [
"class", "objectLiteralProperty"
],
"format": null
}
]
}
}