mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
chore: fix eslint errors and warnings (#54137)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect */
|
||||
import * as React from 'react';
|
||||
import { defaultAlgorithm, defaultTheme } from '@ant-design/compatible';
|
||||
import { FastColor } from '@ant-design/fast-color';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect */
|
||||
import React, { Suspense, useEffect } from 'react';
|
||||
import { App, Button, Skeleton } from 'antd';
|
||||
import { enUS, zhCN } from 'antd-token-previewer';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect */
|
||||
import type { ComponentProps } from 'react';
|
||||
import React, { useEffect, useMemo } from 'react';
|
||||
import { Button, Tabs, Typography } from 'antd';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect */
|
||||
import React from 'react';
|
||||
import { InfoCircleOutlined, PushpinOutlined } from '@ant-design/icons';
|
||||
import get from 'rc-util/lib/utils/get';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-hooks-extra/no-direct-set-state-in-use-effect */
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { GithubOutlined, MenuOutlined } from '@ant-design/icons';
|
||||
import { Alert, Button, Col, ConfigProvider, Popover, Row, Select, Tooltip } from 'antd';
|
||||
|
||||
@@ -12,9 +12,9 @@ export function resetWarned() {
|
||||
|
||||
type Warning = (valid: boolean, component: string, message?: string) => void;
|
||||
|
||||
let warning: Warning = noop;
|
||||
let _warning: Warning = noop;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
warning = (valid, component, message) => {
|
||||
_warning = (valid, component, message) => {
|
||||
rcWarning(valid, `[antd: ${component}] ${message}`);
|
||||
|
||||
// StrictMode will inject console which will not throw warning in React 17.
|
||||
@@ -23,6 +23,7 @@ if (process.env.NODE_ENV !== 'production') {
|
||||
}
|
||||
};
|
||||
}
|
||||
const warning = _warning;
|
||||
|
||||
type BaseTypeWarning = (
|
||||
valid: boolean,
|
||||
|
||||
@@ -7,7 +7,7 @@ const DatePickerDemo: React.FC = () => {
|
||||
const [visible, setVisible] = React.useState(false);
|
||||
const [panelVisible, setPanelVisible] = React.useState(false);
|
||||
|
||||
const [date, setDate] = React.useState<Dayjs | null>(dayjs());
|
||||
const [date, setDate] = React.useState<Dayjs | null>(() => dayjs());
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
|
||||
@@ -334,22 +334,22 @@ methods.forEach((type: keyof MessageMethods) => {
|
||||
// ==============================================================================
|
||||
const noop = () => {};
|
||||
|
||||
/** @internal Only Work in test env */
|
||||
export let actWrapper: (wrapper: any) => void = noop;
|
||||
|
||||
let _actWrapper: (wrapper: any) => void = noop;
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
actWrapper = (wrapper) => {
|
||||
_actWrapper = (wrapper) => {
|
||||
act = wrapper;
|
||||
};
|
||||
}
|
||||
const actWrapper = _actWrapper;
|
||||
export { actWrapper };
|
||||
|
||||
/** @internal Only Work in test env */
|
||||
export let actDestroy = noop;
|
||||
|
||||
let _actDestroy = noop;
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
actDestroy = () => {
|
||||
_actDestroy = () => {
|
||||
message = null;
|
||||
};
|
||||
}
|
||||
const actDestroy = _actDestroy;
|
||||
export { actDestroy };
|
||||
|
||||
export default staticMethods;
|
||||
|
||||
@@ -256,22 +256,22 @@ methods.forEach((type: keyof NoticeMethods) => {
|
||||
// ==============================================================================
|
||||
const noop = () => {};
|
||||
|
||||
/** @internal Only Work in test env */
|
||||
export let actWrapper: (wrapper: any) => void = noop;
|
||||
|
||||
let _actWrapper: (wrapper: any) => void = noop;
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
actWrapper = (wrapper) => {
|
||||
_actWrapper = (wrapper) => {
|
||||
act = wrapper;
|
||||
};
|
||||
}
|
||||
const actWrapper = _actWrapper;
|
||||
export { actWrapper };
|
||||
|
||||
/** @internal Only Work in test env */
|
||||
export let actDestroy = noop;
|
||||
|
||||
let _actDestroy = noop;
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
actDestroy = () => {
|
||||
_actDestroy = () => {
|
||||
notification = null;
|
||||
};
|
||||
}
|
||||
const actDestroy = _actDestroy;
|
||||
export { actDestroy };
|
||||
|
||||
export default staticMethods;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-dom/no-dangerously-set-innerhtml */
|
||||
import React from 'react';
|
||||
import { Flex } from 'antd';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react-dom/no-dangerously-set-innerhtml */
|
||||
import React from 'react';
|
||||
import { Flex } from 'antd';
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
"@ant-design/happy-work-theme": "^1.0.0",
|
||||
"@ant-design/tools": "^18.0.3",
|
||||
"@ant-design/v5-patch-for-react-19": "^1.0.2",
|
||||
"@antfu/eslint-config": "^4.0.0",
|
||||
"@antfu/eslint-config": "^4.15.0",
|
||||
"@antv/g6": "^4.8.24",
|
||||
"@biomejs/biome": "^2.0.0",
|
||||
"@codecov/webpack-plugin": "^1.4.0",
|
||||
|
||||
Reference in New Issue
Block a user