Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove usages of lodash.get #1998

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = {
'promise/no-return-wrap': 0,
'promise/prefer-await-to-callbacks': 0,
'promise/prefer-await-to-then': 0,
'you-dont-need-lodash-underscore/get': 0,
'unicorn/prefer-spread': 0,
'unicorn/consistent-destructuring': 0,
'unicorn/no-array-push-push': 0,
Expand Down
5 changes: 2 additions & 3 deletions src/commands/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const process = require('process')
const { flags: flagsLib } = require('@oclif/command')
const chalk = require('chalk')
const cliSpinnerNames = Object.keys(require('cli-spinners'))
const dotProp = require('dot-prop')
const { get } = require('dot-prop')
const inquirer = require('inquirer')
const get = require('lodash/get')
const isObject = require('lodash/isObject')
const logSymbols = require('log-symbols')
const ora = require('ora')
Expand Down Expand Up @@ -193,7 +192,7 @@ const hasErrorMessage = (actual, expected) => {
return false
}

const getJsonErrorMessage = (error) => dotProp.get(error, 'json.message', '')
const getJsonErrorMessage = (error) => get(error, 'json.message', '')

const reportDeployError = ({ error, warn, failAndExit }) => {
switch (true) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/status/hooks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const get = require('lodash/get')
const { get } = require('dot-prop')
const prettyjson = require('prettyjson')

const Command = require('../../utils/command')
Expand Down
11 changes: 3 additions & 8 deletions src/commands/status/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { flags: flagsLib } = require('@oclif/command')
const chalk = require('chalk')
const clean = require('clean-deep')
const get = require('lodash/get')
const prettyjson = require('prettyjson')

const Command = require('../../utils/command')
Expand Down Expand Up @@ -31,8 +30,7 @@ class StatusCommand extends Command {
let user

try {
accounts = await api.listAccountsForUser()
user = await this.netlify.api.getCurrentUser()
;[accounts, user] = await Promise.all([api.listAccountsForUser(), api.getCurrentUser()])
} catch (error) {
if (error.status === 401) {
this.error(
Expand All @@ -43,11 +41,8 @@ class StatusCommand extends Command {

const ghuser = this.netlify.globalConfig.get(`users.${current}.auth.github.user`)
const accountData = {
Name: get(user, 'full_name'),
// 'Account slug': get(personal, 'slug'),
// 'Account id': get(personal, 'id'),
// Name: get(personal, 'billing_name'),
Email: get(user, 'email'),
Name: user.full_name,
Email: user.email,
Github: ghuser,
}
const teamsData = {}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const { URL, URLSearchParams } = require('url')

const contentType = require('content-type')
const cookie = require('cookie')
const { get } = require('dot-prop')
const httpProxy = require('http-proxy')
const { createProxyMiddleware } = require('http-proxy-middleware')
const jwtDecode = require('jwt-decode')
const locatePath = require('locate-path')
const get = require('lodash/get')
const isEmpty = require('lodash/isEmpty')
const pFilter = require('p-filter')
const toReadableStream = require('to-readable-stream')
Expand Down