Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: husky integration #367

Merged
merged 13 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -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


Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ final class AnimatedUtility<T extends Attribute>
DurationUtility<T> get duration => DurationUtility((v) => only(duration: v));

CurveUtility<T> get curve => CurveUtility((v) => only(curve: v));

@override
T only({Duration? duration, Curve? curve}) {
return builder(AnimatedDataDto(duration: duration, curve: curve));
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/attributes/border/border_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ sealed class BoxBorderDto<T extends BoxBorder> extends Dto<T> {
bool get isUniform;

bool get isDirectional => this is BorderDirectionalDto;

@override
BoxBorderDto<T> merge(covariant BoxBorderDto<T>? other);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ sealed class BorderRadiusGeometryDto<T extends BorderRadiusGeometry>
Radius? get topEnd;
Radius? get bottomStart;
Radius? get bottomEnd;

@override
BorderRadiusGeometryDto<T> merge(covariant BorderRadiusGeometryDto<T>? other);

Expand Down
2 changes: 0 additions & 2 deletions packages/mix/lib/src/attributes/border/shape_border_dto.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ sealed class ShapeBorderDto<T extends ShapeBorder> extends Dto<T> {
StadiumBorderDto toStadiumBorder();
StarBorderDto toStar();
LinearBorderDto toLinear();

@override
ShapeBorderDto<T> merge(covariant ShapeBorderDto<T>? other);

Expand Down Expand Up @@ -201,7 +200,6 @@ final class ContinuousRectangleBorderDto

@override
BorderRadiusGeometryDto? get _borderRadius => borderRadius;

@override
ContinuousRectangleBorder get defaultValue =>
const ContinuousRectangleBorder();
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/attributes/color/color_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ base class FoundationColorUtility<T extends Attribute, C extends Color>
const FoundationColorUtility(super.builder, this.color);

T call() => _buildColor(color);

@override
T directive(ColorDirective directive) =>
builder(ColorDto.raw(value: color, directives: [directive]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ sealed class DecorationDto<T extends Decoration> extends Dto<T> {
bool get isMergeable;

DecorationDto? mergeableDecor(covariant DecorationDto? other);

@override
DecorationDto<T> merge(covariant DecorationDto<T>? other);
}
Expand Down Expand Up @@ -163,7 +162,6 @@ final class ShapeDecorationDto extends DecorationDto<ShapeDecoration>
}) : super(boxShadow: shadows);

List<BoxShadowDto>? get shadows => boxShadow;

@override
ShapeDecorationDto mergeableDecor(BoxDecorationDto? other) {
if (other == null) return this;
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/core/attribute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/core/attributes_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class AttributeMap<T extends Attribute> {
}

Map<Object, T> toMap() => _map?.cast() ?? {};

@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/core/directive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class TextDirectiveDto extends Dto<TextDirective> {

@visibleForTesting
int get length => _modifiers.length;

@override
TextDirective resolve(MixData mix) {
return TextDirective((String content) {
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/core/spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ abstract base class SpecAttribute<Value> extends StyledAttribute {
const SpecAttribute({this.animated});

Value resolve(MixData mix);

@override
SpecAttribute<Value> merge(covariant SpecAttribute<Value>? other);
}
Expand Down
9 changes: 5 additions & 4 deletions packages/mix/lib/src/modifiers/sized_box_widget_modifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@ final class SizedBoxModifierAttribute extends WidgetModifierAttribute<

final class SizedBoxModifierUtility<T extends Attribute>
extends MixUtility<T, SizedBoxModifierAttribute> {
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));
Expand Down
1 change: 0 additions & 1 deletion packages/mix/lib/src/theme/tokens/mix_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ abstract class MixToken<T> {
T call();

T resolve(BuildContext context);

@override
operator ==(Object other) {
if (identical(this, other)) return true;
Expand Down
9 changes: 7 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading