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

proposal: annotate_redeclares #4747

Closed
3 of 5 tasks
Tracked by #3625
pq opened this issue Sep 11, 2023 · 6 comments
Closed
3 of 5 tasks
Tracked by #3625

proposal: annotate_redeclares #4747

pq opened this issue Sep 11, 2023 · 6 comments
Assignees
Labels

Comments

@pq
Copy link
Member

pq commented Sep 11, 2023

annotate_redeclares

Description

Annotate redeclared members.

Details

DO annotate redeclared members.

This practice improves code readability and helps protect against unintentionally redeclaring members or being surprised when a member ceases to redeclare (due for example to a rename refactoring).

Kind

Style and errors.

Bad Examples

class C { 
  void f() { }
}

extension type E(C c) implements C {
  void f() {
    ...
  }
}

Good Examples

import 'package:meta/meta.dart';

class C { 
  void f() { }
}

extension type E(C c) implements C {
  @redeclare
  void f() {
    ...
  }
}

Discussion

This is essentially an analog to annotate_overrides.

Discussion checklist

  • List any existing rules this proposal modifies, complements, overlaps or conflicts with.
  • List any relevant issues (reported here, the SDK Tracker, or elsewhere).
  • If there's any prior art (e.g., in other linters), please add references here.
  • If this proposal corresponds to Effective Dart or Flutter Style Guide advice, please call it out. (If there isn't any corresponding advice, should there be?)
  • If this proposal is motivated by real-world examples, please provide as many details as you can. Demonstrating potential impact is especially valuable.
@github-actions github-actions bot added the set-recommended Affects a rule in the recommended Dart rule set label Sep 11, 2023
@pq pq self-assigned this Sep 14, 2023
@pq
Copy link
Member Author

pq commented Sep 14, 2023

@srawlins @bwilkerson @stereotype441: it feels like we have a bit of a consensus on the value of this one. If that's right I'll bump this to accepted and implement.

@srawlins
Copy link
Member

I support!

@pq
Copy link
Member Author

pq commented Sep 14, 2023

/fyi @dart-lang/dart-team

@pq
Copy link
Member Author

pq commented Sep 15, 2023

Bumping to accepted.

@grouma

This comment was marked as off-topic.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Sep 18, 2023
Fixes: dart-lang/linter#4747

Change-Id: I7bf3e83dbe279f5b1a03dc5e5806c7c0fe3e3486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326263
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Phil Quitslund <[email protected]>
@pq
Copy link
Member Author

pq commented Sep 18, 2023

Implemented w/ dart-lang/sdk@d1b6ea9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants