No Useless Constructor
Opened this issue · 0 comments
LucasFlaquer commented
Description
I'm using the eslint-config for nextjs and I'm having some issues when using constructor shorthand while creating my module classes. I would like to know if is it possible to add the rules above to the lint setup
How to reproduce the error:
1- Create a nextjs project with typescript
2- add rocketseat eslint config on your .eslintrc
3- create a typescript class like the example bellow:
export class ExampleClass {
constructor(private foo:string) {}
}
4- view an error similar to this one:
Useless constructor.eslint[no-useless-constructor](https://eslint.org/docs/latest/rules/no-useless-constructor)
Possible solution:
I've bypassed this error by adding thoose rules bellow:
{
// note you must disable the base rule as it can report incorrect errors
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"]
}