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

[dartdev/analyzer/linter] Consider adding a command to add a linter rule #52394

Open
parlough opened this issue May 14, 2023 · 2 comments
Open
Labels
analyzer-linter Issues with the analyzer's support for the linter package analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. dart-cli-analyze Issues related to the 'dart analyze' tool P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@parlough
Copy link
Member

parlough commented May 14, 2023

I've seen this mentioned a few times before but I couldn't find a dedicated issue for it here. As we work to improve the linter rule documentation in the future (related dart-lang/site-www#4498), it would be nice if we could just give users a command they can copy with a button and run to add or remove a linter rule. dart pub add has been an extremely useful command in documentation with a similar goal.

The command could be part of a new dart linter or dart analyzer tool, or just added as a subcommand to dart analyze. It would probably be fine as a hidden command from --help unless other functionality is added, as I imagine most use cases will be from documentation and blog posts.

  1. Check if the lint exists, error if it doesn't
  2. Check if the lint is already applied (within the same file, not included ones), if it is, tell the user that
  3. Check if the lint is incompatible with any applied ones, error if it is and inform the user of the incompatibility
  4. Add the lint to the list (preferably sorted)
@parlough parlough changed the title [analyzer/linter] Consider adding a command to add a linter rule [dartdev/analyzer/linter] Consider adding a command to add a linter rule May 14, 2023
@pq pq added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. dart-cli-analyze Issues related to the 'dart analyze' tool analyzer-linter Issues with the analyzer's support for the linter package type-enhancement A request for a change that isn't a bug analyzer-ux P3 A lower priority bug or feature request labels May 15, 2023
@pq
Copy link
Member

pq commented May 15, 2023

/fyi @jacob314

@parlough
Copy link
Member Author

I'm beginning to think a solution like dart-lang/pub#4052 might be more sustainable as it would be easier to evolve outside the normal guarantees of the SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package analyzer-ux area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. dart-cli-analyze Issues related to the 'dart analyze' tool P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants