浏览代码

Merge pull request #16 from ente-io/linters

Add recommended linters
Neeraj Gupta 4 年之前
父节点
当前提交
a42dd69f74
共有 3 个文件被更改,包括 109 次插入64 次删除
  1. 41 0
      analysis_options.yaml
  2. 7 0
      pubspec.lock
  3. 61 64
      pubspec.yaml

+ 41 - 0
analysis_options.yaml

@@ -0,0 +1,41 @@
+# For more linters, we can check https://dart-lang.github.io/linter/lints/index.html
+# or https://pub.dev/packages/lint (Effective dart)
+# use "flutter analyze ." or "dart  analyze ." for running lint checks
+
+include: package:lints/recommended.yaml
+linter:
+  rules:
+    # Ref https://github.com/flutter/packages/blob/master/packages/flutter_lints/lib/flutter.yaml
+    - avoid_print
+    - avoid_unnecessary_containers
+    - avoid_web_libraries_in_flutter
+    - no_logic_in_create_state
+    - prefer_const_constructors
+    - prefer_const_constructors_in_immutables
+    - prefer_const_declarations
+    - prefer_const_literals_to_create_immutables
+    - sized_box_for_whitespace
+    - use_full_hex_values_for_flutter_colors
+    - use_key_in_widget_constructors
+
+    - avoid_empty_else
+    - exhaustive_cases
+
+    # just style suggestions
+    - sort_pub_dependencies
+    - use_rethrow_when_possible
+    - prefer_double_quotes
+
+analyzer:
+  errors:
+    avoid_empty_else: error
+    exhaustive_cases: error
+    use_rethrow_when_possible: info
+
+    prefer_const_constructors: ignore # too many warnings
+    prefer_const_declarations: ignore # too many warnings
+    prefer_const_constructors_in_immutables: ignore # too many warnings
+    prefer_double_quotes: ignore # too many warnings
+
+  exclude:
+    - thirdparty/**

+ 7 - 0
pubspec.lock

@@ -508,6 +508,13 @@ packages:
       url: "https://pub.dartlang.org"
       url: "https://pub.dartlang.org"
     source: hosted
     source: hosted
     version: "2.0.2"
     version: "2.0.2"
+  lints:
+    dependency: "direct dev"
+    description:
+      name: lints
+      url: "https://pub.dartlang.org"
+    source: hosted
+    version: "1.0.1"
   loading_animations:
   loading_animations:
     dependency: "direct main"
     dependency: "direct main"
     description:
     description:

+ 61 - 64
pubspec.yaml

@@ -17,90 +17,87 @@ environment:
   sdk: ">=2.10.0 <3.0.0"
   sdk: ">=2.10.0 <3.0.0"
 
 
 dependencies:
 dependencies:
-  flutter:
-    sdk: flutter
-
-  # The following adds the Cupertino Icons font to your application.
-  # Use with the CupertinoIcons class for iOS style icons.
+  animate_do: ^1.7.2
+  archive: ^3.1.2
+  background_fetch: ^1.0.1
+  cached_network_image: ^3.0.0
+  chewie: ^1.0.0
+  computer: ^1.0.2
+  confetti: ^0.5.5
+  connectivity: ^3.0.3
+  crisp:
+    git: "https://github.com/kcrebound/flutter-crisp.git"
   cupertino_icons: ^1.0.0
   cupertino_icons: ^1.0.0
-  photo_manager: ^1.2.4
-  provider: ^3.1.0
-  sqflite: ^2.0.0+3
-  sqflite_migration: ^0.3.0
-  path_provider: ^2.0.1
-  shared_preferences: ^2.0.5
+  device_info: ^2.0.2
   dio: ^4.0.0
   dio: ^4.0.0
-  image: ^3.0.2
-  share: ^2.0.1
-  photo_view: ^0.11.1
-  visibility_detector: ^0.2.0
+  dots_indicator: ^2.0.0
+  email_validator: ^1.0.6
   event_bus: ^2.0.0
   event_bus: ^2.0.0
-  sentry: ^5.0.0
-  super_logging:
-    path: thirdparty/super_logging
-  archive: ^3.1.2
+  exif: ^3.0.0
+  expansion_card: ^0.1.0
+  extended_image:
+    path: thirdparty/extended_image
+  flutter:
+    sdk: flutter
+  flutter_cache_manager: ^3.0.1
+  flutter_easyloading: ^3.0.0
   flutter_email_sender: ^5.0.0
   flutter_email_sender: ^5.0.0
-  like_button: ^2.0.2
-  logging: ^1.0.1
   flutter_image_compress:
   flutter_image_compress:
     path: thirdparty/flutter_image_compress
     path: thirdparty/flutter_image_compress
-  flutter_typeahead: ^1.8.1
-  fluttertoast: ^8.0.6
-  video_player: ^2.0.0
-  chewie: ^1.0.0
-  cached_network_image: ^3.0.0
-  animate_do: ^1.7.2
-  flutter_cache_manager: ^3.0.1
-  computer: ^1.0.2
+  flutter_inappwebview: ^5.3.2
+  flutter_local_notifications: ^5.0.0+4
+  flutter_password_strength: ^0.1.6
   flutter_secure_storage: ^4.2.0
   flutter_secure_storage: ^4.2.0
-  uni_links: ^0.5.1
-  crisp:
-    git: https://github.com/kcrebound/flutter-crisp.git
   flutter_sodium: ^0.2.0
   flutter_sodium: ^0.2.0
-  pedantic: ^1.9.2
-  page_transition: "^1.1.7+2"
-  scrollable_positioned_list: ^0.1.10
-  connectivity: ^3.0.3
-  url_launcher: ^6.0.3
+  flutter_typeahead: ^1.8.1
+  flutter_user_agent: ^1.2.2
+  flutter_windowmanager: ^0.0.2
   fluttercontactpicker: ^4.4.0
   fluttercontactpicker: ^4.4.0
+  fluttertoast: ^8.0.6
+  google_nav_bar: ^5.0.5
+  image: ^3.0.2
+  image_editor: ^1.0.0
+  implicitly_animated_reorderable_list: ^0.4.0
   in_app_purchase:
   in_app_purchase:
     path: thirdparty/in_app_purchase
     path: thirdparty/in_app_purchase
-  expansion_card: ^0.1.0
-  flutter_password_strength: ^0.1.6
-  flutter_inappwebview: ^5.3.2
-  background_fetch: ^1.0.1
-  # flutter_inapp_purchase: ^3.0.1
-  google_nav_bar: ^5.0.5
-  package_info_plus: ^1.0.1
+  intl: ^0.17.0
+  like_button: ^2.0.2
+  loading_animations: ^2.1.0
   local_auth: ^1.1.5
   local_auth: ^1.1.5
-  flutter_windowmanager: ^0.0.2
-  flutter_user_agent: ^1.2.2
-  quiver: ^3.0.1
+  logging: ^1.0.1
   move_to_background: ^1.0.2
   move_to_background: ^1.0.2
-  loading_animations: ^2.1.0
-  dots_indicator: ^2.0.0
-  flutter_local_notifications: ^5.0.0+4
   open_file: ^3.2.1
   open_file: ^3.2.1
-  email_validator: '^1.0.6'
-  extended_image:
-    path: thirdparty/extended_image
-  image_editor: ^1.0.0
-  syncfusion_flutter_sliders: ^19.1.67-beta
-  syncfusion_flutter_core: ^19.1.67
+  package_info_plus: ^1.0.1
+  page_transition: ^1.1.7+2
+  path_provider: ^2.0.1
+  pedantic: ^1.9.2
+  photo_manager: ^1.2.4
+  photo_view: ^0.11.1
   pinput: ^1.2.0
   pinput: ^1.2.0
-  intl: ^0.17.0
-  confetti: ^0.5.5
-  flutter_easyloading: ^3.0.0
-  device_info: ^2.0.2
-  exif: ^3.0.0
+  provider: ^3.1.0
+  quiver: ^3.0.1
+  scrollable_positioned_list: ^0.1.10
+  sentry: ^5.0.0
+  share: ^2.0.1
+  shared_preferences: ^2.0.5
+  sqflite: ^2.0.0+3
+  sqflite_migration: ^0.3.0
+  super_logging:
+    path: thirdparty/super_logging
+  syncfusion_flutter_core: ^19.1.67
+  syncfusion_flutter_sliders: ^19.1.67-beta
+  uni_links: ^0.5.1
+  url_launcher: ^6.0.3
+  video_player: ^2.0.0
+  visibility_detector: ^0.2.0
   wallpaper_manager_flutter: ^0.0.2
   wallpaper_manager_flutter: ^0.0.2
-  implicitly_animated_reorderable_list: ^0.4.0
 
 
 dev_dependencies:
 dev_dependencies:
-  flutter_test:
-    sdk: flutter
   flutter_launcher_icons: "0.9.0"
   flutter_launcher_icons: "0.9.0"
   flutter_native_splash: ^1.1.8+4
   flutter_native_splash: ^1.1.8+4
+  flutter_test:
+    sdk: flutter
+  lints: ^1.0.1
 
 
 flutter_icons:
 flutter_icons:
   android: true
   android: true