test: support react 16 lint (#46963)

* feat: support react 16 lint

* feat: test

* feat: test

* feat: test

* feat: test

* feat: 不增加 package script
This commit is contained in:
叶枫 2024-01-14 17:15:39 +08:00 committed by GitHub
parent c50f6f6b7d
commit 7e877dc799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 9 deletions

View File

@ -73,6 +73,12 @@ jobs:
- name: lint
run: npm run lint
- name: lint:react-16
run: npm run compile && npm run install-react-16 && npm run tsc:old
- name: lint:react-17
run: npm run compile && npm run install-react-17 && npm run tsc:old
needs: setup
check_metadata:

View File

@ -2,9 +2,9 @@ import React from 'react';
import { PoweroffOutlined } from '@ant-design/icons';
import { Button, Flex } from 'antd';
const Text1 = () => '部署';
const Text1 = () => <></>;
const Text2 = () => <span></span>;
const Text3 = () => 'Submit';
const Text3 = () => <>Submit</>;
const App: React.FC = () => (
<Flex wrap="wrap" gap="small">

View File

@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { Button, ConfigProvider, Drawer, Space } from 'antd';
import { createStyles, useTheme } from 'antd-style';
import type { DrawerClassNames, DrawerStyles } from '../DrawerPanel';
import type { DrawerClassNames, DrawerStyles } from 'antd/es/drawer/DrawerPanel';
const useStyle = createStyles(({ token }) => ({
'my-drawer-body': {

View File

@ -1,7 +1,7 @@
import { AudioOutlined } from '@ant-design/icons';
import React from 'react';
import { AudioOutlined } from '@ant-design/icons';
import { Input, Space } from 'antd';
import type { SearchProps } from '../Search';
import type { SearchProps } from 'antd/es/input/Search';
const { Search } = Input;

View File

@ -2,11 +2,9 @@ import React, { useRef, useState } from 'react';
import { SearchOutlined } from '@ant-design/icons';
import type { GetRef, TableColumnsType, TableColumnType } from 'antd';
import { Button, Input, Space, Table } from 'antd';
import type { FilterDropdownProps } from 'antd/es/table/interface';
import Highlighter from 'react-highlight-words';
type FilterDropdownType = Exclude<TableColumnType<DataType>['filterDropdown'], React.ReactNode>;
type FilterConfirmProps = Parameters<FilterDropdownType>[0]['confirm'];
type InputRef = GetRef<typeof Input>;
interface DataType {
@ -52,7 +50,7 @@ const App: React.FC = () => {
const handleSearch = (
selectedKeys: string[],
confirm: FilterConfirmProps,
confirm: FilterDropdownProps['confirm'],
dataIndex: DataIndex,
) => {
confirm();

View File

@ -100,6 +100,7 @@
"test:update": "jest --config .jest.js --no-cache -u",
"token-meta": "tsx scripts/generate-token-meta.ts",
"tsc": "tsc --noEmit",
"tsc:old": "tsc --noEmit -p tsconfig-old-react.json",
"version": "tsx scripts/generate-version.ts",
"visual-regression": "tsx scripts/visual-regression/build.ts",
"npm-install": "npm install"

12
tsconfig-old-react.json Normal file
View File

@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"antd": ["es"],
"antd/es/*": ["es/*"],
"antd/lib/*": ["lib/*"],
"antd/locale/*": ["locale/*"]
}
},
"include": ["components/*/demo/*.tsx"]
}