Skip to content

Commit

Permalink
Tweak lint rules and reorganize stevia packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed Oct 26, 2023
1 parent 90cfaec commit c67d903
Show file tree
Hide file tree
Showing 25 changed files with 62 additions and 40 deletions.
8 changes: 8 additions & 0 deletions flint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 2.9.0 (NEXT)

Flutter ruleset:
- Add `avoid_web_libraries_in_flutter`
- Add `no_logic_in_create_state`
- Add `use_colored_box`
- ADd `use_decorated_box`

# 2.8.1 (17/08/2023)
- Remove `unreachable_from_main`

Expand Down
3 changes: 0 additions & 3 deletions flint/lib/analysis_options.dart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,10 @@ ignore:
- always_put_required_named_parameters
- always_specify_types
- avoid_annotating_with_dynamic
- avoid_as
- avoid_classes_with_only_static_members
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_renaming_method_parameters
- avoid_type_to_string
- avoid_web_libraries_in_flutter
- diagnostic_describe_all_properties
- directives_ordering
- discarded_futures
Expand All @@ -205,7 +203,6 @@ ignore:
- prefer_int_literals
- prefer_mixin
- prefer_relative_imports
- public_member_api_docs
- require_trailing_commas
- sized_box_for_whitespace
- sized_box_shrink_expand
Expand Down
4 changes: 4 additions & 0 deletions flint/lib/analysis_options.flutter.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
include: ./analysis_options.dart.yaml
linter:
rules:
- avoid_web_libraries_in_flutter
- no_logic_in_create_state
- sized_box_for_whitespace
- sized_box_shrink_expand
- use_colored_box
- use_decorated_box
- use_full_hex_values_for_flutter_colors
4 changes: 4 additions & 0 deletions stevia/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include: package:flint/analysis_options.flutter.yaml
linter:
rules:
- avoid_renaming_method_parameters
- use_build_context_synchronously
analyzer:
errors:
unused_result: ignore # TODO: enable once https://github.com/dart-lang/sdk/issues/51543 is fixed
10 changes: 5 additions & 5 deletions stevia/dartdoc_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ dartdoc:
categories:
"Stevia":
name: "Stevia"
"Core":
name: "Core"
"Services":
name: "Services"
"Widgets":
name: "Collection"
name: "Widgets"
categoryOrder:
- Sugar
- Core
- Stevia
- Services
- Widgets
ignore:
- ambiguous-reexport
Expand Down
15 changes: 15 additions & 0 deletions stevia/lib/services.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/// ## Services
/// General-purpose widgets and Flutter services.
///
/// * [ColorFilters]
/// * [IntTextInputFormatter]
///
library stevia.services;

import 'package:stevia/services.dart';

export 'package:stevia/services_haptic.dart';
export 'package:stevia/services_time.dart';

export 'src/services/color_filters.dart' hide Matrix5;
export 'src/services/text_input_formatters.dart';
10 changes: 5 additions & 5 deletions stevia/lib/haptic.dart → stevia/lib/services_haptic.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// {@category Core}
/// {@category Services}
///
/// Utilities for performing haptic feedback on devices.
///
Expand Down Expand Up @@ -50,9 +50,9 @@
/// [Haptic.heavy].
///
/// TL;DR: Haptic feedback on Android devices is a mess.
library stevia.haptic;
library stevia.services.haptic;

import 'package:stevia/src/haptic/haptic.dart';
import 'package:stevia/src/services/haptic/haptic.dart';

export 'package:stevia/src/haptic/haptic.dart';
export 'package:stevia/src/haptic/haptic_pattern.dart';
export 'package:stevia/src/services/haptic/haptic.dart';
export 'package:stevia/src/services/haptic/haptic_pattern.dart';
8 changes: 4 additions & 4 deletions stevia/lib/time.dart → stevia/lib/services_time.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// {@category Core}
/// {@category Services}
///
/// Utilities for retrieving the current timezone on Android on iOS.
///
Expand All @@ -25,9 +25,9 @@
///
/// After setting [Timezone.platformTimezoneProvider], [ZonedDateTime.now] and other current timezone dependent functions
/// will return the current platform's timezone on Android and iOS.
library stevia.time;
library stevia.services.time;

import 'package:sugar/sugar.dart';
import 'package:stevia/src/time/flutter_timezone_provider.dart';
import 'package:stevia/src/services/time/flutter_timezone_provider.dart';

export 'src/time/flutter_timezone_provider.dart';
export 'src/services/time/flutter_timezone_provider.dart';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:meta/meta.dart';
import 'package:stevia/haptic.dart';
import 'package:stevia/src/haptic/platform_haptic.dart';
import 'package:stevia/services_haptic.dart';
import 'package:stevia/src/services/haptic/platform_haptic.dart';
import 'package:sugar/sugar.dart';
import 'package:flutter/services.dart';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:meta/meta.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'package:sugar/sugar.dart';

import 'package:stevia/src/haptic/haptic_pattern.dart';
import 'package:stevia/src/services/haptic/haptic_pattern.dart';

/// A [PlatformHaptic] that delegates performing haptic feedback to the native platform.
@internal class PlatformHaptic extends PlatformInterface {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:stevia/src/time/platform_timezone.dart';
import 'package:stevia/src/services/time/platform_timezone.dart';
import 'package:sugar/sugar.dart';

/// Returns a [Timezone.platformTimezoneProvider] that supports Android and iOS platforms in addition to those supported
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions stevia/lib/stevia.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
/// stevia by browsing through the aggregated classes can be overwhelming.
library stevia;

export 'package:stevia/haptic.dart';
export 'package:stevia/time.dart';
export 'package:stevia/services.dart';
export 'package:stevia/widgets.dart';
9 changes: 0 additions & 9 deletions stevia/lib/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
/// * [FutureValueBuilder]
/// * [StreamValueBuilder]
///
/// ## Foundation
/// General-purpose widgets and Flutter services.
///
/// * [ColorFilters]
/// * [IntTextInputFormatter]
///
/// ## Resizable
/// Widgets that contain children which can be resized either horizontally or vertically.
///
Expand All @@ -38,9 +32,6 @@ export 'src/widgets/async/future/future_builder.dart' show
showFutureValueDialog;
export 'src/widgets/async/stream_value_builder.dart';

export 'src/widgets/foundation/color_filters.dart' hide Matrix5;
export 'src/widgets/foundation/text_input_formatters.dart';

export 'src/widgets/resizable/resizable_box.dart';
export 'src/widgets/resizable/resizable_icon.dart';
export 'src/widgets/resizable/resizable_region.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter_test/flutter_test.dart';

import 'package:stevia/src/widgets/foundation/color_filters.dart';
import 'package:stevia/src/services/color_filters.dart';

void main() {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:stevia/haptic.dart';
import 'package:stevia/src/haptic/platform_haptic.dart';
import 'package:stevia/services_haptic.dart';
import 'package:stevia/src/services/haptic/platform_haptic.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:stevia/src/time/platform_timezone.dart';
import 'package:stevia/src/services/time/platform_timezone.dart';

void main() {
TestWidgetsFlutterBinding.ensureInitialized();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:stevia/haptic.dart';
import 'package:stevia/services_haptic.dart';

import 'package:stevia/src/widgets/resizable/resizable_box_model.dart';
import 'package:stevia/src/widgets/resizable/resizable_region_box.dart';
Expand Down
2 changes: 1 addition & 1 deletion stevia/test/src/widgets/resizable/slider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter_test/flutter_test.dart';

import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stevia/haptic.dart';
import 'package:stevia/services_haptic.dart';
import 'package:stevia/src/widgets/resizable/direction.dart';

import 'package:stevia/src/widgets/resizable/resizable_box_model.dart';
Expand Down
8 changes: 6 additions & 2 deletions sugar/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
include: package:flint/analysis_options.dart.yaml
linter:
rules:
- avoid_equals_and_hash_code_on_mutable_classes

analyzer:
errors:
unused_result: ignore # TODO: enable once https://github.com/dart-lang/sdk/issues/51543 is fixed

exclude:
- lib/src/time/zone/info/**
- misc/**
- misc/**
- out/**

0 comments on commit c67d903

Please sign in to comment.