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

fix: Lodash - use module imports #2349

Merged
merged 1 commit into from
Jun 1, 2023
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
4 changes: 3 additions & 1 deletion packages/annotations/src/compute.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { filter, isNumber, omit } from 'lodash'
import filter from 'lodash/filter'
import isNumber from 'lodash/isNumber'
import omit from 'lodash/omit'
import {
radiansToDegrees,
absoluteAngleDegrees,
Expand Down
2 changes: 1 addition & 1 deletion packages/bar/src/compute/legends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
LegendLabelDatum,
} from '../types'
import { getPropertyAccessor } from '@nivo/core'
import { uniqBy } from 'lodash'
import uniqBy from 'lodash/uniqBy'

export const getLegendDataForKeys = <RawDatum extends BarDatum>(
bars: BarsWithHidden<RawDatum>,
Expand Down
3 changes: 2 additions & 1 deletion packages/boxplot/src/compute/legends.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BoxPlotDatum, BoxPlotCommonProps, ComputedBoxPlotSummary, LegendData } from '../types'
import { getPropertyAccessor } from '@nivo/core'
import { uniqBy, sortBy } from 'lodash'
import uniqBy from 'lodash/uniqBy'
import sortBy from 'lodash/sortBy'

export const getLegendData = <RawDatum extends BoxPlotDatum>({
boxPlots,
Expand Down
4 changes: 3 additions & 1 deletion packages/calendar/src/compute/calendar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { isDate, memoize, range } from 'lodash'
import isDate from 'lodash/isDate'
import memoize from 'lodash/memoize'
import range from 'lodash/range'
import { alignBox } from '@nivo/core'
import { timeFormat } from 'd3-time-format'
import { timeDays, timeWeek, timeWeeks, timeMonths, timeYear } from 'd3-time'
Expand Down
2 changes: 1 addition & 1 deletion packages/calendar/src/compute/timeRange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'd3-time'
import { timeFormat } from 'd3-time-format'
import { DateOrString, Weekday } from '../types'
import { isDate } from 'lodash'
import isDate from 'lodash/isDate'

// Interfaces
interface ComputeBaseProps {
Expand Down
3 changes: 2 additions & 1 deletion packages/colors/src/inheritedColor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'
import { get, isPlainObject } from 'lodash'
import get from 'lodash/get'
import isPlainObject from 'lodash/isPlainObject'
import { rgb, RGBColor } from 'd3-color'
import { Theme } from '@nivo/core'

Expand Down
3 changes: 2 additions & 1 deletion packages/colors/src/scales/ordinalColorScale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo } from 'react'
import { get, isPlainObject } from 'lodash'
import get from 'lodash/get'
import isPlainObject from 'lodash/isPlainObject'
import { scaleOrdinal } from 'd3-scale'
import {
ColorSchemeId,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/motion/context.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext, useMemo } from 'react'
import { isString } from 'lodash'
import isString from 'lodash/isString'
import PropTypes from 'prop-types'
import { config as presets } from '@react-spring/web'

Expand Down
2 changes: 1 addition & 1 deletion packages/express/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Router } from 'express'
import * as uuid from 'uuid'
import { forOwn } from 'lodash'
import forOwn from 'lodash/forOwn'
import { chartsMapping, ChartType, renderChart, samples } from '@nivo/static'
import { validate } from './validation'
import * as storage from './memory-storage'
Expand Down
2 changes: 1 addition & 1 deletion packages/express/src/validation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Request, Response, NextFunction } from 'express'
import { omit } from 'lodash'
import omit from 'lodash/omit'
import Joi from 'joi'

export const validate = (
Expand Down
3 changes: 2 additions & 1 deletion packages/geo/src/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* file that was distributed with this source code.
*/
import { useMemo } from 'react'
import { isFunction, get } from 'lodash'
import isFunction from 'lodash/isFunction'
import get from 'lodash/get'
import { format } from 'd3-format'
import {
geoPath,
Expand Down
2 changes: 1 addition & 1 deletion packages/marimekko/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react'
import { get } from 'lodash'
import get from 'lodash/get'
import { stack as d3Stack, Stack, Series } from 'd3-shape'
import { useValueFormatter, useTheme } from '@nivo/core'
import { InheritedColorConfig, useInheritedColor, useOrdinalColorScale } from '@nivo/colors'
Expand Down
2 changes: 1 addition & 1 deletion packages/sankey/src/Sankey.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createElement, Fragment, ReactNode } from 'react'
import { uniq } from 'lodash'
import uniq from 'lodash/uniq'
import { SvgWrapper, useDimensions, Container } from '@nivo/core'
import { BoxLegendSvg } from '@nivo/legends'
import { svgDefaultProps } from './props'
Expand Down
2 changes: 1 addition & 1 deletion packages/sankey/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useMemo } from 'react'
import { cloneDeep } from 'lodash'
import cloneDeep from 'lodash/cloneDeep'
import { sankey as d3Sankey } from 'd3-sankey'
import { useTheme, usePropertyAccessor, useValueFormatter } from '@nivo/core'
import { useOrdinalColorScale, useInheritedColor } from '@nivo/colors'
Expand Down
2 changes: 1 addition & 1 deletion packages/static/src/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pick } from 'lodash'
import pick from 'lodash/pick'
import { createElement } from 'react'
import { renderToStaticMarkup } from 'react-dom/server'
import { ChartProps, chartsMapping, ChartType } from './mappings'
Expand Down