sdk icon indicating copy to clipboard operation
sdk copied to clipboard

use preferred quote-style when generating imports

Open pq opened this issue 1 year ago • 3 comments

Import quote style should agree with enabled lints.

  • prefer_single_quotes vs.
  • prefer_double_quotes

I'm inclined to think the unspecified default should be single quotes (current behavior).

/fyi @lrhn

pq avatar Jul 28 '22 20:07 pq

Agreed. As far as I can remember, there have been no complaints about the default.

bwilkerson avatar Jul 28 '22 20:07 bwilkerson

One possible alternative is to use the quoting of existing imports, if there are any, and only fall back on single quotes if there are no imports at all.

lrhn avatar Jul 31 '22 13:07 lrhn

Yes, that's another valid signal. I think that if there's a signal in the form of an enabled lint that that should take precedence over the signal from existing code, but the signal from existing code should take precedence over the default.

bwilkerson avatar Jul 31 '22 15:07 bwilkerson

https://dart-review.googlesource.com/c/sdk/+/260520

"Generating imports" is finished, but the issue scope would be increased to also support "generating strings"

asashour avatar Sep 22 '22 08:09 asashour

https://dart-review.googlesource.com/c/sdk/+/260523

I am not sure where else "generating string" should be tackled.

asashour avatar Sep 22 '22 09:09 asashour

I'm not sure either. We can either look at every refactoring and correction producer, or wait for user feedback.

bwilkerson avatar Sep 23 '22 16:09 bwilkerson