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

Lodash tree shaking #1852

Merged
merged 1 commit into from
Feb 23, 2024
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
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@
},
{
"files": ["src/**/*.{ts,tsx}"],
"excludedFiles": ["src/**/*.stories.{ts,tsx}"],
"excludedFiles": ["src/**/*.{stories,test,spec}.{ts,tsx}"],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "lodash",
"message": "For better tree shaking, prefer deep imports from lodash (e.g. import at from 'lodash/at') instead of named (e.g. import {at} from 'lodash)"
}
],
"patterns": [
{
"group": ["**/tokens-dist/ts/colors"],
Expand Down
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/Breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from 'clsx';
import { debounce } from 'lodash';
import debounce from 'lodash/debounce';
import React, { createContext, useContext, type ReactNode } from 'react';
import { flattenReactChildren } from '../../util/flattenReactChildren';
import Icon, { type IconName } from '../Icon';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { StoryObj, Meta } from '@storybook/react';
import { kebabCase } from 'lodash';
import kebabCase from 'lodash/kebabCase';
import React from 'react';
import { Icon, type IconProps } from './Icon';
import icons, { type IconName } from '../../icons/spritemap';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/Filters.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce } from 'lodash';
import debounce from 'lodash/debounce';
import React, { useEffect, useState } from 'react';
import {
Checkbox,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/StackedCardsToTable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce } from 'lodash';
import debounce from 'lodash/debounce';
import React, { useEffect, useState } from 'react';
import { Card, Table, Text } from '../../../src';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clsx from 'clsx';
import { debounce } from 'lodash';
import debounce from 'lodash/debounce';
import React, {
type ReactNode,
useCallback,
Expand Down
Loading