chore: add lodash eslint (#45627)

This commit is contained in:
叶枫 2023-11-02 15:10:56 +08:00 committed by GitHub
parent 300c1f3f79
commit 923aaba047
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 17 deletions

View File

@ -25,7 +25,16 @@ module.exports = {
},
},
parser: '@typescript-eslint/parser',
plugins: ['react', '@babel', 'jest', '@typescript-eslint', 'react-hooks', 'unicorn', 'markdown'],
plugins: [
'react',
'@babel',
'jest',
'@typescript-eslint',
'react-hooks',
'unicorn',
'markdown',
'lodash',
],
// https://github.com/typescript-eslint/typescript-eslint/issues/46#issuecomment-470486034
overrides: [
{
@ -156,6 +165,7 @@ module.exports = {
'react/no-unused-class-component-methods': 0,
'import/extensions': 0,
'import/no-cycle': 2,
'lodash/import-scope': 2,
'import/no-extraneous-dependencies': [
'error',
{

View File

@ -1,10 +1,11 @@
import { kebabCase } from 'lodash';
import canUseDom from 'rc-util/lib/Dom/canUseDom';
import React from 'react';
import kebabCase from 'lodash/kebabCase';
import canUseDom from 'rc-util/lib/Dom/canUseDom';
import ConfigProvider from '..';
import { InputNumber } from '../..';
import { render } from '../../../tests/utils';
import { resetWarned } from '../../_util/warning';
import { render } from '../../../tests/utils';
import theme from '../../theme';
import { useToken } from '../../theme/internal';

View File

@ -1,9 +1,8 @@
import React from 'react';
import { uniqueId } from 'lodash';
import { createStyles, css } from 'antd-style';
import { AlertFilled, CloseSquareFilled } from '@ant-design/icons';
import { Button, Form, Input, Tooltip } from 'antd';
import { createStyles, css } from 'antd-style';
import uniqueId from 'lodash/uniqueId';
const useStyle = createStyles(() => ({
'custom-feedback-icons': css`

View File

@ -1,13 +1,14 @@
import { produce } from 'immer';
import { cloneDeep } from 'lodash';
import type { UploadRequestOption } from 'rc-upload/lib/interface';
import React, { useEffect, useRef } from 'react';
import { produce } from 'immer';
import cloneDeep from 'lodash/cloneDeep';
import type { UploadRequestOption } from 'rc-upload/lib/interface';
import type { RcFile, UploadFile, UploadProps } from '..';
import Upload from '..';
import { resetWarned } from '../../_util/warning';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import { resetWarned } from '../../_util/warning';
import Form from '../../form';
import { getFileItem, isImageUrl, removeFileItem } from '../utils';
import { setup, teardown } from './mock';

View File

@ -232,6 +232,7 @@
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jest": "^27.0.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-lodash": "^7.4.0",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.1.2",

View File

@ -1,6 +1,8 @@
import fs from 'fs';
import path from 'path';
import _ from 'lodash';
import remove from 'lodash/remove';
import sortBy from 'lodash/sortBy';
import unionBy from 'lodash/unionBy';
import simpleGit from 'simple-git';
const cwd = process.cwd();
@ -18,7 +20,7 @@ const excludes = [
async function execute() {
let { all } = await git.log();
all = _.remove(all, ({ author_email: email }) => {
all = remove(all, ({ author_email: email }) => {
for (let i = 0; i < excludes.length; i++) {
const item = excludes[i];
if (email.includes(item)) {
@ -28,7 +30,7 @@ async function execute() {
return true;
});
all = _.sortBy(_.unionBy(all, 'author_email'), 'author_name');
all = sortBy(unionBy(all, 'author_email'), 'author_name');
fs.writeFileSync(
path.join(cwd, 'contributors.json'),

View File

@ -1,15 +1,16 @@
/* eslint-disable react/jsx-no-constructed-context-values */
import path from 'path';
import * as React from 'react';
import { createCache, StyleProvider } from '@ant-design/cssinjs';
import { globSync } from 'glob';
import * as React from 'react';
import kebabCase from 'lodash/kebabCase';
import { renderToString } from 'react-dom/server';
import { kebabCase } from 'lodash';
import { resetWarned } from '../../components/_util/warning';
import { render } from '../utils';
import { TriggerMockContext } from './demoTestContext';
import { excludeWarning, isSafeWarning } from './excludeWarning';
import rootPropsTest from './rootPropsTest';
import { resetWarned } from '../../components/_util/warning';
export { rootPropsTest };