Skip to content

Commit 5fbe7cd

Browse files
feat(condo): fix lodash imports and add eslint rule (#7123)
* feat(condo): fix lodash imports and add eslint rule * feat(condo): fix lodash imports and add eslint rule * feat(condo): fix import order * fix(condo): fix .eslintrc.js
1 parent 4c68381 commit 5fbe7cd

File tree

46 files changed

+70
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+70
-47
lines changed

.eslintrc.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,17 @@ module.exports = {
172172
'no-restricted-syntax': [
173173
'warn',
174174
{
175-
selector: 'ImportDeclaration[source.value="lodash"] > ImportSpecifier',
176-
message: 'Use default import from "lodash/{method}" instead of named import from "lodash". Example: import set from "lodash/set"',
175+
selector: 'ImportDeclaration[source.value="lodash"]',
176+
message: 'Use specific lodash imports instead. Example: import get from "lodash/get"',
177177
},
178178
{
179179
selector: 'VariableDeclarator[id.type="ObjectPattern"][init.type="CallExpression"][init.callee.name="require"][init.arguments.0.value="lodash"]',
180180
message: 'Use require("lodash/{method}") instead of destructuring from require("lodash"). Example: const get = require("lodash/get")',
181181
},
182+
{
183+
selector: 'VariableDeclarator[init.type="CallExpression"][init.callee.name="require"][init.arguments.0.value="lodash"]',
184+
message: 'Use specific lodash imports instead. Example: const get = require("lodash/get")',
185+
},
182186
],
183187
'import/order': [
184188
'error',

apps/condo/domains/acquiring/utils/clientSchema/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BillingIntegrationOrganizationContext } from '@app/condo/schema'
22
import { gql } from 'graphql-tag'
3-
import { isEmpty } from 'lodash'
3+
import isEmpty from 'lodash/isEmpty'
44

55
const GET_ALL_BILLING_PROPERTIES_BY_VALUE_QUERY = gql`
66
query selectBillingProperty ($where: BillingPropertyWhereInput, $orderBy: String, $first: Int, $skip: Int) {

apps/condo/domains/analytics/utils/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {
66
import dayjs, { Dayjs } from 'dayjs'
77
import duration from 'dayjs/plugin/duration'
88
import relativeTime from 'dayjs/plugin/relativeTime'
9-
import { isEmpty } from 'lodash'
109
import get from 'lodash/get'
1110
import groupBy from 'lodash/groupBy'
11+
import isEmpty from 'lodash/isEmpty'
1212

1313
import { fontSizes } from '@condo/domains/common/constants/style'
1414
import { TICKET_REPORT_DAY_GROUP_STEPS } from '@condo/domains/ticket/constants/common'

apps/condo/domains/common/components/BaseSearchInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import styled from '@emotion/styled'
2-
import { isEmpty } from 'lodash'
32
import debounce from 'lodash/debounce'
43
import get from 'lodash/get'
4+
import isEmpty from 'lodash/isEmpty'
55
import isFunction from 'lodash/isFunction'
66
import throttle from 'lodash/throttle'
77
import uniqBy from 'lodash/uniqBy'

apps/condo/domains/common/components/Comments/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Ticket, TicketComment, TicketCommentFile } from '@app/condo/schema'
1212
import { Form, FormInstance, notification } from 'antd'
1313
import classNames from 'classnames'
1414
import dayjs from 'dayjs'
15-
import { pickBy } from 'lodash'
15+
import pickBy from 'lodash/pickBy'
1616
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
1717

1818
import { getClientSideSenderInfo } from '@open-condo/miniapp-utils'

apps/condo/domains/common/components/TextHighlighter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Typography } from 'antd'
22
import { BaseType } from 'antd/lib/typography/Base'
3-
import { isNull } from 'lodash'
43
import isEmpty from 'lodash/isEmpty'
4+
import isNull from 'lodash/isNull'
55
import React from 'react'
66

77
import { getEscaped } from '@condo/domains/common/utils/string.utils'

apps/condo/domains/common/components/containers/FormList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ import {
1616
} from 'antd'
1717
import { FormProps } from 'antd/lib/form/Form'
1818
import { ArgsProps } from 'antd/lib/notification'
19-
import { isUndefined, throttle } from 'lodash'
2019
import isFunction from 'lodash/isFunction'
20+
import isUndefined from 'lodash/isUndefined'
2121
import omitBy from 'lodash/omitBy'
22+
import throttle from 'lodash/throttle'
2223
import React, { useCallback, useState, useRef, CSSProperties, ComponentProps } from 'react'
2324
import { Options } from 'scroll-into-view-if-needed'
2425

apps/condo/domains/common/hooks/useDateRangeSearch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import dayjs from 'dayjs'
2-
import { get, debounce, isArray } from 'lodash'
2+
import debounce from 'lodash/debounce'
3+
import get from 'lodash/get'
4+
import isArray from 'lodash/isArray'
35
import { useRouter } from 'next/router'
46
import { useCallback } from 'react'
57

apps/condo/domains/common/hooks/useExportToExcel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { notification } from 'antd'
22
import { DocumentNode } from 'graphql'
3-
import { get } from 'lodash'
3+
import get from 'lodash/get'
44
import React, { useCallback } from 'react'
55

66
import { getClientSideSenderInfo } from '@open-condo/miniapp-utils/helpers/sender'

apps/condo/domains/common/hooks/useGlobalHints.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Col, Row, RowProps } from 'antd'
2-
import { isObject } from 'lodash'
32
import get from 'lodash/get'
43
import has from 'lodash/has'
54
import isArray from 'lodash/isArray'
65
import isBoolean from 'lodash/isBoolean'
76
import isEmpty from 'lodash/isEmpty'
7+
import isObject from 'lodash/isObject'
88
import isString from 'lodash/isString'
99
import getConfig from 'next/config'
1010
import Link from 'next/link'

0 commit comments

Comments
 (0)