From 1bd047a67a72510bbc9a71e22b1cb30aa7ab0cfa Mon Sep 17 00:00:00 2001 From: Brian Wilkerson Date: Tue, 21 Jan 2020 18:09:03 +0000 Subject: [PATCH] Enable prefer_single_quotes in analyzer_plugin Change-Id: I9cdda6df810ac20c9737d12951ad53a72e6b4f3c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132621 Reviewed-by: Konstantin Shcheglov Commit-Queue: Brian Wilkerson --- pkg/analyzer_plugin/analysis_options.yaml | 2 +- .../lib/src/utilities/null_string_sink.dart | 4 ++-- .../test/integration/support/integration_tests.dart | 4 ++-- pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart | 2 +- pkg/analyzer_plugin/tool/spec/to_html.dart | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkg/analyzer_plugin/analysis_options.yaml b/pkg/analyzer_plugin/analysis_options.yaml index 6f19da5e215..42d4036e268 100644 --- a/pkg/analyzer_plugin/analysis_options.yaml +++ b/pkg/analyzer_plugin/analysis_options.yaml @@ -39,7 +39,7 @@ linter: - prefer_is_empty - prefer_is_not_empty - prefer_iterable_whereType - #- prefer_single_quotes # 2076 + - prefer_single_quotes - prefer_spread_collections - recursive_getters - slash_for_doc_comments diff --git a/pkg/analyzer_plugin/lib/src/utilities/null_string_sink.dart b/pkg/analyzer_plugin/lib/src/utilities/null_string_sink.dart index e91e598efed..ec2cc261171 100644 --- a/pkg/analyzer_plugin/lib/src/utilities/null_string_sink.dart +++ b/pkg/analyzer_plugin/lib/src/utilities/null_string_sink.dart @@ -8,11 +8,11 @@ class NullStringSink implements StringSink { void write(Object obj) {} @override - void writeAll(Iterable objects, [String separator = ""]) {} + void writeAll(Iterable objects, [String separator = '']) {} @override void writeCharCode(int charCode) {} @override - void writeln([Object obj = ""]) {} + void writeln([Object obj = '']) {} } diff --git a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart index 0e2e71e32ea..9bfaea1324f 100644 --- a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart +++ b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart @@ -514,7 +514,7 @@ class Server { _pendingCommands[id] = completer; String line = json.encode(command); _recordStdio('SEND: $line'); - _process.stdin.add(utf8.encoder.convert("$line\n")); + _process.stdin.add(utf8.encoder.convert('$line\n')); return completer.future; } @@ -615,7 +615,7 @@ class Server { /// [debugStdio] has been called. void _recordStdio(String line) { double elapsedTime = currentElapseTime; - line = "$elapsedTime: $line"; + line = '$elapsedTime: $line'; if (_debuggingStdio) { print(line); } diff --git a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart index b4d26658c1b..ff717bda9ff 100644 --- a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart +++ b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart @@ -634,7 +634,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator { writeln(' else {'); indent(() { writeln( - "throw jsonDecoder.mismatch(jsonPath, $fieldNameString);"); + 'throw jsonDecoder.mismatch(jsonPath, $fieldNameString);'); }); writeln('}'); } else { diff --git a/pkg/analyzer_plugin/tool/spec/to_html.dart b/pkg/analyzer_plugin/tool/spec/to_html.dart index f0fc4b25b26..92ffeb31f43 100644 --- a/pkg/analyzer_plugin/tool/spec/to_html.dart +++ b/pkg/analyzer_plugin/tool/spec/to_html.dart @@ -283,7 +283,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor } void generateNotificationsIndex(Iterable notifications) { - h5(() => write("Notifications")); + h5(() => write('Notifications')); element('div', {'class': 'subindex'}, () { element('ul', {}, () { for (var notification in notifications) { @@ -302,7 +302,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor return; } h3(() { - write("Refactorings"); + write('Refactorings'); write(' ('); link('refactorings', () => write('\u2191')); write(')'); @@ -322,7 +322,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor } void generateRequestsIndex(Iterable requests) { - h5(() => write("Requests")); + h5(() => write('Requests')); element('ul', {}, () { for (var request in requests) { if (!request.experimental) { @@ -367,7 +367,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor void generateTypesIndex(Set types) { h3(() { - write("Types"); + write('Types'); write(' ('); link('types', () => write('\u2191')); write(')');