Skip to content

Commit

Permalink
Remove the deprecated babel-plugin-lodash (#2965)
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot authored Nov 13, 2024
1 parent 7eafe76 commit e4514a6
Show file tree
Hide file tree
Showing 81 changed files with 210 additions and 117 deletions.
1 change: 0 additions & 1 deletion .babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = {
"@babel/preset-react",
"@babel/preset-typescript",
],
plugins: ["lodash"],
ignore: ["**/*.d.ts"],
env: {
commonjs: {
Expand Down
29 changes: 29 additions & 0 deletions .changeset/lucky-pots-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
"victory-area": patch
"victory-axis": patch
"victory-bar": patch
"victory-box-plot": patch
"victory-brush-container": patch
"victory-brush-line": patch
"victory-candlestick": patch
"victory-chart": patch
"victory-core": patch
"victory-create-container": patch
"victory-cursor-container": patch
"victory-errorbar": patch
"victory-group": patch
"victory-legend": patch
"victory-line": patch
"victory-native": patch
"victory-pie": patch
"victory-polar-axis": patch
"victory-selection-container": patch
"victory-shared-events": patch
"victory-stack": patch
"victory-tooltip": patch
"victory-voronoi": patch
"victory-voronoi-container": patch
"victory-zoom-container": patch
---

Remove deprecated babel-plugin-lodash plugin
2 changes: 1 addition & 1 deletion demo/ts/components/accessibility-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { isNumber } from "lodash";
import isNumber from "lodash/isNumber";
import { VictoryGroup } from "victory-group";
import { VictoryStack } from "victory-stack";
import { VictoryChart } from "victory-chart";
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/create-container-demo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { round } from "lodash";
import round from "lodash/round";
import { VictoryChart } from "victory-chart";
import { VictoryStack } from "victory-stack";
import { VictoryGroup } from "victory-group";
Expand Down
2 changes: 1 addition & 1 deletion demo/ts/components/external-events-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { VictoryBar } from "victory-bar";
import { VictoryLine } from "victory-line";
import { VictoryZoomContainer } from "victory-zoom-container";
import { VictoryVoronoiContainer } from "victory-voronoi-container";
import { range } from "lodash";
import range from "lodash/range";
import { VictoryTheme, VictoryThemePalette } from "victory-core";

const themeColors: VictoryThemePalette =
Expand Down
10 changes: 10 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ export default tseslint.config(
ignores: [
"**/*.d.ts",
"**/.wireit/",
"**/.docusaurus/",
"**/artifacts/",
"**/coverage/",
"**/demo/rn/",
"**/dist/",
"**/build/",
"**/es/",
"**/lib/",
"**/lib-vendor/",
Expand Down Expand Up @@ -77,6 +79,13 @@ export default tseslint.config(
"no-restricted-imports": [
"error",
{
paths: [
{
name: "lodash",
message:
"Be sure to import specific lodash functions, not the entire library!",
},
],
patterns: [
{
group: ["victory*/src", "victory*/src/**"],
Expand Down Expand Up @@ -133,6 +142,7 @@ export default tseslint.config(
files: ["**/demo/**/*.{ts,tsx}"],
rules: {
"no-magic-numbers": "off",
"no-restricted-imports": "off",
"react/no-multi-comp": "off",
"@typescript-eslint/no-empty-object-type": "off",
},
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"autoprefixer": "^10.0.1",
"babel-jest": "29.7.0",
"babel-loader": "9.1.3",
"babel-plugin-lodash": "3.3.4",
"babel-plugin-module-resolver": "5.0.0",
"babel-preset-react-native": "4.0.1",
"chromatic": "^11.16.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-area/src/area.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint no-magic-numbers: ["error", { "ignore": [-1, 0, 1, 2] }]*/
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";
import * as d3Shape from "victory-vendor/d3-shape";
import {
Helpers,
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-axis/src/helper-methods.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defaults } from "lodash";
import defaults from "lodash/defaults";
import { Helpers, Scale, Axis } from "victory-core";
import { VictoryAxisProps } from "./victory-axis";

Expand Down
2 changes: 1 addition & 1 deletion packages/victory-axis/src/victory-axis.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { isEmpty } from "lodash";
import isEmpty from "lodash/isEmpty";
import {
VictoryLabel,
VictoryContainer,
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-bar/src/bar-helper-methods.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isPlainObject } from "lodash";
import isPlainObject from "lodash/isPlainObject";
import { Helpers, VictoryStyleObject } from "victory-core";
import { BarProps } from "./bar";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-bar/src/bar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { forwardRef } from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";
import {
Helpers,
NumberOrCallback,
Expand Down
6 changes: 5 additions & 1 deletion packages/victory-box-plot/src/helper-methods.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { orderBy, defaults, uniq, groupBy } from "lodash";
import defaults from "lodash/defaults";
import groupBy from "lodash/groupBy";
import orderBy from "lodash/orderBy";
import uniq from "lodash/uniq";

import { Helpers, Scale, Domain, Data, Collection } from "victory-core";
import {
min as d3Min,
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-brush-container/src/brush-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import defaults from "lodash/defaults";
import throttle from "lodash/throttle";

import { Helpers as CoreHelpers, Selection } from "victory-core";
import { throttle, defaults } from "lodash";
import isEqual from "react-fast-compare";

const Helpers = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
VictoryEventHandler,
} from "victory-core";
import { BrushHelpers } from "./brush-helpers";
import { defaults } from "lodash";
import defaults from "lodash/defaults";
import isEqual from "react-fast-compare";

export interface VictoryBrushContainerProps extends VictoryContainerProps {
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-brush-line/src/victory-brush-line.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import React from "react";
import defaults from "lodash/defaults";
import pick from "lodash/pick";

import {
Selection,
Helpers,
Expand All @@ -10,7 +13,6 @@ import {
DomainTuple,
VictoryStyleObject,
} from "victory-core";
import { defaults, pick } from "lodash";
import isEqual from "react-fast-compare";

export type VictoryBrushLineTargetType = "data" | "labels" | "parent";
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-candlestick/src/candle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
VictoryCommonPrimitiveProps,
VictoryStyleObject,
} from "victory-core";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

export interface CandleProps extends VictoryCommonPrimitiveProps {
candleRatio?: number;
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-candlestick/src/helper-methods.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { defaults, isPlainObject } from "lodash";
import defaults from "lodash/defaults";
import isPlainObject from "lodash/isPlainObject";

import {
Helpers,
Scale,
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-chart/src/helper-methods.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Helpers, Scale, Axis, Wrapper } from "victory-core";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

const fallbackProps = {
width: 450,
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-chart/src/victory-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { defaults, isEmpty } from "lodash";
import React from "react";
import defaults from "lodash/defaults";
import isEmpty from "lodash/isEmpty";

import {
Background,
Helpers,
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-core/src/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ import {
mergeRefs,
usePortalContext,
} from "./index";
import { pick } from "lodash";
import pick from "lodash/pick";

describe("victory-core", () => {
it("exports addEvents", () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-core/src/victory-animation/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import isPlainObject from "lodash/isPlainObject";
import orderBy from "lodash/orderBy";

import { interpolate } from "victory-vendor/d3-interpolate";
import { isPlainObject, orderBy } from "lodash";

export const isInterpolatable = function (obj) {
// d3 turns null into 0 and undefined into NaN, which we don't want.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React from "react";
import defaults from "lodash/defaults";
import isObject from "lodash/isObject";
import uniqueId from "lodash/uniqueId";

import * as Helpers from "../victory-util/helpers";
import * as UserProps from "../victory-util/user-props";
import { defaults, isObject, uniqueId } from "lodash";
import { ClipPath } from "../victory-primitives/clip-path";
import { Circle } from "../victory-primitives/circle";
import { Rect } from "../victory-primitives/rect";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useRef } from "react";
import { uniqueId } from "lodash";
import uniqueId from "lodash/uniqueId";
import { Portal } from "../victory-portal/portal";
import * as UserProps from "../victory-util/user-props";
import { OriginType } from "../victory-label/victory-label";
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-core/src/victory-label/victory-label.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint no-magic-numbers: ["error", { "ignore": [-0.5, 0.5, 0, 1, 2] }]*/
import { defaults, isEmpty } from "lodash";
import React from "react";
import defaults from "lodash/defaults";
import isEmpty from "lodash/isEmpty";

import { VictoryPortal } from "../victory-portal/victory-portal";
import { Rect } from "../victory-primitives/rect";
import { Text } from "../victory-primitives/text";
Expand Down
4 changes: 3 additions & 1 deletion packages/victory-core/src/victory-portal/victory-portal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { useState } from "react";
import { defaults, uniqueId } from "lodash";
import defaults from "lodash/defaults";
import uniqueId from "lodash/uniqueId";

import * as Log from "../victory-util/log";
import * as Helpers from "../victory-util/helpers";
import { usePortalContext } from "./portal-context";
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-core/src/victory-primitives/arc.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint no-magic-numbers: ["error", { "ignore": [0, 1, 2, 180] }]*/
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

import * as Helpers from "../victory-util/helpers";
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

import * as Helpers from "../victory-util/helpers";
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-core/src/victory-primitives/border.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

import * as Helpers from "../victory-util/helpers";
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

import * as Helpers from "../victory-util/helpers";
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-core/src/victory-primitives/point.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

import * as Helpers from "../victory-util/helpers";
import * as pathHelpers from "../victory-util/point-path-helpers";
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-core/src/victory-primitives/whisker.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { defaults } from "lodash";
import defaults from "lodash/defaults";

import * as Helpers from "../victory-util/helpers";
import { VictoryCommonPrimitiveProps } from "../victory-util/common-props";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import defaults from "lodash/defaults";
import pick from "lodash/pick";
import isEqual from "react-fast-compare";

import { VictoryAnimation } from "../victory-animation/victory-animation";
import * as Collection from "../victory-util/collection";
import * as Helpers from "../victory-util/helpers";
import TimerContext from "../victory-util/timer-context";
import * as Transitions from "../victory-util/transitions";
import { defaults, pick } from "lodash";
import isEqual from "react-fast-compare";
import Timer from "../victory-util/timer";

type VictoryTransitionChild = React.ReactElement<
Expand Down
5 changes: 4 additions & 1 deletion packages/victory-core/src/victory-util/add-events.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from "react";
import { defaults, isEmpty, pick } from "lodash";
import defaults from "lodash/defaults";
import isEmpty from "lodash/isEmpty";
import pick from "lodash/pick";

import isEqual from "react-fast-compare";

import { VictoryLabelableProps } from "../types/prop-types";
Expand Down
6 changes: 5 additions & 1 deletion packages/victory-core/src/victory-util/axis.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import React from "react";
import { defaults, isObject, uniq, orderBy } from "lodash";
import defaults from "lodash/defaults";
import isObject from "lodash/isObject";
import uniq from "lodash/uniq";
import orderBy from "lodash/orderBy";

import * as Collection from "./collection";
import * as Domain from "./domain";
import * as Helpers from "./helpers";
Expand Down
19 changes: 9 additions & 10 deletions packages/victory-core/src/victory-util/data.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from "react";
import {
uniq,
isPlainObject,
property,
orderBy,
isEmpty,
isEqual,
isUndefined,
omitBy,
} from "lodash";
import isEmpty from "lodash/isEmpty";
import isEqual from "lodash/isEqual";
import isPlainObject from "lodash/isPlainObject";
import isUndefined from "lodash/isUndefined";
import omitBy from "lodash/omitBy";
import orderBy from "lodash/orderBy";
import property from "lodash/property";
import uniq from "lodash/uniq";

import * as Helpers from "./helpers";
import * as Collection from "./collection";
import * as Scale from "./scale";
Expand Down
5 changes: 4 additions & 1 deletion packages/victory-core/src/victory-util/domain.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from "react";
import { isPlainObject, sortedUniq, isDate } from "lodash";
import isDate from "lodash/isDate";
import isPlainObject from "lodash/isPlainObject";
import sortedUniq from "lodash/sortedUniq";

import * as Data from "./data";
import * as Scale from "./scale";
import * as Helpers from "./helpers";
Expand Down
5 changes: 4 additions & 1 deletion packages/victory-core/src/victory-util/events.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from "react";
import isEmpty from "lodash/isEmpty";
import pickBy from "lodash/pickBy";
import omitBy from "lodash/omitBy";
import uniq from "lodash/uniq";

import { isEmpty, pickBy, omitBy, uniq } from "lodash";
import type { EventMixinCalculatedValues } from "./add-events";
import { isFunction } from "./helpers";

Expand Down
Loading

0 comments on commit e4514a6

Please sign in to comment.