Skip to content

[Question] why the redundant rules? #122

Closed
@43081j

Description

@43081j

Today I updated to the newly scoped package as opposed to the old unscoped/non-monorepo one, and I also inherited the recommended config.

First thing I noticed by enabling all your recommended rules is that you have some redundant ones:

  • @typescript-eslint/explicit-function-return-type
  • @typescript-eslint/no-unused-vars

Why do these rules exist? There are already compiler options for them:

  • noImplicitReturns
  • noUnusedLocals
  • noUnusedParameters

In fact, the rules do a much worse job and seem to be very flaky. Why would we recommend these instead of built-in compiler features?

For example, the unused-vars rule doesn't detect the usage of types in interface generics:

interface Foo extends SomeType<AnotherType> {

SomeType is marked as unused.

Another example, the return type rule has no clue about inheritance. It will error if you don't specify the return type of a method even if the method it overrides has a return type on it. TypeScript allows this.

Are these rules just here for legacy reasons or is there a reason to prefer them?

I would ask you at least remove them from the recommended config and start recommending the much more stable, much stronger compiler features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginquestionQuestions! (i.e. not a bug / enhancment / documentation)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions