Open ishchhabra opened 3 months ago
Summary: The user proposes adding a --insert-ignore-comments
flag to the dart fix
command. This flag would automatically add ignore comments to existing code for new lint rules, allowing developers to focus on fixing new code without immediately refactoring legacy code.
This "fix" should probably only apply for lints that don't have an automatic fix.
This "fix" should probably only apply for lints that don't have an automatic fix.
Yep, agreed. That was the intention behind the proposal. I have updated the description to mention that this flag will only apply to lint rules that do not have an automatic fix.
This tracker is for issues related to:
Description
As the language grows, we often introduce new lint rules to maintain and improve code quality. However, introducing new lint rules to large existing codebases can be challenging, especially when the rules are not auto-fixable. A common approach is to simply ignore the new lint rules for existing, working code and focus on ensuring the new code adheres to these rules.
Currently, this process requires developers to manually add ignore comments to existing code or write custom scripts to automate this task.
To streamline this process, a new
--insert-ignore-comments
flag can be added todart fix
command. This flag will only apply to lint rules that do not have an automatic fix and will allow developers to focus on improving new code without the immediate need to refactor legacy code.I have created a quick (functional but with errors after it adds comments) prototype to demonstrate this idea. In case this is something that the Dart team agrees could be a valid feature, I'd love to contribute. I would love to learn the thoughts and opinions of the Dart team.