Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielCardonaRojas committed Oct 11, 2023
1 parent f7059bc commit d951769
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ linter:
parameter_assignments: true
prefer_function_declarations_over_variables: false
ambiguous_extension_member_access: false
require_trailing_commas: false
analyzer:
exclude:
- example/**
Expand Down
10 changes: 6 additions & 4 deletions lib/src/verify.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'package:dartz/dartz.dart';
import 'package:verify/verify.dart';

import 'base_types.dart';
export 'package:dartz/dartz.dart' show Either;

part 'verify_utils.dart';
part 'verify_factories.dart';
part 'verify_utils.dart';

/// Extension for methods related to subfield validations.
extension VerifyProperties<S> on Validator<S> {
Expand All @@ -27,7 +26,9 @@ extension VerifyProperties<S> on Validator<S> {
/// the focused field is null. This is common when validating forms in which null represents
/// a field which has not being visited.
Validator<S> checkField<F>(
Selector<S, F?> selector, Validator<F> verification) {
Selector<S, F?> selector,
Validator<F> verification,
) {
final bypassingValidation = _makeOptional(verification);
final Validator<S> fieldValidator = (S s) {
final focus = selector(s);
Expand Down Expand Up @@ -57,7 +58,8 @@ extension ValidatorUtils<S, T> on ValidatorT<S, T> {
/// When supplied a type parameter the error list will be filtered
/// to all errors that have the given type.
Either<List<ErrorType>, T> verify<ErrorType extends ValidationError>(
S subject) {
S subject,
) {
return this(subject).leftMap((errors) {
final Iterable<ErrorType> filtered = errors.whereType();
return filtered.toList();
Expand Down
6 changes: 4 additions & 2 deletions lib/src/verify_factories.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ extension Verify on ValidatorT {
}

/// Creates a validator on S by applying a validator on a subfield of S.
static Validator<S> at<S, T>(Selector<S, T> selector,
{required Validator<T> validator}) {
static Validator<S> at<S, T>(
Selector<S, T> selector, {
required Validator<T> validator,
}) {
return (S subject) {
final field = selector(subject);
return validator(field).fold((l) => Left(l), (_) => Right(subject));
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.1.0 <4.0.0"
dart: ">=3.0.0 <4.0.0"
6 changes: 3 additions & 3 deletions test/verify_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:collection/collection.dart';
import 'package:dartz/dartz.dart';
import 'package:verify/verify.dart';
import 'package:test/test.dart';
import 'package:collection/collection.dart';
import 'package:verify/verify.dart';

import 'data/enumerated_error.dart';
import 'data/error.dart';
Expand Down Expand Up @@ -77,7 +77,7 @@ void main() {
test('join only accumulates on error at a time', () {
final numberValidator = Verify.subject<int>()
.then(Verify.that(
(subject) => subject % 2 == 0,
(subject) => subject.isEven,
error: Error('not even'),
))
.then(Verify.that(
Expand Down

0 comments on commit d951769

Please sign in to comment.