From d8b5183b1d6133a856aebe7b0cfda70e54b7e296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Lipi=C5=84ski?= Date: Mon, 27 Feb 2017 12:15:08 +0100 Subject: [PATCH] Consistent parens usage for arrow functions with body. --- .eslintrc.js | 4 ++++ .internal/baseMatchesProperty.js | 2 +- .internal/createCaseFirst.js | 2 +- .internal/getSymbols.js | 2 +- .internal/getSymbolsIn.js | 2 +- .internal/getTag.js | 2 +- .internal/matchesStrictComparable.js | 2 +- .internal/memoizeCapped.js | 2 +- .internal/setToArray.js | 2 +- .internal/stringToPath.js | 2 +- cond.js | 2 +- toString.js | 2 +- unzip.js | 2 +- 13 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 749a4a465..abedf9c43 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,6 +38,10 @@ module.exports = { 'requireReturnForObjectLiteral': false }], + 'arrow-parens': ['error', 'as-needed', { + 'requireForBlockBody': true + }], + 'arrow-spacing': ['error', { 'before': true, 'after': true diff --git a/.internal/baseMatchesProperty.js b/.internal/baseMatchesProperty.js index c832f8500..a7810c2ea 100644 --- a/.internal/baseMatchesProperty.js +++ b/.internal/baseMatchesProperty.js @@ -22,7 +22,7 @@ function baseMatchesProperty(path, srcValue) { if (isKey(path) && isStrictComparable(srcValue)) { return matchesStrictComparable(toKey(path), srcValue) } - return object => { + return (object) => { const objValue = get(object, path) return (objValue === undefined && objValue === srcValue) ? hasIn(object, path) diff --git a/.internal/createCaseFirst.js b/.internal/createCaseFirst.js index 3f72a51af..d306c97f1 100644 --- a/.internal/createCaseFirst.js +++ b/.internal/createCaseFirst.js @@ -11,7 +11,7 @@ import toString from '../toString.js' * @returns {Function} Returns the new case function. */ function createCaseFirst(methodName) { - return string => { + return (string) => { string = toString(string) const strSymbols = hasUnicode(string) diff --git a/.internal/getSymbols.js b/.internal/getSymbols.js index 9de7e7f6a..4b51a3da8 100644 --- a/.internal/getSymbols.js +++ b/.internal/getSymbols.js @@ -13,7 +13,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -const getSymbols = !nativeGetSymbols ? () => [] : object => { +const getSymbols = !nativeGetSymbols ? () => [] : (object) => { if (object == null) { return [] } diff --git a/.internal/getSymbolsIn.js b/.internal/getSymbolsIn.js index 8ce8c8723..0c4638d2f 100644 --- a/.internal/getSymbolsIn.js +++ b/.internal/getSymbolsIn.js @@ -10,7 +10,7 @@ const nativeGetSymbols = Object.getOwnPropertySymbols * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ -const getSymbolsIn = !nativeGetSymbols ? () => [] : object => { +const getSymbolsIn = !nativeGetSymbols ? () => [] : (object) => { const result = [] while (object) { result.push(...getSymbols(object)) diff --git a/.internal/getTag.js b/.internal/getTag.js index 98a444f60..8f9b8c4ed 100644 --- a/.internal/getTag.js +++ b/.internal/getTag.js @@ -31,7 +31,7 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (getTag(Promise.resolve()) != promiseTag) || (getTag(new Set) != setTag) || (getTag(new WeakMap) != weakMapTag)) { - getTag = value => { + getTag = (value) => { const result = baseGetTag(value) const Ctor = result == objectTag ? value.constructor : undefined const ctorString = Ctor ? toSource(Ctor) : '' diff --git a/.internal/matchesStrictComparable.js b/.internal/matchesStrictComparable.js index 15dc34095..fcc919367 100644 --- a/.internal/matchesStrictComparable.js +++ b/.internal/matchesStrictComparable.js @@ -8,7 +8,7 @@ * @returns {Function} Returns the new spec function. */ function matchesStrictComparable(key, srcValue) { - return object => { + return (object) => { if (object == null) { return false } diff --git a/.internal/memoizeCapped.js b/.internal/memoizeCapped.js index 8752cfb55..d4ea59f9c 100644 --- a/.internal/memoizeCapped.js +++ b/.internal/memoizeCapped.js @@ -12,7 +12,7 @@ const MAX_MEMOIZE_SIZE = 500 * @returns {Function} Returns the new memoized function. */ function memoizeCapped(func) { - const result = memoize(func, key => { + const result = memoize(func, (key) => { const { cache } = result if (cache.size === MAX_MEMOIZE_SIZE) { cache.clear() diff --git a/.internal/setToArray.js b/.internal/setToArray.js index 94f10bfb9..0f8dc4cb1 100644 --- a/.internal/setToArray.js +++ b/.internal/setToArray.js @@ -9,7 +9,7 @@ function setToArray(set) { let index = -1 const result = Array(set.size) - set.forEach(value => { + set.forEach((value) => { result[++index] = value }) return result diff --git a/.internal/stringToPath.js b/.internal/stringToPath.js index 24fbd43a7..b34b5ecb7 100644 --- a/.internal/stringToPath.js +++ b/.internal/stringToPath.js @@ -23,7 +23,7 @@ const rePropName = RegExp( * @param {string} string The string to convert. * @returns {Array} Returns the property path array. */ -const stringToPath = memoizeCapped(string => { +const stringToPath = memoizeCapped((string) => { const result = [] if (reLeadingDot.test(string)) { result.push('') diff --git a/cond.js b/cond.js index 3f5743746..8a12b7b84 100644 --- a/cond.js +++ b/cond.js @@ -30,7 +30,7 @@ import arrayMap from './.internal/arrayMap.js' function cond(pairs) { const length = pairs == null ? 0 : pairs.length - pairs = !length ? [] : arrayMap(pairs, pair => { + pairs = !length ? [] : arrayMap(pairs, (pair) => { if (typeof pair[1] != 'function') { throw new TypeError('Expected a function') } diff --git a/toString.js b/toString.js index 307e8da48..dea8183a3 100644 --- a/toString.js +++ b/toString.js @@ -37,7 +37,7 @@ function toString(value) { } if (Array.isArray(value)) { // Recursively convert values (susceptible to call stack limits). - return `${ arrayMap(value, (other) => other == null ? other : toString(other)) }` + return `${ arrayMap(value, other => other == null ? other : toString(other)) }` } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : '' diff --git a/unzip.js b/unzip.js index f730fa03c..3ce2e68bb 100644 --- a/unzip.js +++ b/unzip.js @@ -30,7 +30,7 @@ function unzip(array) { return [] } let length = 0 - array = arrayFilter(array, group => { + array = arrayFilter(array, (group) => { if (isArrayLikeObject(group)) { length = nativeMax(group.length, length) return true