Seriously, thanks so much for all of this info Brian. I've been collecting my thoughts while taking your notes into consideration, as I've been revisiting the analyzer code. It's great to know that the organization of linter/analyzer code is mostly because of historical reasons, and that there's already an interest in decoupling the systems.
It's interesting that you brought up lint contributors being a primary consideration for past decisions, as collaboration is part of what I'm getting after with my own plugin project.
Basically, I've been wondering what the implications would be if there was a better ecosystem for creating / sharing lint rules. The analyzer_plugin package is a huge step in the right direction, but can we do even better by not requiring an author of a single lint (which may not make sense to be added to the greater "linter" package) to release and maintain their own plugin? Could more analyzer use cases be unlocked by facilitating a more mix-and-match, collaborative lint ecosystem, based upon a single analyzer plugin? Use cases such as:
- Defining single-use project-specific rules, e.g. a UI Design System that only allows use of globally-defined brand colors
- Using analysis errors to
teach developers how to properly use various architectures, design patterns, etc.
- Package developers creating package-specific refactorings or code assists to more effectively distribute package-specific boilerplate and guidelines
As someone who's building up an app dev team around Flutter and (eventually) Dart for backend, being able to pick and choose from a large variety of lints would also help me create very strict opinionated guidelines for newly-hired devs to adhere to, which would significantly speed up the onboarding process and allow me to utilize more junior devs while being able to more efficiently "scale" senior-level expertise in the form of rules.
Performance implications aside, all of the above is technically possible using analyzer_plugin, but I think the barrier to entry would still be too high to facilitate the open sharing of diverse and oftentimes conflicting individual rules. A potential solution that I hope to make a POC of this week would be a pub-like system of downloading and caching a single dart file containing a class that inherits from LintRule, which would be dynamically bootstrapped to the analyzer plugin. In the end, a configuration file would look very similar to the list/map of rules added to "linter" section of analysis_options.yaml, despite being a melting pot of a dozen different architectures, packages, and opinions.
I know this proposal poses significant challenges and implications, and I feel like it would probably make most sense as a community-driven project, but I'm curious if these challenges / solutions is something that you've thought of and/or if you see the future of analyzer_plugin facilitating some of these use cases?