Skip to content

Lint rule for ! postfix bang/exclamation and late null safety language features #58361

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

Open
duttaoindril opened this issue Mar 26, 2021 · 3 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-lint-request P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@duttaoindril
Copy link

duttaoindril commented Mar 26, 2021

Describe the rule you'd like to see implemented
A lint rule that just shows the presence of the postfix bang/exclamation null safety ! and late variable type.

This way, a team can decide if it's:

  • ignore - ”No preference.”
  • info - "Best Practices are to not use this."
  • warning - "Using this may cause the application to break in runtime."
  • error - "To keep in line with code standards, we don't want to use this."

This could be very helpful to reach true compile-time sound null safety as we migrate to it fully.

Examples

https://dart.dev/null-safety/understanding-null-safety#late-variables

@duttaoindril duttaoindril added type-enhancement A request for a change that isn't a bug linter-lint-request labels Mar 26, 2021
@bwilkerson
Copy link
Member

If we add this support, then I would recommend making these be two separate lints so that teams can associate different severities with the different language features.

@duttaoindril
Copy link
Author

If we add this support, then I would recommend making these be two separate lints so that teams can associate different severities with the different language features.

Definitely.

@duttaoindril duttaoindril changed the title Lint rule for ! bang/exclamation and late null safety. Lint rule for ! postfix bang/exclamation and late null safety. Mar 26, 2021
@duttaoindril duttaoindril changed the title Lint rule for ! postfix bang/exclamation and late null safety. Lint rule for ! postfix bang/exclamation and late null safety language features Mar 26, 2021
@incendial
Copy link
Contributor

If anyone is interested to try those rules, we have them implemented in additional dart linter called Dart Code Metrics. Here is the docs for avoid late keyword and avoid non null assertion. Any feedback is welcome!

@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 19, 2024
@pq pq added the P3 A lower priority bug or feature request label Nov 20, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-lint-request 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

5 participants