Skip to content

Commit

Permalink
chore(deps): update dependency @netlify/eslint-config-node to ^4.1.0 (#…
Browse files Browse the repository at this point in the history
…4009)

* chore(deps): update dependency @netlify/eslint-config-node to ^4.1.0

* fix: fix linting errors

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: ehmicky <ehmicky@gmail.com>
  • Loading branch information
3 people authored Jan 10, 2022
1 parent a16a5e5 commit a2158ad
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 94 deletions.
89 changes: 23 additions & 66 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
"@babel/preset-react": "^7.12.13",
"@commitlint/cli": "^16.0.0",
"@commitlint/config-conventional": "^16.0.0",
"@netlify/eslint-config-node": "^4.0.8",
"@netlify/eslint-config-node": "^4.1.0",
"ava": "^3.15.0",
"c8": "^7.11.0",
"eslint-plugin-sort-destructure-keys": "^1.3.5",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/functions/functions-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const pickTemplate = async function ({ language: languageFromFlag }) {

try {
templatesForLanguage = formatRegistryArrayForInquirer(language)
} catch (_) {
} catch {
throw error(`Invalid language: ${language}`)
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/unlink/unlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const unlink = async (options, command) => {
try {
// @ts-ignore types from API are wrong they cannot recognize `getSite` of API
siteData = await command.netlify.api.getSite({ siteId })
} catch (error) {
} catch {
// ignore errors if we can't get the site
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const handler = async (event) => {
let request
try {
request = JSON.parse(event.body)
} catch (error) {
} catch {
return { statusCode: 400, body: 'c annot parse hasura event' }
}

Expand Down
2 changes: 1 addition & 1 deletion src/functions-templates/javascript/set-cookie/{{name}}.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const cookie = require('cookie')

// 14 days
const COOKIE_MAX_AGE = 12096e5
const COOKIE_MAX_AGE = 12_096e5

const handler = async () => {
const myCookie = cookie.serialize('my_cookie', 'lolHi', {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/functions/runtimes/go/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const invokeFunction = async ({ context, event, func, timeout }) => {
headers,
statusCode,
}
} catch (error) {
} catch {
return {
statusCode: 500,
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/functions/runtimes/js/builders/zisi.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const getTargetDirectory = async ({ errorExit }) => {

try {
await mkdir(targetDirectory, { recursive: true })
} catch (error) {
} catch {
errorExit(`${NETLIFYDEVERR} Could not create directory: ${targetDirectory}`)
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/functions/runtimes/rust/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const invokeFunction = async ({ context, event, func, timeout }) => {
headers,
statusCode,
}
} catch (error) {
} catch {
return {
statusCode: 500,
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/deploy/hash-fns.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const getFunctionZips = async ({
})

return functions
} catch (error) {
} catch {
statusCb({
type: 'functions-manifest',
msg: 'Ignored invalid or expired functions cache',
Expand Down
4 changes: 1 addition & 3 deletions src/utils/deploy/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ const waitForDeploy = async (api, deployId, siteId, timeout) => {
// Transform the fileShaMap and fnShaMap into a generic shaMap that file-uploader.js can use
const getUploadList = (required, shaMap) => {
if (!required || !shaMap) return []
// TODO: use `Array.flatMap()` instead once we remove support for Node <11.0.0
// eslint-disable-next-line unicorn/prefer-spread
return [].concat(...required.map((sha) => shaMap[sha]))
return required.flatMap((sha) => shaMap[sha])
}

module.exports = {
Expand Down
4 changes: 1 addition & 3 deletions src/utils/detect-server-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,7 @@ const formatSettingsArrForInquirer = function (frameworks) {
short: `${framework.name}-${command}`,
})),
)
// Replace by .flatMap() when Node.js support >= 11.0.0
// eslint-disable-next-line unicorn/prefer-spread
return [].concat(...formattedArr)
return formattedArr.flat()
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/functions/edge-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const validateEdgeHandlerFolder = async ({ site }) => {
error(`Edge Handlers folder ${EDGE_HANDLERS_FOLDER} must be a path to a directory`)
}
return resolvedFolder
} catch (error_) {
} catch {
// ignore errors at the moment
// TODO: report error if 'edge_handlers' config exists after
// https://github.com/netlify/build/pull/1829 is published
Expand Down
2 changes: 1 addition & 1 deletion src/utils/gitignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ensureNetlifyIgnore = async function (dir) {
try {
gitIgnoreContents = await readFile(gitIgnorePath, 'utf8')
ignorePatterns = parseIgnore.parse(gitIgnoreContents)
} catch (error) {
} catch {
// ignore
}
/* Not ignoring .netlify folder. Add to .gitignore */
Expand Down
8 changes: 4 additions & 4 deletions src/utils/lm/requirements.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const checkLFSFilters = async function () {
try {
const { stdout } = await execa('git', ['config', '--get-regexp', 'filter.lfs'])
return stdout.length !== 0
} catch (error) {
} catch {
return false
}
}
Expand All @@ -16,7 +16,7 @@ const getHelperVersion = async function () {
try {
const { stdout } = await execa('git-credential-netlify', ['version'])
return stdout
} catch (error) {
} catch {
throw new Error(`Check that Netlify's Git Credential helper is installed and updated to the latest version`)
}
}
Expand All @@ -36,7 +36,7 @@ const checkGitVersion = async function () {
try {
const { stdout } = await execa('git', ['--version'])
return stdout.split(' ').pop()
} catch (error) {
} catch {
throw new Error('Check that Git is installed in your system')
}
}
Expand All @@ -45,7 +45,7 @@ const getLFSVersion = async function () {
try {
const { stdout } = await execa('git-lfs', ['version'])
return stdout
} catch (error) {
} catch {
throw new Error('Check that Git LFS is installed in your system')
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/parse-raw-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const aggressiveJSONParse = function (value) {
let parsed
try {
parsed = JSON.parse(value)
} catch (error) {
} catch {
try {
parsed = JSON.parse(`"${value}"`)
} catch (error_) {
} catch {
parsed = value
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/state-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StateConfig {

get all() {
try {
return JSON.parse(fs.readFileSync(this.path, 'utf8'))
return JSON.parse(fs.readFileSync(this.path))
} catch (error) {
// Don't create if it doesn't exist
if (error.code === 'ENOENT' || error.code === 'ENOTDIR') {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/telemetry/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const makeRequest = async function () {
body: JSON.stringify(options.data),
})
process.exit()
} catch (error) {
} catch {
process.exit(1)
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/command.dev.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const testMatrix = [

const testName = (title, args) => (args.length <= 0 ? title : `${title} - ${args.join(' ')}`)

const JWT_EXPIRY = 1893456000
const JWT_EXPIRY = 1_893_456_000
const getToken = ({ jwtRolePath = 'app_metadata.authorization.roles', jwtSecret = 'secret', roles }) => {
const payload = {
exp: JWT_EXPIRY,
Expand Down
2 changes: 1 addition & 1 deletion tests/command.functions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ test('throws an error when the --language flag contains an unsupported value', a
})

const DEFAULT_PORT = 9999
const SERVE_TIMEOUT = 180000
const SERVE_TIMEOUT = 180_000

const withFunctionsServer = async ({ builder, args = [], port = DEFAULT_PORT }, testHandler) => {
let ps
Expand Down
2 changes: 1 addition & 1 deletion tests/serving-functions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const testMatrix = [{ args: [] }, { args: ['esbuild'] }]
const testName = (title, args) => (args.length <= 0 ? title : `${title} - ${args.join(' ')}`)

const WAIT_INTERVAL = 1800
const WAIT_TIMEOUT = 30000
const WAIT_TIMEOUT = 30_000
const WAIT_WRITE = 3000

const gotCatch404 = async (url, options) => {
Expand Down

1 comment on commit a2158ad

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

Package size: 356 MB

Please sign in to comment.