From 8e49fbc72ed68b91f70cc449ba0339e6b4da6e32 Mon Sep 17 00:00:00 2001 From: Feichtmeier Date: Mon, 28 Oct 2024 19:44:19 +0100 Subject: [PATCH] chore: update linting rules and apply them --- clipboard_viewer/analysis_options.yaml | 27 ++++++++++++++++++++++++-- clipboard_viewer/lib/main.dart | 7 ++++--- clipboard_viewer/pubspec.yaml | 18 +++++------------ clipboard_viewer/test/widget_test.dart | 5 ++--- pubspec.yaml | 1 + 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/clipboard_viewer/analysis_options.yaml b/clipboard_viewer/analysis_options.yaml index 1b98075..13422fc 100755 --- a/clipboard_viewer/analysis_options.yaml +++ b/clipboard_viewer/analysis_options.yaml @@ -1,6 +1,29 @@ include: package:flutter_lints/flutter.yaml -analyzer: - linter: rules: + prefer_single_quotes: true + require_trailing_commas: true + always_declare_return_types: true + avoid_catches_without_on_clauses: true + avoid_equals_and_hash_code_on_mutable_classes: true + avoid_types_on_closure_parameters: true + cancel_subscriptions: true + directives_ordering: true + eol_at_end_of_file: true + omit_local_variable_types: true + prefer_asserts_in_initializer_lists: true + prefer_const_constructors: true + prefer_final_in_for_each: true + prefer_final_locals: true + prefer_null_aware_method_calls: true + prefer_null_aware_operators: true + sort_constructors_first: true + sort_unnamed_constructors_first: true + sort_pub_dependencies: true + type_annotate_public_apis: true + unawaited_futures: true + unnecessary_lambdas: true + unnecessary_parenthesis: true + use_named_constants: true + use_super_parameters: true \ No newline at end of file diff --git a/clipboard_viewer/lib/main.dart b/clipboard_viewer/lib/main.dart index 44a2fc0..a0e9ade 100755 --- a/clipboard_viewer/lib/main.dart +++ b/clipboard_viewer/lib/main.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:pasteboard/pasteboard.dart'; -import 'package:super_clipboard/super_clipboard.dart'; // ignore: implementation_imports import 'package:super_clipboard/src/format_conversions.dart'; +import 'package:super_clipboard/super_clipboard.dart'; void main() { runApp(const MyApp()); @@ -54,13 +54,14 @@ class _MyHomePageState extends State { return ListTile( title: SelectableText(item.$2.toString()), subtitle: SelectableText( - item.$1.platformFormats.map((e) => "'$e'").join(", ")), + item.$1.platformFormats.map((e) => "'$e'").join(', '), + ), ); }, ), floatingActionButton: FloatingActionButton( onPressed: () async { - await Pasteboard.writeFiles(["/home/davide"]); + await Pasteboard.writeFiles(['/home/davide']); return; // TODO(@HrX03) is this needed? // ignore: unused_local_variable, dead_code diff --git a/clipboard_viewer/pubspec.yaml b/clipboard_viewer/pubspec.yaml index 3242415..8bdcace 100755 --- a/clipboard_viewer/pubspec.yaml +++ b/clipboard_viewer/pubspec.yaml @@ -1,31 +1,23 @@ name: clipboard_viewer description: A new Flutter project. -publish_to: 'none' +publish_to: "none" version: 1.0.0+1 environment: - sdk: '>=3.0.0-313.0.dev <4.0.0' + sdk: ">=3.0.0-313.0.dev <4.0.0" dependencies: + cupertino_icons: ^1.0.2 flutter: sdk: flutter - - cupertino_icons: ^1.0.2 + pasteboard: ^0.2.0 super_clipboard: ^0.2.3 super_native_extensions: ^0.2.3 - pasteboard: ^0.2.0 dev_dependencies: + flutter_lints: ^2.0.0 flutter_test: sdk: flutter - flutter_lints: ^2.0.0 - - flutter: uses-material-design: true - - - - - \ No newline at end of file diff --git a/clipboard_viewer/test/widget_test.dart b/clipboard_viewer/test/widget_test.dart index ae39a95..fc66a1a 100755 --- a/clipboard_viewer/test/widget_test.dart +++ b/clipboard_viewer/test/widget_test.dart @@ -1,10 +1,9 @@ +import 'package:clipboard_viewer/main.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:clipboard_viewer/main.dart'; - void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { + testWidgets('Counter increments smoke test', (tester) async { await tester.pumpWidget(const MyApp()); expect(find.text('0'), findsOneWidget); diff --git a/pubspec.yaml b/pubspec.yaml index e8b4658..31ac000 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,6 +6,7 @@ version: 1.0.0+1 environment: sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.24.3" dependencies: collection: ^1.16.0