Enable lint unnecessary_statements. Codebase is compliant. (#20099)

* Enable lint unnecessary_statements. Codebase is compliant.

* Fix mega_gallery generated code to not generate unecessary statements

* Fix lint in mega gallery changes

* Enable unnecessary_statements for users as well as repo.
This commit is contained in:
Michael R Fairhurst
2018-08-06 16:31:57 -07:00
committed by Devon Carew
parent b81e361192
commit e77b186abd
3 changed files with 3 additions and 6 deletions

View File

@@ -150,7 +150,7 @@ linter:
- unnecessary_null_in_if_null_operators
- unnecessary_overrides
- unnecessary_parenthesis
# - unnecessary_statements # not yet tested
- unnecessary_statements
- unnecessary_this
- unrelated_type_equality_checks
- use_rethrow_when_possible

View File

@@ -92,11 +92,10 @@ void main(List<String> args) {
// TODO(devoncarew): Create an entry-point that builds a UI with all `n` copies.
void _createEntry(File mainFile, int copies) {
final StringBuffer imports = new StringBuffer();
final StringBuffer importRefs = new StringBuffer();
for (int i = 1; i < copies; i++) {
imports.writeln('// ignore: unused_import');
imports.writeln("import 'gallery_$i/main.dart' as main_$i;");
importRefs.writeln(' main_$i.main;');
}
final String contents = '''
@@ -110,9 +109,6 @@ import 'gallery/app.dart';
${imports.toString().trim()}
void main() {
// Make sure the imports are not marked as unused.
${importRefs.toString().trim()}
runApp(const GalleryApp());
}
''';

View File

@@ -81,5 +81,6 @@ linter:
# - unawaited_futures
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_statements
- unrelated_type_equality_checks
- valid_regexps