chore: directly import lodash functions

This pass only concerns single imports.
This commit is contained in:
Julien Fontanet 2023-02-23 13:42:03 +01:00
parent 774e443a79
commit cef6248650
52 changed files with 52 additions and 52 deletions

View File

@ -1,7 +1,7 @@
import through2 from 'through2'
import { createHash } from 'crypto'
import { defer, fromEvent } from 'promise-toolbox'
import { invert } from 'lodash'
import invert from 'lodash/invert.js'
// Format: $<algorithm>$<salt>$<encrypted>
//

View File

@ -2,7 +2,7 @@
const assert = require('assert')
const asyncIteratorToStream = require('async-iterator-to-stream')
const { forEachRight } = require('lodash')
const forEachRight = require('lodash/forEachRight.js')
const computeGeometryForSize = require('./_computeGeometryForSize')
const { createFooter, createHeader } = require('./_createFooterHeader')

View File

@ -1,7 +1,7 @@
import kindOf from 'kindof'
import { BaseError } from 'make-error'
import { EventEmitter } from 'events'
import { forOwn } from 'lodash'
import forOwn from 'lodash/forOwn.js'
import isEmpty from './is-empty'
import isObject from './is-object'

View File

@ -1,7 +1,7 @@
/* eslint-env jest */
import fromEvent from 'promise-toolbox/fromEvent'
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
import { Collection, DuplicateItem, NoSuchItem } from './collection'

View File

@ -1,7 +1,7 @@
/* eslint-env jest */
import fromEvent from 'promise-toolbox/fromEvent'
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
import { Collection } from './collection'
import { Index } from './index'

View File

@ -1,7 +1,7 @@
/* eslint-env jest */
import fromEvent from 'promise-toolbox/fromEvent'
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
import { Collection } from './collection'
import { UniqueIndex } from './unique-index'

View File

@ -1,5 +1,5 @@
/* eslint-disable no-console */
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
import { Collection } from './collection'
import { View } from './view'

View File

@ -1,7 +1,7 @@
'use strict'
const { BaseError } = require('make-error')
const { iteratee } = require('lodash')
const iteratee = require('lodash/iteratee.js')
class XoError extends BaseError {
constructor({ code, message, data }) {

View File

@ -1,4 +1,4 @@
import { filter } from 'lodash'
import filter from 'lodash/filter.js'
import Plan from './plan'
import { debug as debugP } from './utils'

View File

@ -1,6 +1,6 @@
/* eslint-env jest */
import { forOwn } from 'lodash'
import forOwn from 'lodash/forOwn.js'
import { noSuchObject } from 'xo-common/api-errors'
import config from '../_config'

View File

@ -7,7 +7,7 @@ import expect from 'must'
import fromEvent from 'promise-toolbox/fromEvent'
import { getConfig, getMainConnection, getSrId, waitObjectState } from './util'
import { map } from 'lodash'
import map from 'lodash/map.js'
// ===================================================================

View File

@ -7,7 +7,7 @@ import expect from 'must'
import fromEvent from 'promise-toolbox/fromEvent'
import { getConfig, getMainConnection, waitObjectState } from './util'
import { find } from 'lodash'
import find from 'lodash/find.js'
// ===================================================================

View File

@ -7,7 +7,7 @@ import expect from 'must'
import fromEvent from 'promise-toolbox/fromEvent'
import { getConfig, getMainConnection, getSchedule, jobTest, scheduleTest } from './util'
import { map } from 'lodash'
import map from 'lodash/map.js'
// ===================================================================

View File

@ -1,7 +1,7 @@
/* eslint-env jest */
import { defer } from 'golike-defer'
import { map } from 'lodash'
import map from 'lodash/map.js'
import { getConnection, rejectionOf, testConnection, xo } from './util.js'

View File

@ -7,7 +7,7 @@ import expect from 'must'
import fromEvent from 'promise-toolbox/fromEvent'
import { getConfig, getMainConnection, getVmXoTestPvId, getOneHost, waitObjectState } from './util'
import { map } from 'lodash'
import map from 'lodash/map.js'
// ===================================================================

View File

@ -7,7 +7,7 @@ import expect from 'must'
import fromEvent from 'promise-toolbox/fromEvent'
import { getConfig, getMainConnection, getNetworkId, waitObjectState, getVmXoTestPvId } from './util'
import { map } from 'lodash'
import map from 'lodash/map.js'
// ===================================================================

View File

@ -1,7 +1,7 @@
import ActionButton from 'action-button'
import PropTypes from 'prop-types'
import React, { cloneElement } from 'react'
import { noop } from 'lodash'
import noop from 'lodash/noop.js'
import ButtonGroup from './button-group'

View File

@ -1,6 +1,6 @@
import _ from 'intl'
import React from 'react'
import { map } from 'lodash'
import map from 'lodash/map.js'
import Icon from './icon'
import Tooltip from './tooltip'

View File

@ -1,5 +1,5 @@
import * as CM from 'complex-matcher'
import { escapeRegExp } from 'lodash'
import escapeRegExp from 'lodash/escapeRegExp.js'
const valueToComplexMatcher = pattern => {
if (typeof pattern === 'string') {

View File

@ -1,7 +1,7 @@
/* eslint-env jest */
import React from 'react'
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
import { shallow } from 'enzyme'
import * as grid from './grid'

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { FormattedMessage, IntlProvider as IntlProvider_ } from 'react-intl'
import { every } from 'lodash'
import every from 'lodash/every.js'
import locales from './locales'
import messages from './messages'

View File

@ -8,7 +8,7 @@ import Icon from 'icon'
import Tooltip from 'tooltip'
import { alert } from 'modal'
import { isAdmin } from 'selectors'
import { isEmpty } from 'lodash'
import isEmpty from 'lodash/isEmpty.js'
import { addSubscriptions, connectStore, resolveResourceSet } from './utils'
import { ejectCd, insertCd, rescanSrs, subscribeResourceSets } from './xo'
import { createGetObjectsOfType, createFinder, createGetObject, createSelector } from './selectors'

View File

@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import React from 'react'
import { isEmpty } from 'lodash'
import isEmpty from 'lodash/isEmpty.js'
// This component returns :
// - A loading icon when the objects are not fetched

View File

@ -4,7 +4,7 @@ import CopyToClipboard from 'react-copy-to-clipboard'
import PropTypes from 'prop-types'
import React from 'react'
import { get } from '@xen-orchestra/defined'
import { find } from 'lodash'
import find from 'lodash/find.js'
import decorate from './apply-decorators'
import Icon from './icon'

View File

@ -2,7 +2,7 @@ import _ from 'intl'
import PropTypes from 'prop-types'
import React from 'react'
import { injectState, provideState } from 'reaclette'
import { omit } from 'lodash'
import omit from 'lodash/omit.js'
import decorate from './apply-decorators'
import { Select } from './form'

View File

@ -2,7 +2,7 @@ import _ from 'intl'
import PropTypes from 'prop-types'
import React from 'react'
import { injectState, provideState } from 'reaclette'
import { omit } from 'lodash'
import omit from 'lodash/omit.js'
import decorate from './apply-decorators'
import Icon from './icon'

View File

@ -3,7 +3,7 @@ import Component from 'base-component'
import Icon from 'icon'
import PropTypes from 'prop-types'
import React from 'react'
import { omit } from 'lodash'
import omit from 'lodash/omit.js'
export default class SelectFiles extends Component {
static propTypes = {

View File

@ -4,7 +4,7 @@ import React from 'react'
import { getLicenses } from 'xo'
import { injectIntl } from 'react-intl'
import { injectState, provideState } from 'reaclette'
import { map } from 'lodash'
import map from 'lodash/map.js'
import { renderXoItemFromId } from './render-xo-item'

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types'
import React from 'react'
import styled from 'styled-components'
import { omit } from 'lodash'
import omit from 'lodash/omit.js'
import ActionButton from './action-button'

View File

@ -1,6 +1,6 @@
import PropTypes from 'prop-types'
import React from 'react'
import { forOwn } from 'lodash'
import forOwn from 'lodash/forOwn.js'
import _ from './intl'
import { fetchHostStats, fetchSrStats, fetchVmStats } from './xo'

View File

@ -1,5 +1,5 @@
import cookies from 'js-cookie'
import { omit } from 'lodash'
import omit from 'lodash/omit.js'
import invoke from '../invoke'

View File

@ -4,7 +4,7 @@ import map from 'lodash/map'
import PropTypes from 'prop-types'
import React from 'react'
import { compileTemplate } from '@xen-orchestra/template'
import { every } from 'lodash'
import every from 'lodash/every.js'
import { injectIntl } from 'react-intl'
import BaseComponent from 'base-component'

View File

@ -14,7 +14,7 @@ import {
createGetObjectsOfType,
createSelector,
} from 'selectors'
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
import { SelectSr } from 'select-objects'
import { Vm } from 'render-xo-item'
import { ejectCd, isSrWritable, setDefaultSr } from 'xo'

View File

@ -5,7 +5,7 @@ import { compileTemplate } from '@xen-orchestra/template'
import { connectStore } from 'utils'
import { Container, Col, Row } from 'grid'
import { createGetObjectsOfType } from 'selectors'
import { forEach } from 'lodash'
import forEach from 'lodash/forEach.js'
const RULES = {
'{date}': () => new Date().toISOString(),

View File

@ -2,7 +2,7 @@ import _ from 'intl'
import React from 'react'
import Component from 'base-component'
import { createGetObjectsOfType, createSelector } from 'selectors'
import { map } from 'lodash'
import map from 'lodash/map.js'
import { subscribeResourceCatalog } from 'xo'
import { isLatestXosanPackInstalled, connectStore, findLatestPack } from 'utils'

View File

@ -1,4 +1,4 @@
import { pickBy } from 'lodash'
import pickBy from 'lodash/pickBy.js'
const DEFAULTS = {
__proto__: null,

View File

@ -7,7 +7,7 @@ import React from 'react'
import Tooltip from 'tooltip'
import { generateId } from 'reaclette-utils'
import { injectState, provideState } from 'reaclette'
import { keyBy } from 'lodash'
import keyBy from 'lodash/keyBy.js'
import { SelectProxy } from 'select-objects'
import { subscribeRemotes } from 'xo'

View File

@ -14,7 +14,7 @@ import { importDisks } from 'xo'
import { injectIntl } from 'react-intl'
import { injectState, provideState } from 'reaclette'
import { InputCol, LabelCol, Row } from 'form-grid'
import { map } from 'lodash'
import map from 'lodash/map.js'
import { readCapacityAndGrainTable } from 'xo-vmdk-to-vhd'
import { SelectSr } from 'select-objects'
import { isSrWritableOrIso } from '../../common/xo'

View File

@ -8,7 +8,7 @@ import { Row, Col } from 'grid'
import { deleteMessage, deleteMessages } from 'xo'
import { formatLogs } from 'utils'
import { FormattedRelative, FormattedTime } from 'react-intl'
import { map } from 'lodash'
import map from 'lodash/map.js'
const LOG_BODY_STYLE = {
whiteSpace: 'pre-wrap',

View File

@ -10,7 +10,7 @@ import { Container, Row, Col } from 'grid'
import { createDoesHostNeedRestart } from 'selectors'
import { FormattedRelative, FormattedTime } from 'react-intl'
import { installAllPatchesOnHost, restartHost } from 'xo'
import { isEmpty } from 'lodash'
import isEmpty from 'lodash/isEmpty.js'
import { createGetObject } from '../../common/selectors'

View File

@ -7,7 +7,7 @@ import Icon from 'icon'
import marked from 'marked'
import React from 'react'
import { Card, CardBlock, CardHeader } from 'card'
import { escapeRegExp } from 'lodash'
import escapeRegExp from 'lodash/escapeRegExp.js'
import { form } from 'modal'
import { connectStore } from 'utils'
import { createGetObjectsOfType } from 'selectors'

View File

@ -13,7 +13,7 @@ import Tooltip from 'tooltip'
import { createBlobFromString, downloadLog, safeDateFormat } from 'utils'
import { get, ifDef } from '@xen-orchestra/defined'
import { injectState, provideState } from 'reaclette'
import { keyBy } from 'lodash'
import keyBy from 'lodash/keyBy.js'
import { runBackupNgJob, subscribeBackupNgJobs, subscribeBackupNgLogs, subscribeSchedules } from 'xo'
export default decorate([

View File

@ -12,7 +12,7 @@ import { alert } from 'modal'
import { Card, CardHeader, CardBlock } from 'card'
import { connectStore, downloadLog } from 'utils'
import { createGetObjectsOfType } from 'selectors'
import { filter } from 'lodash'
import filter from 'lodash/filter.js'
import { Pool } from 'render-xo-item'
import { subscribeBackupNgLogs } from 'xo'

View File

@ -13,7 +13,7 @@ import { isAdmin, createGetObject, createGetObjectsOfType, getIsPoolAdmin } from
import { injectIntl } from 'react-intl'
import { injectState, provideState } from 'reaclette'
import { linkState } from 'reaclette-utils'
import { map } from 'lodash'
import map from 'lodash/map.js'
import { Select, Toggle } from 'form'
import { SelectHost, SelectPif, SelectPool } from 'select-objects'

View File

@ -3,7 +3,7 @@ import ActionBar, { Action } from 'action-bar'
import Component from 'base-component'
import React from 'react'
import { createGetObjectsOfType, createSelector, isAdmin } from 'selectors'
import { find } from 'lodash'
import find from 'lodash/find.js'
import { addSubscriptions, connectStore, noop } from 'utils'
import { addHostsToPool, disableServer, subscribeServers } from 'xo'

View File

@ -10,7 +10,7 @@ import { createGetObjectsOfType } from 'selectors'
import { FormattedRelative, FormattedTime } from 'react-intl'
import { getXoaPlan, ENTERPRISE } from 'xoa-plans'
import { installAllPatchesOnPool, installPatches, rollingPoolUpdate, subscribeHostMissingPatches } from 'xo'
import { isEmpty } from 'lodash'
import isEmpty from 'lodash/isEmpty.js'
const ROLLING_POOL_UPDATES_AVAILABLE = getXoaPlan().value >= ENTERPRISE.value

View File

@ -7,7 +7,7 @@ import { connectStore } from 'utils'
import { Container, Row, Col } from 'grid'
import { createGetObjectsOfType, createSelector } from 'selectors'
import { DEFAULT_GRANULARITY, fetchStats, SelectGranularity } from 'stats'
import { map } from 'lodash'
import map from 'lodash/map.js'
import { Toggle } from 'form'
import { PoolCpuLineChart, PoolMemoryLineChart, PoolPifLineChart, PoolLoadLineChart } from 'xo-line-chart'

View File

@ -10,7 +10,7 @@ import React from 'react'
import SortedTable from 'sorted-table'
import { adminOnly, ShortDate } from 'utils'
import { confirm } from 'modal'
import { groupBy } from 'lodash'
import groupBy from 'lodash/groupBy.js'
import { incorrectState } from 'xo-common/api-errors'
import { provideState, injectState } from 'reaclette'
import { Text } from 'editable'

View File

@ -7,7 +7,7 @@ import SortedTable from 'sorted-table'
import { addSubscriptions } from 'utils'
import { AvailableTemplateVars, DEFAULT_CLOUD_CONFIG_TEMPLATE, DEFAULT_NETWORK_CONFIG_TEMPLATE } from 'cloud-config'
import { Container, Col } from 'grid'
import { find } from 'lodash'
import find from 'lodash/find.js'
import { generateId } from 'reaclette-utils'
import { injectState, provideState } from 'reaclette'
import { Text } from 'editable'

View File

@ -13,7 +13,7 @@ import { Password as EditablePassword, Text } from 'editable'
import { Password, Toggle } from 'form'
import { Pool } from 'render-xo-item'
import { injectIntl } from 'react-intl'
import { noop } from 'lodash'
import noop from 'lodash/noop.js'
import { addServer, disableServer, editServer, enableServer, removeServer, subscribeServers } from 'xo'
const showInfo = () => alert(_('serverAllowUnauthorizedCertificates'), _('serverUnauthorizedCertificatesInfo'))

View File

@ -5,7 +5,7 @@ import React from 'react'
import Tooltip from 'tooltip'
import { Container, Row, Col } from 'grid'
import { DEFAULT_GRANULARITY, fetchStats, SelectGranularity } from 'stats'
import { get } from 'lodash'
import get from 'lodash/get.js'
import { Toggle } from 'form'
import { IopsLineChart, IoThroughputChart, IowaitChart, LatencyChart } from 'xo-line-chart'

View File

@ -8,7 +8,7 @@ import SelectLicense from 'select-license'
import SortedTable from 'sorted-table'
import Tooltip from 'tooltip'
import { addSubscriptions } from 'utils'
import { groupBy } from 'lodash'
import groupBy from 'lodash/groupBy.js'
import { injectState, provideState } from 'reaclette'
import { Proxy, Vm } from 'render-xo-item'
import { subscribeProxies, bindLicense } from 'xo'