dart-lang / linter

Linter for Dart.
https://dart.dev/tools/linter-rules
BSD 3-Clause "New" or "Revised" License
628 stars 172 forks source link

[macros] linter support #4881

Open pq opened 4 months ago

pq commented 4 months ago

A meta-issue to discuss and track work on linter support for macros.

Existing Lints

Some existing lints will need tests (minimally) and possibly enhanced implementations.

General questions that have implications for a number of lints:

New Lints

Authors and users of macros (and augmentation classes) might benefit from some new lints.

🚧 Feedback welcome! 🚧

Analyzer / Server Support

Visibility

To whom and under what circumstances should we display diagnostics produced in macro generated files?

/fyi @dart-lang/language-team @bwilkerson @keertip @scheglov @srawlins

rrousselGit commented 4 months ago

If this is about running lints on generated code, I assume lots of those probably should not apply.

In particular, all the stylistic ones. For instance avoid_renaming_method_parameters would be a huge pain for macro authors to handle. Or prefer_double_quotes vs prefer_single_quotes doesn't have a finite answer.

pq commented 4 months ago

Thanks @rrousselGit. Partly yes, this is about generated code. We expect most lints to not apply[*] in that case for exactly the reasons you mention.

Slightly more interesting are lints that might apply (in some potentially limited way) to macros and user created augmentation libraries.

*[]* Indeed, we're especially interested in the ones that should* and we don't have a good categorization for those. (Security lints come to mind... Certain error-protecting ones too...) Feedback welcome!