From 591133298c0f392455f2b9c2a3ce46a1b4a61702 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Wed, 3 Jul 2024 17:00:18 -0400 Subject: [PATCH 01/12] Added husky --- .husky/pre-commit | 12 ++++++++++++ pubspec.yaml | 1 + 2 files changed, 13 insertions(+) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..fb0c0e86c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,12 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +branch_name=$(git rev-parse --abbrev-ref HEAD) + +if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then + echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" + echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" + echo "Example: feat/new-feature" + exit 1 +fi + diff --git a/pubspec.yaml b/pubspec.yaml index ac25b8a2c..8b2c59f7e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,4 +4,5 @@ environment: sdk: ">=3.0.0 <4.0.0" dev_dependencies: + husky: ^0.1.7 melos: ^6.0.0 From f7736f528c08a6a1903c0ba2246556cf95040f71 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:07:58 -0400 Subject: [PATCH 02/12] Keep calm and commit --- .husky/pre-commit | 21 ++++++++++++++------- pubspec.yaml | 8 ++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index fb0c0e86c..944cc96ed 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,12 +1,19 @@ #!/usr/bin/env sh + . "$(dirname -- "$0")/_/husky.sh" -branch_name=$(git rev-parse --abbrev-ref HEAD) +dart --version +# dart format --line-length 80 --set-exit-if-changed lib test +# dart analyze --fatal-infos --fatal-warnings lib test +# dart test + +# branch_name=$(git rev-parse --abbrev-ref HEAD) -if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then - echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" - echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" - echo "Example: feat/new-feature" - exit 1 -fi +# if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then +# echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" +# echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" +# echo "Example: feat/new-feature" +# exit 1 +# fi +# dart test diff --git a/pubspec.yaml b/pubspec.yaml index 8b2c59f7e..9a1e56372 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,12 @@ name: mix environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.0.6 <4.0.0" dev_dependencies: husky: ^0.1.7 - melos: ^6.0.0 + lint_staged: ^0.5.1 + melos: ^6.1.0 + +lint_staged: + '**.dart': dart fix --apply && dart format --fix && dcm fix From 31665c40e18776845b4b0331094b7e5db611242f Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:08:55 -0400 Subject: [PATCH 03/12] Keep calm and commit --- .husky/pre-commit | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 944cc96ed..c024ad19b 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -7,13 +7,13 @@ dart --version # dart analyze --fatal-infos --fatal-warnings lib test # dart test -# branch_name=$(git rev-parse --abbrev-ref HEAD) +branch_name=$(git rev-parse --abbrev-ref HEAD) + +if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then + echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" + echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" + echo "Example: feat/new-feature" + exit 1 +fi -# if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then -# echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" -# echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" -# echo "Example: feat/new-feature" -# exit 1 -# fi -# dart test From deafa1de684f46a336c054510a559be13365d3cc Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:11:48 -0400 Subject: [PATCH 04/12] added test sample --- .husky/pre-commit | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index c024ad19b..385b8f99b 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -7,13 +7,13 @@ dart --version # dart analyze --fatal-infos --fatal-warnings lib test # dart test -branch_name=$(git rev-parse --abbrev-ref HEAD) +# branch_name=$(git rev-parse --abbrev-ref HEAD) -if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then - echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" - echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" - echo "Example: feat/new-feature" - exit 1 -fi +# if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then +# echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" +# echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" +# echo "Example: feat/new-feature" +# exit 1 +# fi From 76b18bf0c53575b2ced592f609c242abbc64dcfa Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:17:33 -0400 Subject: [PATCH 05/12] Commit message --- .husky/pre-commit | 19 ------------------- .huskyrc | 5 +++++ 2 files changed, 5 insertions(+), 19 deletions(-) delete mode 100755 .husky/pre-commit create mode 100644 .huskyrc diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 385b8f99b..000000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env sh - -. "$(dirname -- "$0")/_/husky.sh" - -dart --version -# dart format --line-length 80 --set-exit-if-changed lib test -# dart analyze --fatal-infos --fatal-warnings lib test -# dart test - -# branch_name=$(git rev-parse --abbrev-ref HEAD) - -# if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then -# echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" -# echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" -# echo "Example: feat/new-feature" -# exit 1 -# fi - - diff --git a/.huskyrc b/.huskyrc new file mode 100644 index 000000000..7a53806b1 --- /dev/null +++ b/.huskyrc @@ -0,0 +1,5 @@ +{ + "hooks": { + "pre-commit": "flutter test" + } +} From 496ddf5fdff95c89c884ce4de1aa13272339c567 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:21:40 -0400 Subject: [PATCH 06/12] precommit --- .husky/pre-commit | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 .husky/pre-commit diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..385b8f99b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +. "$(dirname -- "$0")/_/husky.sh" + +dart --version +# dart format --line-length 80 --set-exit-if-changed lib test +# dart analyze --fatal-infos --fatal-warnings lib test +# dart test + +# branch_name=$(git rev-parse --abbrev-ref HEAD) + +# if ! [[ $branch_name =~ ^(feat/|fix/|docs/|style/|refactor/|perf/|test/|build/|ci/|chore/|revert/).+ ]]; then +# echo "Invalid branch name. Branch names must start with one of the following prefixes followed by a forward slash:" +# echo "feat/, fix/, docs/, style/, refactor/, perf/, test/, build/, ci/, chore/, revert/" +# echo "Example: feat/new-feature" +# exit 1 +# fi + + From 7618f850832320b9558d7495797dd3f6315e08bb Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:33:27 -0400 Subject: [PATCH 07/12] Commit --- .husky/pre-commit | 16 +++++++++++++++- .huskyrc | 5 ----- 2 files changed, 15 insertions(+), 6 deletions(-) delete mode 100644 .huskyrc diff --git a/.husky/pre-commit b/.husky/pre-commit index 385b8f99b..2aac200fd 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,7 +2,21 @@ . "$(dirname -- "$0")/_/husky.sh" -dart --version +# Find the absolute path to the fvm command +FVM_PATH=$(command -v fvm) + +# Check if fvm command is found +if [ -n "$FVM_PATH" ]; then + # Add the directory containing the fvm command to PATH + export PATH="$(dirname "$FVM_PATH"):$PATH" +else + echo "FVM not found. Please make sure it is installed and accessible." + exit 1 +fi + +dart run lint_staged + + # dart format --line-length 80 --set-exit-if-changed lib test # dart analyze --fatal-infos --fatal-warnings lib test # dart test diff --git a/.huskyrc b/.huskyrc deleted file mode 100644 index 7a53806b1..000000000 --- a/.huskyrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hooks": { - "pre-commit": "flutter test" - } -} From 0c5c4e49182f8ad7030594ddf740fe0e816fe772 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:33:38 -0400 Subject: [PATCH 08/12] test --- packages/mix/lib/src/attributes/animated/animated_util.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/mix/lib/src/attributes/animated/animated_util.dart b/packages/mix/lib/src/attributes/animated/animated_util.dart index ede696b3b..85c1243e1 100644 --- a/packages/mix/lib/src/attributes/animated/animated_util.dart +++ b/packages/mix/lib/src/attributes/animated/animated_util.dart @@ -13,7 +13,6 @@ final class AnimatedUtility DurationUtility get duration => DurationUtility((v) => only(duration: v)); CurveUtility get curve => CurveUtility((v) => only(curve: v)); - @override T only({Duration? duration, Curve? curve}) { return builder(AnimatedDataDto(duration: duration, curve: curve)); From 7473ca28438f008fae28d37bc8e7997f25c82e7f Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:34:46 -0400 Subject: [PATCH 09/12] wip --- packages/mix/lib/src/attributes/border/border_dto.dart | 1 - .../mix/lib/src/attributes/border/border_radius_dto.dart | 1 - .../mix/lib/src/attributes/border/shape_border_dto.dart | 2 -- packages/mix/lib/src/attributes/color/color_util.dart | 1 - .../lib/src/attributes/decoration/decoration_dto.dart | 2 -- packages/mix/lib/src/core/attribute.dart | 1 - packages/mix/lib/src/core/attributes_map.dart | 1 - packages/mix/lib/src/core/directive.dart | 1 - packages/mix/lib/src/core/spec.dart | 1 - .../mix/lib/src/modifiers/sized_box_widget_modifier.dart | 9 +++++---- packages/mix/lib/src/theme/tokens/mix_token.dart | 1 - 11 files changed, 5 insertions(+), 16 deletions(-) diff --git a/packages/mix/lib/src/attributes/border/border_dto.dart b/packages/mix/lib/src/attributes/border/border_dto.dart index 14ea2cf4d..a9dc15e91 100644 --- a/packages/mix/lib/src/attributes/border/border_dto.dart +++ b/packages/mix/lib/src/attributes/border/border_dto.dart @@ -48,7 +48,6 @@ sealed class BoxBorderDto extends Dto { bool get isUniform; bool get isDirectional => this is BorderDirectionalDto; - @override BoxBorderDto merge(covariant BoxBorderDto? other); } diff --git a/packages/mix/lib/src/attributes/border/border_radius_dto.dart b/packages/mix/lib/src/attributes/border/border_radius_dto.dart index 9af6bc790..26982220c 100644 --- a/packages/mix/lib/src/attributes/border/border_radius_dto.dart +++ b/packages/mix/lib/src/attributes/border/border_radius_dto.dart @@ -35,7 +35,6 @@ sealed class BorderRadiusGeometryDto Radius? get topEnd; Radius? get bottomStart; Radius? get bottomEnd; - @override BorderRadiusGeometryDto merge(covariant BorderRadiusGeometryDto? other); diff --git a/packages/mix/lib/src/attributes/border/shape_border_dto.dart b/packages/mix/lib/src/attributes/border/shape_border_dto.dart index 046d7bba7..72f438d45 100644 --- a/packages/mix/lib/src/attributes/border/shape_border_dto.dart +++ b/packages/mix/lib/src/attributes/border/shape_border_dto.dart @@ -46,7 +46,6 @@ sealed class ShapeBorderDto extends Dto { StadiumBorderDto toStadiumBorder(); StarBorderDto toStar(); LinearBorderDto toLinear(); - @override ShapeBorderDto merge(covariant ShapeBorderDto? other); @@ -201,7 +200,6 @@ final class ContinuousRectangleBorderDto @override BorderRadiusGeometryDto? get _borderRadius => borderRadius; - @override ContinuousRectangleBorder get defaultValue => const ContinuousRectangleBorder(); diff --git a/packages/mix/lib/src/attributes/color/color_util.dart b/packages/mix/lib/src/attributes/color/color_util.dart index f099f1bf0..a5a47cbfd 100644 --- a/packages/mix/lib/src/attributes/color/color_util.dart +++ b/packages/mix/lib/src/attributes/color/color_util.dart @@ -24,7 +24,6 @@ base class FoundationColorUtility const FoundationColorUtility(super.builder, this.color); T call() => _buildColor(color); - @override T directive(ColorDirective directive) => builder(ColorDto.raw(value: color, directives: [directive])); diff --git a/packages/mix/lib/src/attributes/decoration/decoration_dto.dart b/packages/mix/lib/src/attributes/decoration/decoration_dto.dart index 70b2b2c3c..faf91132d 100644 --- a/packages/mix/lib/src/attributes/decoration/decoration_dto.dart +++ b/packages/mix/lib/src/attributes/decoration/decoration_dto.dart @@ -78,7 +78,6 @@ sealed class DecorationDto extends Dto { bool get isMergeable; DecorationDto? mergeableDecor(covariant DecorationDto? other); - @override DecorationDto merge(covariant DecorationDto? other); } @@ -163,7 +162,6 @@ final class ShapeDecorationDto extends DecorationDto }) : super(boxShadow: shadows); List? get shadows => boxShadow; - @override ShapeDecorationDto mergeableDecor(BoxDecorationDto? other) { if (other == null) return this; diff --git a/packages/mix/lib/src/core/attribute.dart b/packages/mix/lib/src/core/attribute.dart index 8db258d43..f299637b9 100644 --- a/packages/mix/lib/src/core/attribute.dart +++ b/packages/mix/lib/src/core/attribute.dart @@ -10,7 +10,6 @@ abstract base class Attribute with MergeableMixin, EqualityMixin { // Used as the key to determine how // attributes get merged Object get mergeKey => runtimeType; - @override Attribute merge(covariant Attribute? other); } diff --git a/packages/mix/lib/src/core/attributes_map.dart b/packages/mix/lib/src/core/attributes_map.dart index e4c5ddbee..a983690f0 100644 --- a/packages/mix/lib/src/core/attributes_map.dart +++ b/packages/mix/lib/src/core/attributes_map.dart @@ -60,7 +60,6 @@ class AttributeMap { } Map toMap() => _map?.cast() ?? {}; - @override bool operator ==(Object other) { if (identical(this, other)) return true; diff --git a/packages/mix/lib/src/core/directive.dart b/packages/mix/lib/src/core/directive.dart index 5c4f1321b..ae4e651a4 100644 --- a/packages/mix/lib/src/core/directive.dart +++ b/packages/mix/lib/src/core/directive.dart @@ -12,7 +12,6 @@ class TextDirectiveDto extends Dto { @visibleForTesting int get length => _modifiers.length; - @override TextDirective resolve(MixData mix) { return TextDirective((String content) { diff --git a/packages/mix/lib/src/core/spec.dart b/packages/mix/lib/src/core/spec.dart index fbf1fc4a7..d94bd1b3c 100644 --- a/packages/mix/lib/src/core/spec.dart +++ b/packages/mix/lib/src/core/spec.dart @@ -35,7 +35,6 @@ abstract base class SpecAttribute extends StyledAttribute { const SpecAttribute({this.animated}); Value resolve(MixData mix); - @override SpecAttribute merge(covariant SpecAttribute? other); } diff --git a/packages/mix/lib/src/modifiers/sized_box_widget_modifier.dart b/packages/mix/lib/src/modifiers/sized_box_widget_modifier.dart index 49e563657..07780617e 100644 --- a/packages/mix/lib/src/modifiers/sized_box_widget_modifier.dart +++ b/packages/mix/lib/src/modifiers/sized_box_widget_modifier.dart @@ -67,17 +67,18 @@ final class SizedBoxModifierAttribute extends WidgetModifierAttribute< final class SizedBoxModifierUtility extends MixUtility { - SizedBoxModifierUtility(super.builder); - /// Utility for defining [SizedBoxModifierAttribute.height] late final height = DoubleUtility((value) => call(height: value)); /// Utility for defining [SizedBoxModifierAttribute.width] late final width = DoubleUtility((value) => call(width: value)); - /// Utility for defining [SizedBoxModifierAttribute.width] + /// Utility for defining [SizedBoxModifierAttribute.width] /// and [SizedBoxModifierAttribute.height] - late final square = DoubleUtility((value) => call(width: value, height: value)); + late final square = + DoubleUtility((value) => call(width: value, height: value)); + + SizedBoxModifierUtility(super.builder); T call({double? width, double? height}) { return builder(SizedBoxModifierAttribute(width: width, height: height)); diff --git a/packages/mix/lib/src/theme/tokens/mix_token.dart b/packages/mix/lib/src/theme/tokens/mix_token.dart index 5051684cb..3a1388523 100644 --- a/packages/mix/lib/src/theme/tokens/mix_token.dart +++ b/packages/mix/lib/src/theme/tokens/mix_token.dart @@ -22,7 +22,6 @@ abstract class MixToken { T call(); T resolve(BuildContext context); - @override operator ==(Object other) { if (identical(this, other)) return true; From f2d6ab60598cab70ed0991fdeba982407f6756e2 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 15:36:25 -0400 Subject: [PATCH 10/12] wip --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9a1e56372..5c6ad177b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,4 +9,4 @@ dev_dependencies: melos: ^6.1.0 lint_staged: - '**.dart': dart fix --apply && dart format --fix && dcm fix + '**.dart': dart fix --apply && dart format --fix && dcm fix && dart analyze --fatal-infos --fatal-warnings && dcm analyze --fatal-warnings --fatal-infos From 98abd6cec76daa85aaee2abac59c48b8d9717b98 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 18:22:36 -0400 Subject: [PATCH 11/12] Removed fix --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 5c6ad177b..eecce5dd6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,4 +9,4 @@ dev_dependencies: melos: ^6.1.0 lint_staged: - '**.dart': dart fix --apply && dart format --fix && dcm fix && dart analyze --fatal-infos --fatal-warnings && dcm analyze --fatal-warnings --fatal-infos + '**.dart': dart analyze --fatal-infos --fatal-warnings && dcm analyze --fatal-warnings --fatal-infos From 73cf20768015417b6b8bb9e0526bc63ba36a21f7 Mon Sep 17 00:00:00 2001 From: Leo Farias Date: Sat, 6 Jul 2024 18:38:02 -0400 Subject: [PATCH 12/12] Added fix --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index eecce5dd6..6865bfc2f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,4 +9,4 @@ dev_dependencies: melos: ^6.1.0 lint_staged: - '**.dart': dart analyze --fatal-infos --fatal-warnings && dcm analyze --fatal-warnings --fatal-infos + '**.dart': dart fix --apply && dcm fix