10000 fix: enable and fix unicorn/prefer-spread (#2943) · netlify/cli@77c6ebb · GitHub
[go: up one dir, main page]

Skip to content

Commit 77c6ebb

Browse files
fix: enable and fix unicorn/prefer-spread (#2943)
Co-authored-by: Erez Rokah <erezrokah@users.noreply.github.com>
1 parent 4bbda4c commit 77c6ebb

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module.exports = {
2525
'fp/no-this': 0,
2626
'import/max-dependencies': 0,
2727
'node/no-sync': 0,
28-
'unicorn/prefer-spread': 0,
2928
'unicorn/consistent-destructuring': 0,
3029
// TODO: harmonize with filename snake_case in other Netlify Dev projects
3130
'unicorn/filename-case': [2, { case: 'kebabCase' }],

src/commands/dev/trace.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TraceCommand extends Command {
1212
async run() {
1313
this.parse(TraceCommand)
1414

15-
const args = ['trace'].concat(this.argv)
15+
const args = ['trace', ...this.argv]
1616
const { subprocess } = runProcess({ log: this.log, args })
1717
await subprocess
1818
}

src/utils/addons/compare.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ module.exports = function compare(oldValues, newValues) {
1212

1313
const oldKeys = Object.keys(oldValues)
1414
const newKeys = Object.keys(newValues)
15-
const set = new Set(newKeys.concat(oldKeys))
15+
const set = new Set([...newKeys, ...oldKeys])
1616

1717
return [...set].reduce((acc, current) => {
1818
// if values not deep equal. There are changes
1919
if (!isEqual(newValues[current], oldValues[current])) {
2020
return {
2121
isEqual: false,
22-
keys: acc.keys.concat(current),
22+
keys: [...acc.keys, current],
2323
diffs: {
2424
...acc.diffs,
2525
[`${current}`]: {

src/utils/deploy/util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ const waitForDeploy = async (api, deployId, siteId, timeout) => {
9696
const getUploadList = (required, shaMap) => {
9797
if (!required || !shaMap) return []
9898
// TODO: use `Array.flatMap()` instead once we remove support for Node <11.0.0
99+
// eslint-disable-next-line unicorn/prefer-spread
99100
return [].concat(...required.map((sha 10000 ) => shaMap[sha]))
100101
}
101102

src/utils/detect-server-settings.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,16 @@ const filterSettings = function (scriptInquirerOptions, input) {
310310
}
311311

312312
const formatSettingsArrForInquirer = function (frameworks) {
313-
return [].concat(
314-
...frameworks.map((framework) =>
315-
framework.dev.commands.map((command) => ({
316-
name: `[${chalk.yellow(framework.name)}] '${command}'`,
317-
value: { ...framework, commands: [command] },
318-
short: `${framework.name}-${command}`,
319-
})),
320-
),
313+
const formattedArr = frameworks.map((framework) =>
314+
framework.dev.commands.map((command) => ({
315+
name: `[${chalk.yellow(framework.name)}] '${command}'`,
316+
value: { ...framework, commands: [command] },
317+
short: `${framework.name}-${command}`,
318+
})),
321319
)
320+
// Replace by .flatMap() when Node.js support >= 11.0.0
321+
// eslint-disable-next-line unicorn/prefer-spread
322+
return [].concat(...formattedArr)
322323
}
323324

324325
module.exports = {

src/utils/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const serveRedirect = async function ({ req, res, proxy, match, options }) {
201201
// We pass through request params in one of the following cases:
202202
// 1. The redirect rule doesn't have any query params
203203
// 2. This is a function redirect https://github.com/netlify/cli/issues/1605
204-
if (Array.from(dest.searchParams).length === 0 || isFunction(options.functionsPort, stripOrigin(dest))) {
204+
if ([...dest.searchParams].length === 0 || isFunction(options.functionsPort, stripOrigin(dest))) {
205205
dest.searchParams.forEach((_, key) => {
206206
dest.searchParams.delete(key)
207207
})

0 commit comments

Comments
 (0)
0