Skip to content

Commit

Permalink
Enable "no-sequences" ESLint rule (#1883)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed May 21, 2019
1 parent 176aa7f commit 58832ae
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Expand Up @@ -149,7 +149,7 @@ rules:
no-script-url: error
no-self-assign: error
no-self-compare: off # TODO
no-sequences: off # TODO
no-sequences: error
no-throw-literal: error
no-unmodified-loop-condition: error
no-unused-expressions: error
Expand Down
8 changes: 4 additions & 4 deletions src/jsutils/keyMap.js
Expand Up @@ -36,8 +36,8 @@ export default function keyMap<T>(
list: $ReadOnlyArray<T>,
keyFn: (item: T) => string,
): ObjMap<T> {
return list.reduce(
(map, item) => ((map[keyFn(item)] = item), map),
Object.create(null),
);
return list.reduce((map, item) => {
map[keyFn(item)] = item;
return map;
}, Object.create(null));
}
8 changes: 4 additions & 4 deletions src/jsutils/keyValMap.js
Expand Up @@ -31,8 +31,8 @@ export default function keyValMap<T, V>(
keyFn: (item: T) => string,
valFn: (item: T) => V,
): ObjMap<V> {
return list.reduce(
(map, item) => ((map[keyFn(item)] = valFn(item)), map),
Object.create(null),
);
return list.reduce((map, item) => {
map[keyFn(item)] = valFn(item);
return map;
}, Object.create(null));
}
8 changes: 4 additions & 4 deletions src/type/schema.js
Expand Up @@ -257,10 +257,10 @@ export class GraphQLSchema {

if (!possibleTypeMap[abstractType.name]) {
const possibleTypes = this.getPossibleTypes(abstractType);
possibleTypeMap[abstractType.name] = possibleTypes.reduce(
(map, type) => ((map[type.name] = true), map),
Object.create(null),
);
possibleTypeMap[abstractType.name] = possibleTypes.reduce((map, type) => {
map[type.name] = true;
return map;
}, Object.create(null));
}

return Boolean(possibleTypeMap[abstractType.name][possibleType.name]);
Expand Down

0 comments on commit 58832ae

Please sign in to comment.