-
Notifications
You must be signed in to change notification settings - Fork 40
Add import sorting to format tool #382
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
Conversation
- Reviewer note: This is copied from dart_dev_workiva for easy reviewing. - This should only contain import changes
- This will allow us to execute multiple processes as part of a `ddev format` command
- I would rather follow Effective Dart guidelines. directives_ordering no longer separates own package from other package. See https://dart.dev/guides/language/effective-dart/style#ordering - prefer_relative_imports seems like a better alternative for packages that wish to separate own package imports https://dart.dev/guides/language/effective-dart/usage#prefer-relative-import-paths
a01ec78
to
10df9b5
Compare
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
- Prefer `organize` over `clean` or `sort` (unless specifically referencing sorting)
Co-authored-by: Evan Weible <[email protected]>
- This makes it clear that assigning comments has to happen before sorting - This is slightly less stateful than before, which feels slightly better
@evanweible-wf The functional tests I added appear to be failing on stable (pass on 2.13). They're passing for me locally running on stable. Do you see anything immediately obvious? |
Skynet test results failed initially for this build but were approved by evan.weible |
QA +1
@Workiva/release-management-p |
import 'package:analyzer/dart/ast/ast.dart'; | ||
import 'package:analyzer/dart/ast/token.dart'; | ||
|
||
/// A representation of an namespace directive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#super_minor: there are a few places like this in this file; I assume it's because this used to read "an import directive". 🤷
/// A representation of an namespace directive. | |
/// A representation of a namespace directive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 from RM
Note: A backpatch for this change exists here for consumers who can't upgrade to analyzer 1.0.0
Having to manually sort imports is tedious. It would be better if we could just run the formatter to receive sorted imports.
I added an
organizeImports
flag to theFormatTool
. When set to true, it will also run the file through an import sorter.The import sorter tries to comply with https://dart.dev/tools/linter-rules#directives_ordering