From d9517699c541fb2e1b42443407daef38b46004ac Mon Sep 17 00:00:00 2001 From: Daniel Cardona Rojas Date: Wed, 11 Oct 2023 11:28:46 -0500 Subject: [PATCH] Fix linter issues --- analysis_options.yaml | 1 + lib/src/verify.dart | 10 ++++++---- lib/src/verify_factories.dart | 6 ++++-- pubspec.lock | 2 +- test/verify_test.dart | 6 +++--- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 777b629..9fcf784 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -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/** diff --git a/lib/src/verify.dart b/lib/src/verify.dart index 5ef9be6..b2746ca 100644 --- a/lib/src/verify.dart +++ b/lib/src/verify.dart @@ -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 on Validator { @@ -27,7 +26,9 @@ extension VerifyProperties on Validator { /// the focused field is null. This is common when validating forms in which null represents /// a field which has not being visited. Validator checkField( - Selector selector, Validator verification) { + Selector selector, + Validator verification, + ) { final bypassingValidation = _makeOptional(verification); final Validator fieldValidator = (S s) { final focus = selector(s); @@ -57,7 +58,8 @@ extension ValidatorUtils on ValidatorT { /// When supplied a type parameter the error list will be filtered /// to all errors that have the given type. Either, T> verify( - S subject) { + S subject, + ) { return this(subject).leftMap((errors) { final Iterable filtered = errors.whereType(); return filtered.toList(); diff --git a/lib/src/verify_factories.dart b/lib/src/verify_factories.dart index 6d30d58..3446359 100644 --- a/lib/src/verify_factories.dart +++ b/lib/src/verify_factories.dart @@ -38,8 +38,10 @@ extension Verify on ValidatorT { } /// Creates a validator on S by applying a validator on a subfield of S. - static Validator at(Selector selector, - {required Validator validator}) { + static Validator at( + Selector selector, { + required Validator validator, + }) { return (S subject) { final field = selector(subject); return validator(field).fold((l) => Left(l), (_) => Right(subject)); diff --git a/pubspec.lock b/pubspec.lock index 8b327f3..e17ec30 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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" diff --git a/test/verify_test.dart b/test/verify_test.dart index a44ab70..6fcf1ff 100644 --- a/test/verify_test.dart +++ b/test/verify_test.dart @@ -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'; @@ -77,7 +77,7 @@ void main() { test('join only accumulates on error at a time', () { final numberValidator = Verify.subject() .then(Verify.that( - (subject) => subject % 2 == 0, + (subject) => subject.isEven, error: Error('not even'), )) .then(Verify.that(