Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Useless Constructor #14

Open
LucasFlaquer opened this issue Jul 26, 2023 · 0 comments
Open

No Useless Constructor #14

LucasFlaquer opened this issue Jul 26, 2023 · 0 comments

Comments

@LucasFlaquer
Copy link

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"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant