Consistent parens usage for arrow functions with body.

This commit is contained in:
Michał Lipiński
2017-02-27 12:15:08 +01:00
parent 4c4b29cdef
commit d8b5183b1d
13 changed files with 16 additions and 12 deletions

View File

@@ -38,6 +38,10 @@ module.exports = {
'requireReturnForObjectLiteral': false
}],
'arrow-parens': ['error', 'as-needed', {
'requireForBlockBody': true
}],
'arrow-spacing': ['error', {
'before': true,
'after': true

View File

@@ -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)

View File

@@ -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)

View File

@@ -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 []
}

View File

@@ -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))

View File

@@ -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) : ''

View File

@@ -8,7 +8,7 @@
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return object => {
return (object) => {
if (object == null) {
return false
}

View File

@@ -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()

View File

@@ -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

View File

@@ -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('')

View File

@@ -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')
}

View File

@@ -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) : ''

View File

@@ -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