Skip to content

Commit b877654

Browse files
committed
chore: fix lint
1 parent 253eb42 commit b877654

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"test": "vitest --watch false",
4444
"coverage": "vitest run --coverage",
4545
"prepublishOnly": "npm run compile && rc-np",
46-
"lint": "eslint src/ --ext .tsx,.ts",
46+
"lint": "eslint src",
4747
"tsc": "tsc -p tsconfig.json --noEmit",
4848
"now-build": "npm run docs:build",
4949
"prepare": "husky install"
@@ -75,7 +75,7 @@
7575
"dumi": "^2.1.3",
7676
"eslint": "^8.54.0",
7777
"eslint-plugin-jest": "^29.0.1",
78-
"eslint-plugin-unicorn": "^60.0.0",
78+
"eslint-plugin-unicorn": "^56.0.0",
7979
"father": "^4.0.0",
8080
"gh-pages": "^6.1.0",
8181
"glob": "^11.0.0",

src/Header/Header.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useContext } from '@rc-component/context';
21
import * as React from 'react';
2+
import { useContext } from '@rc-component/context';
33
import TableContext, { responseImmutable } from '../context/TableContext';
44
import devRenderTimes from '../hooks/useRenderTimes';
55
import type {
@@ -12,7 +12,7 @@ import type {
1212
} from '../interface';
1313
import HeaderRow from './HeaderRow';
1414
import cls from 'classnames';
15-
import { TableProps } from '..';
15+
import type { TableProps } from '..';
1616

1717
function parseHeaderRows<RecordType>(
1818
rootColumns: ColumnsType<RecordType>,

src/Header/HeaderRow.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
} from '../interface';
1212
import { getCellFixedInfo } from '../utils/fixUtil';
1313
import { getColumnsKey } from '../utils/valueUtil';
14-
import { TableProps } from '..';
14+
import type { TableProps } from '..';
1515

1616
export interface RowProps<RecordType> {
1717
cells: readonly CellType<RecordType>[];
@@ -51,23 +51,15 @@ const HeaderRow = <RecordType extends any>(props: RowProps<RecordType>) => {
5151
return (
5252
<RowComponent {...rowProps} className={classNames.row} style={styles.row}>
5353
{cells.map((cell: CellType<RecordType>, cellIndex) => {
54-
const { column } = cell;
55-
const fixedInfo = getCellFixedInfo(
56-
cell.colStart,
57-
cell.colEnd,
58-
flattenColumns,
59-
stickyOffsets,
60-
);
54+
const { column, colStart, colEnd, colSpan } = cell;
55+
const fixedInfo = getCellFixedInfo(colStart, colEnd, flattenColumns, stickyOffsets);
6156

62-
let additionalProps: React.HTMLAttributes<HTMLElement>;
63-
if (column && column.onHeaderCell) {
64-
additionalProps = cell.column.onHeaderCell(column);
65-
}
57+
const additionalProps: React.HTMLAttributes<HTMLElement> = column?.onHeaderCell(column);
6658

6759
return (
6860
<Cell
6961
{...cell}
70-
scope={column.title ? (cell.colSpan > 1 ? 'colgroup' : 'col') : null}
62+
scope={column.title ? (colSpan > 1 ? 'colgroup' : 'col') : null}
7163
ellipsis={column.ellipsis}
7264
align={column.align}
7365
component={CellComponent}

src/context/TableContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
TriggerEventHandler,
1616
} from '../interface';
1717
import type { FixedInfo } from '../utils/fixUtil';
18-
import { TableProps } from '../Table';
18+
import type { TableProps } from '../Table';
1919

2020
const { makeImmutable, responseImmutable, useImmutableMark } = createImmutable();
2121
export { makeImmutable, responseImmutable, useImmutableMark };

src/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export interface RenderedCell<RecordType> {
8181
export type Direction = 'ltr' | 'rtl';
8282

8383
// SpecialString will be removed in antd@6
84-
export type SpecialString<T> = T | (string & {});
84+
export type SpecialString<T> = T | (string & unknown);
8585

8686
export type DataIndex<T = any> =
8787
| DeepNamePath<T>

0 commit comments

Comments
 (0)