Skip to content

Commit bee89b2

Browse files
Add import/named to lint rules (#1050)
*Add import/named rule to .eslintrc to enable detecting import issues * Use deep imports for Lodash * Fix other misc lint issues (unused imports/variables) Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
1 parent db38422 commit bee89b2

File tree

15 files changed

+18
-21
lines changed

15 files changed

+18
-21
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
// Import rules
3434
'import/no-unresolved': 'error',
3535
'import/no-duplicates': 'error',
36+
'import/named': 'error',
3637
'import/order': [
3738
'error',
3839
{

src/components/cron-schedule-input/cron-schedule-input-popover/cron-schedule-input-popover.styles.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,10 @@ export const styled = {
2626
})
2727
),
2828

29-
ExamplesList: createStyled(
30-
'div',
31-
({ $theme }: { $theme: Theme }): StyleObject => ({
32-
display: 'flex',
33-
flexDirection: 'column',
34-
})
35-
),
29+
ExamplesList: createStyled('div', {
30+
display: 'flex',
31+
flexDirection: 'column',
32+
}),
3633

3734
ExampleItem: createStyled(
3835
'div',

src/components/multi-select-filter/multi-select-menu/multi-select-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
22

33
import { Button } from 'baseui/button';
44
import { Checkbox } from 'baseui/checkbox';
5-
import { isEqual } from 'lodash';
5+
import isEqual from 'lodash/isEqual';
66

77
import { overrides, styled } from './multi-select-menu.styles';
88
import { type Props } from './multi-select-menu.types';

src/route-handlers/start-workflow/start-workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { status } from '@grpc/grpc-js';
22
import crypto from 'crypto';
3-
import { isEmpty } from 'lodash';
3+
import isEmpty from 'lodash/isEmpty';
44
import { NextResponse, type NextRequest } from 'next/server';
55

66
import dayjs from '@/utils/datetime/dayjs';

src/utils/logger/console/register-console-logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isString } from 'lodash';
1+
import isString from 'lodash/isString';
22

33
import { type Logger } from '..';
44

src/views/domain-workflows-archival/config/domain-workflows-archival-filters.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createElement } from 'react';
22

3-
import { omit } from 'lodash';
3+
import omit from 'lodash/omit';
44

55
import DateFilterV2 from '@/components/date-filter-v2/date-filter-v2';
66
import { type DateFilterValue } from '@/components/date-filter-v2/date-filter-v2.types';

src/views/domains-page/helpers/get-all-domains.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import 'server-only';
2+
// cache is not present in stable React 18's type definitions
3+
// It is available only in their canary, or with Next.js
4+
// eslint-disable-next-line import/named
25
import { cache } from 'react';
36

47
import getConfigValue from '@/utils/config/get-config-value';

src/views/workflow-actions/workflow-action-start-form/workflow-action-start-form.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { DatePicker } from 'baseui/datepicker';
44
import { FormControl } from 'baseui/form-control';
55
import { Input } from 'baseui/input';
66
import { RadioGroup, Radio } from 'baseui/radio';
7-
import { get, isObjectLike } from 'lodash';
7+
import get from 'lodash/get';
8+
import isObjectLike from 'lodash/isObjectLike';
89
import { Controller, type GlobalError, useWatch } from 'react-hook-form';
910

1011
import CronScheduleInput from '@/components/cron-schedule-input/cron-schedule-input';

src/views/workflow-actions/workflow-action-start-optional-section/__tests__/workflow-action-start-optional-section.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { get } from 'lodash';
3+
import get from 'lodash/get';
44
import { useForm } from 'react-hook-form';
55

66
import { fireEvent, render, screen, userEvent } from '@/test-utils/rtl';

src/views/workflow-actions/workflow-action-start-retry-policy/__tests__/workflow-action-start-retry-policy.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { get } from 'lodash';
3+
import get from 'lodash/get';
44
import { useForm } from 'react-hook-form';
55

66
import { render, screen, userEvent } from '@/test-utils/rtl';

0 commit comments

Comments
 (0)