Skip to content

[Wildcard Variables][lint] consider a no_unused_parameters lint #59475

@pq

Description

@pq

With wildcard variables, we have a proper way to mark unused parameters as intentionally unused. Given that, we might consider a lint that flags unused parameters with the expectation that intentionally unused params should either be removed or converted to wildcards.

For example:

BAD

int f(int x) => 42;

abstract class A {
  int f(int x);
}

class A extends C {
  @override
  int f(int x) => 42;
}

GOOD

int f(int x) => x;
int f() => 42;
int f(int _) => 42;


abstract class A {
  int f(int x);
}

class A extends C {
  @override
  int f(int x) => x;
}

class A extends C {
  @override
  int f(int _) => 42;
}

/fyi @kallentu @lrhn @munificent

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-new-language-featurelinter-status-pendingtype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions