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: lodash-es instead of lodash #187

Merged
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
11 changes: 11 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,16 @@ module.exports = {
'no-param-reassign': ['error', { props: true, ignorePropertyModificationsForRegex: ['^html'] }],
'no-underscore-dangle': ['error', { allow: ['__filename', '__dirname', '__TDESIGN_THEME_PREFIX__'] }],
'import/no-duplicates': 'off',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'lodash',
message: 'Please use lodash-es instead.',
},
],
},
],
},
};
32 changes: 25 additions & 7 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"clsx": "^2.1.0",
"copy-to-clipboard": "^3.3.3",
"htm": "^3.1.1",
"lodash": "~4.17.15",
"lodash-es": "^4.17.21",
"omi": "^7.7.5",
"omi-transition": "^0.1.11",
"tailwind-merge": "^2.2.1",
Expand All @@ -87,7 +87,7 @@
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-url": "^8.0.2",
"@tailwindcss/typography": "^0.5.10",
"@types/lodash": "^4.17.5",
"@types/lodash-es": "^4.17.12",
"@types/markdown-it": "^13.0.7",
"@types/prismjs": "^1.26.3",
"@typescript-eslint/eslint-plugin": "^7.9.0",
Expand Down
2 changes: 1 addition & 1 deletion src/_common
Submodule _common updated 119 files
2 changes: 1 addition & 1 deletion src/_util/dom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isString from 'lodash/isString';
import { isString } from 'lodash-es';
import raf from 'raf';

import { ScrollContainer, ScrollContainerElement } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion src/_util/helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import camelCase from 'lodash/camelCase';
import { camelCase } from 'lodash-es';

export function omit(obj: object, fields: string[]): object {
const shallowCopy = {
Expand Down
2 changes: 1 addition & 1 deletion src/_util/parseTNode.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isFunction from 'lodash/isFunction';
import { isFunction } from 'lodash-es';
import { cloneElement, VNode } from 'omi';

import log from '../_common/js/log';
Expand Down
2 changes: 1 addition & 1 deletion src/_util/useControlled.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import upperFirst from 'lodash/upperFirst';
import { upperFirst } from 'lodash-es';
import { Component, setActiveComponent, signal, SignalValue } from 'omi';

export interface ChangeHandler<T, P extends any[]> {
Expand Down
2 changes: 1 addition & 1 deletion src/affix/affix.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction } from 'lodash';
import { isFunction } from 'lodash-es';
import { Component, createRef, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'tdesign-icons-web-components/esm/components/info-circle-filled';
import 'tdesign-icons-web-components/esm/components/error-circle-filled';
import 'tdesign-icons-web-components/esm/components/close';

import { isObject } from 'lodash';
import { isObject } from 'lodash-es';
import { Component, createRef, signal, SignalValue, tag } from 'omi';

import classname, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/avatar/avatar-group.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './avatar';

import { toArray } from 'lodash';
import { toArray } from 'lodash-es';
import { classNames, cloneElement, Component, OmiProps, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/checkbox/checkbox-group.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { intersection, isObject, isString, isUndefined, toArray } from 'lodash';
import { intersection, isObject, isString, isUndefined, toArray } from 'lodash-es';
import { bind, Component, signal, tag, VNode } from 'omi';

import classname, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/common/check/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isBoolean, omit } from 'lodash';
import { isBoolean, omit } from 'lodash-es';
import { classNames, Component, tag } from 'omi';

import { getClassPrefix } from '../../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'tdesign-icons-web-components/esm/components/error-circle';
import 'omi-transition';
import '../common/portal';

import { isNumber, isObject, isString } from 'lodash';
import { isNumber, isObject, isString } from 'lodash-es';
import { bind, Component, createRef, OmiProps, signal, tag } from 'omi';

import classname, { classPrefix } from '../_util/classname';
Expand Down
3 changes: 1 addition & 2 deletions src/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import './dropdownItem';
import './dropdownMenu';
import '../popup';

import { isFunction } from 'lodash';
import omit from 'lodash/omit';
import { isFunction, omit } from 'lodash-es';
import { Component, css, tag } from 'omi';

import classNames, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/dropdown/dropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'tdesign-icons-web-components/esm/components/chevron-right';
import './dropdownItem';
import '../divider';

import throttle from 'lodash/throttle';
import { throttle } from 'lodash-es';
import { Component, createRef, tag } from 'omi';

import classNames, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/dropdown/getDropdownOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './dropdownItem';
import './dropdownMenu';

import { toArray } from 'lodash';
import { toArray } from 'lodash-es';

import { TElement, TNode } from '../common';
import { DropdownOption } from './type';
Expand Down
2 changes: 1 addition & 1 deletion src/grid/col.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isObject from 'lodash/isObject';
import { isObject } from 'lodash-es';
import { Component, tag } from 'omi';

import classNames, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/grid/row.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isObject from 'lodash/isObject';
import { isObject } from 'lodash-es';
import { cloneElement, Component, createElement, tag } from 'omi';

import classNames, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/input-number/input-number.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'tdesign-icons-web-components/esm/components/remove';
import '../button';
import '../input';

import { isEqual, pick } from 'lodash';
import { isEqual, pick } from 'lodash-es';
import { bind, Component, createRef, OmiProps, signal, tag } from 'omi';

import {
Expand Down
2 changes: 1 addition & 1 deletion src/notification/NotificationList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './Notification';

import { noop } from 'lodash';
import { noop } from 'lodash-es';
import { Component, createRef, OmiProps, render, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/popconfirm/popcontent.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'tdesign-icons-web-components/esm/components/info-circle-filled';

import isString from 'lodash/isString';
import { isString } from 'lodash-es';
import { cloneElement, Component, OmiProps, tag, VNode } from 'omi';

import classname, { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/popup/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './popupTrigger';
import '../common/portal';

import { createPopper, Instance } from '@popperjs/core';
import debounce from 'lodash/debounce';
import { debounce } from 'lodash-es';
import { cloneElement, Component, createRef, OmiProps, tag, VNode } from 'omi';

import { getIEVersion } from '../_common/js/utils/helper';
Expand Down
2 changes: 1 addition & 1 deletion src/popup/popupTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toArray } from 'lodash';
import { toArray } from 'lodash-es';
import { cloneElement, Component, tag, VNode } from 'omi';

import { TNode } from '../common';
Expand Down
2 changes: 1 addition & 1 deletion src/radio/radioGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './radio';

import { toArray } from 'lodash';
import { toArray } from 'lodash-es';
import { classNames, cloneElement, Component, OmiProps, tag } from 'omi';

import { getClassPrefix, getCommonClassName } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/select-input/SelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import './SelectInputSingle';
import '../popup';

import classNames from 'classnames';
import { pick } from 'lodash';
import { pick } from 'lodash-es';
import { Component, createRef, OmiProps, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/select-input/SelectInputMultiple.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../tag-input';

import classNames from 'classnames';
import isObject from 'lodash/isObject';
import { isObject } from 'lodash-es';
import { Component, createRef, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/select-input/SelectInputSingle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '../input';

import classNames from 'classnames';
import isObject from 'lodash/isObject';
import { isObject } from 'lodash-es';
import { Component, createRef, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
3 changes: 1 addition & 2 deletions src/select-input/useOverlayInnerStyle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import isFunction from 'lodash/isFunction';
import isObject from 'lodash/isObject';
import { isFunction, isObject } from 'lodash-es';
import { Component } from 'omi';

import useControlled from '../_util/useControlled';
Expand Down
2 changes: 1 addition & 1 deletion src/skeleton/skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isNumber from 'lodash/isNumber';
import { isNumber } from 'lodash-es';
import { classNames, Component, createRef, tag } from 'omi';

import { pxCompat } from '../_common/js/utils/helper';
Expand Down
2 changes: 1 addition & 1 deletion src/space/space.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toArray } from 'lodash';
import { toArray } from 'lodash-es';
import { classNames, Component, OmiProps, tag } from 'omi';

import { getClassPrefix } from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'tdesign-icons-web-components/esm/components/chevron-right';
import 'tdesign-icons-web-components/esm/components/chevron-left';
import './swiper-item';

import { isEqual } from 'lodash';
import { isEqual } from 'lodash-es';
import { bind, cloneElement, Component, createRef, signal, tag } from 'omi';

import classname, { classPrefix } from '../_util/classname';
Expand Down
3 changes: 1 addition & 2 deletions src/tabs/TabNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import 'tdesign-icons-web-components/esm/components/chevron-right';
import './TabNavItem';
import './TabBar';

import { debounce, toArray } from 'lodash';
import omit from 'lodash/omit';
import { debounce, omit, toArray } from 'lodash-es';
import { Component, createRef, signal, tag, VNode } from 'omi';

import { calcMaxOffset, calcPrevOrNextOffset, calculateOffset, calcValidOffset } from '../_common/js/tabs/base';
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import './TabNav';
import './tabPanel';

import { toArray } from 'lodash';
import { toArray } from 'lodash-es';
import { Component, tag, VNode } from 'omi';

import classname from '../_util/classname';
Expand Down
2 changes: 1 addition & 1 deletion src/upload/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isFunction, isString } from 'lodash';
import { isFunction, isString } from 'lodash-es';
import { computed, signal, SignalValue } from 'omi';

export const toSignal = <T extends Record<string, any>>(props: T) => {
Expand Down
2 changes: 1 addition & 1 deletion src/watermark/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import { debounce } from 'lodash-es';

const toLowercaseSeparator = (key: string) => key.replace(/([A-Z])/g, '-$1').toLowerCase();

Expand Down
Loading