diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..2aac200fd --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,33 @@ +#!/usr/bin/env sh + +. "$(dirname -- "$0")/_/husky.sh" + +# 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 + +# 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/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)); diff --git a/packages/mix/lib/src/attributes/border/border_dto.dart b/packages/mix/lib/src/attributes/border/border_dto.dart index a891d7bbd..72588649e 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/theme/tokens/mix_token.dart b/packages/mix/lib/src/theme/tokens/mix_token.dart index d01612b51..7cc836bbf 100644 --- a/packages/mix/lib/src/theme/tokens/mix_token.dart +++ b/packages/mix/lib/src/theme/tokens/mix_token.dart @@ -21,7 +21,6 @@ abstract class MixToken { T call(); T resolve(BuildContext context); - @override operator ==(Object other) { if (identical(this, other)) return true; diff --git a/pubspec.yaml b/pubspec.yaml index ac25b8a2c..6865bfc2f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,12 @@ name: mix environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.0.6 <4.0.0" dev_dependencies: - melos: ^6.0.0 + husky: ^0.1.7 + lint_staged: ^0.5.1 + melos: ^6.1.0 + +lint_staged: + '**.dart': dart fix --apply && dcm fix