mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Turn on noUnusedLocals, noImplicitReturns, importsNotUsedAsValues: error, and isolatedModules (#2777)
This commit is contained in:
1 parent
489cef9595
commit
5ed4537979
287 files changed
+704
-628
No files matched your search
@@ -64,7 +64,7 @@ export class TableCell extends React.Component<TableCellProps> {
|
||||
renderSortIcon() {
|
||||
const { sortBy, _sorting } = this.props;
|
||||
|
||||
if (!this.isSortable) return;
|
||||
if (!this.isSortable) return null;
|
||||
const sortActive = _sorting.sortBy === sortBy;
|
||||
const sortIconName = (!sortActive || _sorting.orderBy === "desc") ? "arrow_drop_down" : "arrow_drop_up";
|
||||
|
||||
@@ -83,6 +83,8 @@ export class TableCell extends React.Component<TableCellProps> {
|
||||
if (checkbox && showCheckbox) {
|
||||
return <Checkbox value={isChecked} />;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import "./table-row.scss";
|
||||
|
||||
import React, { CSSProperties } from "react";
|
||||
import { cssNames } from "../../utils";
|
||||
import { ItemObject } from "../../item.store";
|
||||
import type { ItemObject } from "../../item.store";
|
||||
|
||||
export type TableRowElem = React.ReactElement<TableRowProps>;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
import { createStorage } from "../../utils";
|
||||
import { TableSortParams } from "./table";
|
||||
import type { TableSortParams } from "./table";
|
||||
|
||||
export interface TableStorageModel {
|
||||
sortParams: {
|
||||
|
||||
@@ -27,10 +27,10 @@ import { observer } from "mobx-react";
|
||||
import { autobind, cssNames, noop } from "../../utils";
|
||||
import { TableRow, TableRowElem, TableRowProps } from "./table-row";
|
||||
import { TableHead, TableHeadElem, TableHeadProps } from "./table-head";
|
||||
import { TableCellElem } from "./table-cell";
|
||||
import type { TableCellElem } from "./table-cell";
|
||||
import { VirtualList } from "../virtual-list";
|
||||
import { createPageParam } from "../../navigation";
|
||||
import { ItemObject } from "../../item.store";
|
||||
import type { ItemObject } from "../../item.store";
|
||||
import { getSortParams, setSortParams } from "./table.storage";
|
||||
import { computed } from "mobx";
|
||||
|
||||
@@ -102,33 +102,35 @@ export class Table extends React.Component<TableProps> {
|
||||
const content = React.Children.toArray(children) as (TableRowElem | TableHeadElem)[];
|
||||
const headElem: React.ReactElement<TableHeadProps> = content.find(elem => elem.type === TableHead);
|
||||
|
||||
if (headElem) {
|
||||
if (sortable) {
|
||||
const columns = React.Children.toArray(headElem.props.children) as TableCellElem[];
|
||||
|
||||
return React.cloneElement(headElem, {
|
||||
children: columns.map(elem => {
|
||||
if (elem.props.checkbox) {
|
||||
return elem;
|
||||
}
|
||||
const title = elem.props.title || (
|
||||
// copy cell content to title if it's a string
|
||||
// usable if part of TableCell's content is hidden when there is not enough space
|
||||
typeof elem.props.children === "string" ? elem.props.children : undefined
|
||||
);
|
||||
|
||||
return React.cloneElement(elem, {
|
||||
title,
|
||||
_sort: this.sort,
|
||||
_sorting: this.sortParams,
|
||||
_nowrap: headElem.props.nowrap,
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return headElem;
|
||||
if (!headElem) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (sortable) {
|
||||
const columns = React.Children.toArray(headElem.props.children) as TableCellElem[];
|
||||
|
||||
return React.cloneElement(headElem, {
|
||||
children: columns.map(elem => {
|
||||
if (elem.props.checkbox) {
|
||||
return elem;
|
||||
}
|
||||
const title = elem.props.title || (
|
||||
// copy cell content to title if it's a string
|
||||
// usable if part of TableCell's content is hidden when there is not enough space
|
||||
typeof elem.props.children === "string" ? elem.props.children : undefined
|
||||
);
|
||||
|
||||
return React.cloneElement(elem, {
|
||||
title,
|
||||
_sort: this.sort,
|
||||
_sorting: this.sortParams,
|
||||
_nowrap: headElem.props.nowrap,
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return headElem;
|
||||
}
|
||||
|
||||
getSorted(items: any[]) {
|
||||
|
||||
Reference in new issue
Block a user