-
Notifications
You must be signed in to change notification settings - Fork 1.9k
public_member_api_docs quickfix for primary constructor "this;" insertion #64324
Copy link
Copy link
Open
Labels
area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagedevexp-quick-fixIssues with analysis server (quick) fixesIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Activity
Metadata
Metadata
Assignees
Labels
area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagedevexp-quick-fixIssues with analysis server (quick) fixesIssues with analysis server (quick) fixestype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
This is a follow up to #64316
As of today the public_member_api_docs lint flags a primary constructor that does not have documentation.
There are two cases where it gets ambiguous:
this;declaration: The lint flags the line where the class is declared, i.e.class Foo( {, but then it is not obvious because there are class docs above it.this;declaration, without a doc comment above it. The lint flags the line where the class is declared, i.e.class Foo( {and thethis;declaration. Here you get two lint warnings, but the one onclass Foo( {is the same ambiguity as noted above.The quickfixes that I get today are:
But nothing suggests adding
this;.I suggest a two fold fix:
this;, then add it, which should move the linted line to thethis;declaration (which still doesn't fix the lint, but now the warning is more clear)this;, then lint only on that, instead of the primary constructor itself, since the warning is really about thethis;missing a doc comment, and not theFoo() {cc @bwilkerson @FMorschel
Dart SDK version: 3.13.3 (stable) (Tue Sep 1 01:07:17 2026 -0700) on "windows_x64"