packages: remove lodash-es

This commit is contained in:
Chika 2022-09-17 20:21:50 +03:00
parent 31f4a8fc24
commit ecc767fede
7 changed files with 12 additions and 37 deletions

View File

@ -1,6 +1,6 @@
import { Button as AntButton } from 'antd';
import type { BaseButtonProps } from 'antd/lib/button/button';
import { throttle } from 'lodash-es';
import { throttle } from 'radash/dist/curry';
import type { FC } from 'react';
import type { BaseElementProps } from './types';
@ -17,9 +17,12 @@ export default (function Button({
text,
...props
}: BaseElementProps<never> & ElementProps) {
const throttledAction = throttle(action, 1200, {
trailing: false,
});
const throttledAction = throttle(
{
interval: 1200,
},
action
);
return (
<AntButton

View File

@ -1,4 +1,4 @@
import { orderBy } from 'lodash-es';
import { alphabetical } from 'radash/dist/array';
import type { CalculationOptions } from 'stores/calculation/options/types';
const defaultOptions: CalculationOptions = {
@ -153,7 +153,7 @@ const defaultOptions: CalculationOptions = {
},
],
selectLeaseObjectUseFor: orderBy(
selectLeaseObjectUseFor: alphabetical(
[
{
label: 'Для представительских целей',
@ -237,7 +237,7 @@ const defaultOptions: CalculationOptions = {
},
],
(objectUseFor) => objectUseFor.label.toLowerCase(),
['asc']
'asc'
),
radioInfuranceOPF: [

View File

@ -16,7 +16,6 @@ const customJestConfig = {
moduleDirectories: ['node_modules', '<rootDir>/'],
moduleNameMapper: {
// Handle module aliases (this will be automatically configured for you soon)
'lodash-es': 'lodash',
},
testEnvironment: 'jest-environment-jsdom',
preset: 'ts-jest',

View File

@ -16,14 +16,6 @@ const nextConfig = {
styledComponents: true,
},
pageExtensions: ['tsx', 'jsx'],
experimental: {
modularizeImports: {
'lodash-es': {
transform: 'lodash-es/{{member}}',
preventFullImport: true,
},
},
},
rewrites:
process.env.NODE_ENV === 'development' &&
async function rewrites() {

View File

@ -27,7 +27,6 @@
"graphql": "^16.6.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"lodash-es": "^4.17.21",
"mobx": "^6.5.0",
"mobx-react-lite": "^3.4.0",
"next": "^12.3.0",
@ -35,6 +34,7 @@
"next-plugin-graphql": "^0.0.2",
"next-with-less": "^2.0.5",
"normalize.css": "^8.0.1",
"radash": "^7.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rebass": "^4.0.7",
@ -49,7 +49,6 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/lodash-es": "^4.17.6",
"@types/node": "18.7.18",
"@types/react": "18.0.20",
"@types/react-dom": "18.0.6",

View File

@ -3,7 +3,6 @@
import type { Elements, ElementsTypes } from 'Components/Calculation/config/map/values';
import defaultOptions from 'config/default-options';
import type { BaseOption } from 'Elements/types';
import { merge } from 'lodash-es';
import { makeAutoObservable } from 'mobx';
import type RootStore from 'stores/root';
import type { CalculationOptions } from './types';
@ -18,7 +17,7 @@ export default class OptionsStore {
}
hydrate = (initialOptions: CalculationOptions) => {
this.options = merge(defaultOptions, initialOptions);
this.options = { ...defaultOptions, ...initialOptions };
};
getOptions<T extends Elements>(elementName: T) {

View File

@ -2284,18 +2284,6 @@
dependencies:
"@types/node" "*"
"@types/lodash-es@^4.17.6":
version "4.17.6"
resolved "https://registry.yarnpkg.com/@types/lodash-es/-/lodash-es-4.17.6.tgz#c2ed4c8320ffa6f11b43eb89e9eaeec65966a0a0"
integrity sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg==
dependencies:
"@types/lodash" "*"
"@types/lodash@*":
version "4.14.182"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.182.tgz#05301a4d5e62963227eaafe0ce04dd77c54ea5c2"
integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q==
"@types/node-fetch@^2.5.10":
version "2.6.1"
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.1.tgz#8f127c50481db65886800ef496f20bbf15518975"
@ -6768,11 +6756,6 @@ locate-path@^6.0.0:
dependencies:
p-locate "^5.0.0"
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"