From f6297699f0bd9fcb78ef3866c57efa7b4fcffbfe Mon Sep 17 00:00:00 2001 From: Jonas Wanke Date: Tue, 19 Dec 2023 11:13:24 +0100 Subject: [PATCH] Migrate example to supernova's lints --- example/analysis_options.yaml | 66 +---- example/lib/main.dart | 24 +- example/pubspec.lock | 437 +++++++++++++++++++++++++++++++++- example/pubspec.yaml | 6 +- 4 files changed, 456 insertions(+), 77 deletions(-) diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 6900559..c1f9a24 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -1,65 +1 @@ -include: package:flutter_lints/flutter.yaml - -analyzer: - language: - strict-casts: true - strict-inference: true - strict-raw-types: true - -linter: - rules: - always_declare_return_types: true - avoid_bool_literals_in_conditional_expressions: true - avoid_catching_errors: true - avoid_double_and_int_checks: true - avoid_field_initializers_in_const_classes: true - avoid_final_parameters: true - avoid_implementing_value_types: true - avoid_js_rounded_ints: true - avoid_positional_boolean_parameters: true - avoid_returning_this: true - avoid_setters_without_getters: true - avoid_slow_async_io: true - avoid_types_on_closure_parameters: true - avoid_unused_constructor_parameters: true - avoid_void_async: true - cancel_subscriptions: true - cast_nullable_to_non_nullable: true - close_sinks: true - comment_references: true - conditional_uri_does_not_exist: true - depend_on_referenced_packages: false - directives_ordering: true - flutter_style_todos: true - join_return_with_assignment: true - no_adjacent_strings_in_list: true - omit_local_variable_types: true - only_throw_errors: true - prefer_asserts_in_initializer_lists: true - prefer_final_in_for_each: true - prefer_final_locals: true - prefer_foreach: true - prefer_if_elements_to_conditional_expressions: true - prefer_int_literals: true - prefer_relative_imports: true - prefer_single_quotes: true - secure_pubspec_urls: true - sized_box_shrink_expand: true - sort_constructors_first: true - sort_pub_dependencies: true - sort_unnamed_constructors_first: true - test_types_in_equals: true - throw_in_finally: true - tighten_type_of_initializing_formals: true - unawaited_futures: true - unnecessary_lambdas: true - unnecessary_parenthesis: true - unnecessary_statements: true - unsafe_html: true - use_colored_box: true - use_decorated_box: true - use_enums: true - use_key_in_widget_constructors: false - use_setters_to_change_properties: true - use_string_buffers: true - use_super_parameters: true +include: package:supernova/lints.yaml diff --git a/example/lib/main.dart b/example/lib/main.dart index 82756ba..8297af9 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -29,19 +29,21 @@ class BottomSheetExample extends StatelessWidget { title: 'FancyBottomSheet', children: [ FancyElevatedButton( - onPressed: () { - context.showFancyModalBottomSheet( - builder: (_) => const Padding( - padding: EdgeInsets.symmetric(vertical: 128, horizontal: 16), - child: Text("I'm fancy!"), - ), - ); - }, + onPressed: () async => _handlePressed(context), child: const Text('Open FancyBottomSheet'), ), ], ); } + + Future _handlePressed(BuildContext context) async { + await context.showFancyModalBottomSheet( + builder: (_) => const Padding( + padding: EdgeInsets.symmetric(vertical: 128, horizontal: 16), + child: Text("I'm fancy!"), + ), + ); + } } class FillOrWrapExample extends StatelessWidget { @@ -63,7 +65,9 @@ class FillOrWrapExample extends StatelessWidget { return Center( child: Container( constraints: isConstrained ? const BoxConstraints(maxWidth: 200) : null, - decoration: BoxDecoration(border: Border.all()), + decoration: const BoxDecoration( + border: Border.fromBorderSide(BorderSide()), + ), child: FillOrWrap( spacing: 8, wrappedSpacing: 8, @@ -93,7 +97,7 @@ class Section extends StatelessWidget { children: [ Text(title, style: context.textTheme.titleMedium), const SizedBox(height: 8), - ...children + ...children, ], ), ); diff --git a/example/pubspec.lock b/example/pubspec.lock index e8ec67c..ec3dcb0 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,6 +1,62 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" + source: hosted + version: "64.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" + source: hosted + version: "6.2.0" + analyzer_plugin: + dependency: transitive + description: + name: analyzer_plugin + sha256: "9661b30b13a685efaee9f02e5d01ed9f2b423bd889d28a304d02d704aee69161" + url: "https://pub.dev" + source: hosted + version: "0.11.3" + ansi_styles: + dependency: transitive + description: + name: ansi_styles + sha256: "9c656cc12b3c27b17dd982b2cc5c0cfdfbdabd7bc8f3ae5e8542d9867b47ce8a" + url: "https://pub.dev" + source: hosted + version: "0.3.2+1" + ansicolor: + dependency: transitive + description: + name: ansicolor + sha256: "8bf17a8ff6ea17499e40a2d2542c2f481cd7615760c6d34065cb22bfd22e6880" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + args: + dependency: transitive + description: + name: args + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" black_hole_flutter: dependency: "direct main" description: @@ -8,6 +64,14 @@ packages: relative: true source: path version: "1.1.0" + bson: + dependency: transitive + description: + name: bson + sha256: b660352c1912b8c2578c6b0278834dfbe408475726aa6c7acdcff69827dc4e98 + url: "https://pub.dev" + source: hosted + version: "4.0.0" characters: dependency: transitive description: @@ -16,6 +80,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" collection: dependency: transitive description: @@ -24,19 +96,180 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.1" + color: + dependency: transitive + description: + name: color + sha256: ddcdf1b3badd7008233f5acffaf20ca9f5dc2cd0172b75f68f24526a5f5725cb + url: "https://pub.dev" + source: hosted + version: "3.0.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + country_code: + dependency: transitive + description: + name: country_code + sha256: f69ccd5163b1ca43011be9632e33ebe7ffac65e49ce2afcd3e3e5228af5d91fc + url: "https://pub.dev" + source: hosted + version: "1.0.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + dart_code_metrics: + dependency: transitive + description: + path: "." + ref: e962142c6c505c81460c5a94a3cd0c83700ebdb3 + resolved-ref: e962142c6c505c81460c5a94a3cd0c83700ebdb3 + url: "https://github.com/JonasWanke/dart-code-metrics.git" + source: git + version: "5.7.5" + dart_code_metrics_presets: + dependency: transitive + description: + name: dart_code_metrics_presets + sha256: "06e1aea3e4c2beb555ed1ac92366fbc8040ad0b36a0dbd4ec501c11cdb3e57a8" + url: "https://pub.dev" + source: hosted + version: "2.7.0" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" + url: "https://pub.dev" + source: hosted + version: "2.3.4" + dartx: + dependency: transitive + description: + name: dartx + sha256: "8b25435617027257d43e6508b5fe061012880ddfdaa75a71d607c3de2a13d244" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + decimal: + dependency: transitive + description: + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + email_validator: + dependency: transitive + description: + name: email_validator + sha256: e9a90f27ab2b915a27d7f9c2a7ddda5dd752d6942616ee83529b686fc086221b + url: "https://pub.dev" + source: hosted + version: "2.1.17" + equatable: + dependency: transitive + description: + name: equatable + sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2 + url: "https://pub.dev" + source: hosted + version: "2.0.5" + file: + dependency: transitive + description: + name: file + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" + source: hosted + version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter source: sdk version: "0.0.0" flutter_lints: - dependency: "direct dev" + dependency: transitive description: name: flutter_lints sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 url: "https://pub.dev" source: hosted version: "2.0.3" + freezed_annotation: + dependency: transitive + description: + name: freezed_annotation + sha256: c3fd9336eb55a38cc1bbd79ab17573113a8deccd0ecbbf926cca3c62803b5c2d + url: "https://pub.dev" + source: hosted + version: "2.4.1" + glob: + dependency: transitive + description: + name: glob + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" + http: + dependency: transitive + description: + name: http + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" js: dependency: transitive description: @@ -45,6 +278,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" + source: hosted + version: "4.8.1" lints: dependency: transitive description: @@ -69,11 +310,173 @@ packages: url: "https://pub.dev" source: hosted version: "1.9.1" + oxidized: + dependency: transitive + description: + name: oxidized + sha256: cb3347f9c5928f7b3335991caf355b793a558df66299e8533cab3d4c8e3e197f + url: "https://pub.dev" + source: hosted + version: "6.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + packages_extensions: + dependency: transitive + description: + name: packages_extensions + sha256: "268108a92be955e33a58cf6492e289e43ef55a50c89fa64947f032f5cefeb3fc" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" + source: hosted + version: "5.4.0" + power_extensions: + dependency: transitive + description: + name: power_extensions + sha256: "9e9092bebe65c05de19eab134f3c2a00afb8857fcb0a8a4571dad1e8289f170c" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + rational: + dependency: transitive + description: + name: rational + sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf + url: "https://pub.dev" + source: hosted + version: "2.2.2" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + url: "https://pub.dev" + source: hosted + version: "0.27.7" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + supernova: + dependency: "direct dev" + description: + path: supernova + ref: f59c0bb55b5cc611b67c60c9eaa35dc34a927310 + resolved-ref: f59c0bb55b5cc611b67c60c9eaa35dc34a927310 + url: "https://github.com/JonasWanke/supernova.git" + source: git + version: "0.0.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + time: + dependency: transitive + description: + name: time + sha256: "83427e11d9072e038364a5e4da559e85869b227cf699a541be0da74f14140124" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + time_machine: + dependency: transitive + description: + path: "." + ref: "0a68b36272f437bd5c638f79ab2f5b4cecb5dbcb" + resolved-ref: "0a68b36272f437bd5c638f79ab2f5b4cecb5dbcb" + url: "https://github.com/JonasWanke/time_machine.git" + source: git + version: "0.9.17" + todo: + dependency: transitive + description: + name: todo + sha256: "1c092daccc5e42568109716001f91e7cdfdb744aa2f3950ae67e64978ea4d3dd" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: transitive + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" vector_math: dependency: transitive description: @@ -82,6 +485,38 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + watcher: + dependency: transitive + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" + source: hosted + version: "2.4.0" + xml: + dependency: transitive + description: + name: xml + sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + url: "https://pub.dev" + source: hosted + version: "6.3.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" + source: hosted + version: "3.1.2" sdks: dart: ">=3.0.0 <4.0.0" flutter: ">=3.10.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f2234e0..fe02d57 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -12,7 +12,11 @@ dependencies: sdk: flutter dev_dependencies: - flutter_lints: ^2.0.2 + supernova: + git: + url: https://github.com/JonasWanke/supernova.git + path: supernova + ref: f59c0bb55b5cc611b67c60c9eaa35dc34a927310 flutter: uses-material-design: true