Switch sample analysis over to use package:flutter_lints (#84303)

This switches the sample analysis code to use package:flutter_lints instead of the flutter repo analysis options, so that they are compatible with a similar change to DartPad.
This commit is contained in:
Greg Spencer
2021-06-09 18:09:14 -07:00
committed by GitHub
parent 2721d6e6e5
commit bf1fb6e84b
8 changed files with 25 additions and 17 deletions

View File

@@ -611,13 +611,22 @@ dependencies:
sdk: flutter
flutter_test:
sdk: flutter
dev_dependencies:
flutter_lints: ^1.0.3
''');
// Import the analysis options from the Flutter root.
final File rootAnalysisOptions = File(path.join(_flutterRoot,'analysis_options.yaml'));
final File analysisOptions = File(path.join(directory.path, 'analysis_options.yaml'));
analysisOptions.writeAsStringSync('include: ${rootAnalysisOptions.absolute.path}');
analysisOptions.writeAsStringSync('''
include: package:flutter_lints/flutter.yaml
linter:
rules:
# Samples want to print things pretty often.
avoid_print: false
''');
}
/// Writes out a sample section to the disk and returns the file.