Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
Fix some linter tips, ignore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
comigor committed Dec 25, 2019
1 parent 515751b commit 4cacd21
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ analyzer:
implicit-casts: false
exclude:
- example/**/*.dart
- test/**/*.dart
linter:
rules:
- public_member_api_docs
Expand Down
2 changes: 1 addition & 1 deletion lib/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ArtemisClient {
variables: query.getVariablesMap(),
);

final Response response = await _link.request(request).first;
final response = await _link.request(request).first;

return GraphQLResponse<T>(
data: response.data == null ? null : query.parse(response.data),
Expand Down
11 changes: 5 additions & 6 deletions lib/generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ You may want to do either:
});

final basename = p.basenameWithoutExtension(path);
final List<String> customImports =
_extractCustomImports(schema.types, options);
final customImports = _extractCustomImports(schema.types, options);
return LibraryDefinition(
basename,
queries: queriesDefinitions,
Expand Down Expand Up @@ -69,18 +68,18 @@ QueryDefinition generateQuery(
final queryName = operation.name?.value ?? basename;
final className = ReCase(queryName).pascalCase;

GraphQLType parentType = gql.getTypeByName(schema, schema.queryType.name);
var parentType = gql.getTypeByName(schema, schema.queryType.name);
if (operation.type == OperationType.mutation) {
parentType = gql.getTypeByName(schema, schema.mutationType.name);
}

final prefix = schemaMap.addQueryPrefix ? className : '';

final List<QueryInput> inputs = [];
final List<Definition> inputsClasses = [];
final inputs = <QueryInput>[];
final inputsClasses = <Definition>[];
if (operation.variableDefinitions != null) {
operation.variableDefinitions.forEach((v) {
NamedTypeNode unwrappedType = _unwrapType(v.type);
final unwrappedType = _unwrapType(v.type);

final type = gql.getTypeByName(schema, unwrappedType.name.value);

Expand Down
4 changes: 2 additions & 2 deletions lib/generator/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import 'package:recase/recase.dart';
import '../schema/graphql.dart';

/// Callback fired when the generator processes a [LibraryDefinition].
typedef void OnBuildQuery(LibraryDefinition definition);
typedef OnBuildQuery = void Function(LibraryDefinition definition);

/// Callback fired when a new class is found during schema parsing.
typedef void OnNewClassFoundCallback(
typedef OnNewClassFoundCallback = void Function(
SelectionSetNode selectionSet,
String className,
GraphQLType parentType,
Expand Down
8 changes: 4 additions & 4 deletions lib/generator/helpers.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
typedef U _IterableFunction<T, U>(T i);
typedef T _MergeableFunction<T>(T oldT, T newT);
typedef _IterableFunction<T, U> = U Function(T i);
typedef _MergeableFunction<T> = T Function(T oldT, T newT);

/// Remove duplicated values from an iterable given a predicate without
/// modifying the original iterable.
Iterable<T> removeDuplicatedBy<T, U>(
Iterable<T> list, _IterableFunction<T, U> fn) {
final values = Map<U, bool>();
final values = <U, bool>{};
return list.where((i) {
final value = fn(i);
return values.update(value, (_) => false, ifAbsent: () => true);
Expand All @@ -16,7 +16,7 @@ Iterable<T> removeDuplicatedBy<T, U>(
/// the original iterable.
Iterable<T> mergeDuplicatesBy<T, U>(Iterable<T> list,
_IterableFunction<T, U> fn, _MergeableFunction<T> mergeFn) {
final values = Map<U, T>();
final values = <U, T>{};
list.forEach((i) {
final value = fn(i);
values.update(value, (oldI) => mergeFn(oldI, i), ifAbsent: () => i);
Expand Down
2 changes: 1 addition & 1 deletion lib/generator/print_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Spec generateArgumentClassSpec(QueryDefinition definition) {

/// Generates a [Spec] of a query/mutation class.
Spec generateQueryClassSpec(QueryDefinition definition) {
final String typeDeclaration = definition.inputs.isEmpty
final typeDeclaration = definition.inputs.isEmpty
? '${definition.className}, JsonSerializable'
: '${definition.className}, ${definition.className}Arguments';

Expand Down

0 comments on commit 4cacd21

Please sign in to comment.