Unverified Commit cd85092e authored by Marcos Iglesias's avatar Marcos Iglesias Committed by GitHub

chore: Cleans up ESLint issues (#731)

Signed-off-by: 's avatarMarcos Iglesias Valle <golodhros@gmail.com>
parent 384160ed
......@@ -290,13 +290,13 @@ exports[`strict null compilation`] = {
"js/pages/SearchPage/SearchFilter/FilterSection/index.tsx:2128122504": [
[51, 48, 18, "Type \'CheckboxFilterProperties[] | undefined\' is not assignable to type \'CheckboxFilterProperties[]\'.\\n Type \'undefined\' is not assignable to type \'CheckboxFilterProperties[]\'.", "12656471"]
],
"js/pages/SearchPage/SearchFilter/index.spec.tsx:3772392704": [
[234, 23, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'FilterConfig\'.", "2620553983"]
"js/pages/SearchPage/SearchFilter/index.spec.tsx:2944458990": [
[232, 23, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'FilterConfig\'.", "2620553983"]
],
"js/pages/SearchPage/SearchFilter/index.tsx:2139967954": [
[78, 8, 42, "Type \'{ value: string; label: string | undefined; }[]\' is not assignable to type \'CheckboxFilterProperties[]\'.\\n Type \'{ value: string; label: string | undefined; }\' is not assignable to type \'CheckboxFilterProperties\'.\\n Types of property \'label\' are incompatible.\\n Type \'string | undefined\' is not assignable to type \'string\'.\\n Type \'undefined\' is not assignable to type \'string\'.", "3344322363"],
[84, 26, 7, "Argument of type \'{ categoryId: string; helpText: string | undefined; title: string; type: FilterType; }\' is not assignable to parameter of type \'never\'.", "2519086860"],
[93, 56, 4, "No overload matches this call.\\n The last overload gave the following error.\\n Argument of type \'null\' is not assignable to parameter of type \'{}\'.", "2087897566"]
"js/pages/SearchPage/SearchFilter/index.tsx:1113311229": [
[80, 8, 42, "Type \'{ value: string; label: string | undefined; }[]\' is not assignable to type \'CheckboxFilterProperties[]\'.\\n Type \'{ value: string; label: string | undefined; }\' is not assignable to type \'CheckboxFilterProperties\'.\\n Types of property \'label\' are incompatible.\\n Type \'string | undefined\' is not assignable to type \'string\'.\\n Type \'undefined\' is not assignable to type \'string\'.", "3344322363"],
[86, 26, 7, "Argument of type \'{ categoryId: string; helpText: string | undefined; title: string; type: FilterType; }\' is not assignable to parameter of type \'never\'.", "2519086860"],
[95, 56, 4, "No overload matches this call.\\n The last overload gave the following error.\\n Argument of type \'null\' is not assignable to parameter of type \'{}\'.", "2087897566"]
],
"js/pages/SearchPage/index.spec.tsx:2996104118": [
[45, 52, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"],
......@@ -332,10 +332,10 @@ exports[`strict null compilation`] = {
"js/pages/TableDetailPage/index.spec.tsx:120018363": [
[33, 4, 8, "Argument of type \'Partial<Location<{} | null | undefined>> | undefined\' is not assignable to parameter of type \'Partial<Location<{} | null | undefined>>\'.\\n Type \'undefined\' is not assignable to type \'Partial<Location<{} | null | undefined>>\'.", "2700611480"]
],
"js/pages/TableDetailPage/index.tsx:987689418": [
[181, 10, 13, "Type \'null\' is not assignable to type \'((newValue: string, onSuccess?: (() => any) | undefined, onFailure?: (() => any) | undefined) => void) | undefined\'.", "67794331"],
[236, 11, 26, "Type \'{ itemsPerPage: number; source: string; }\' is missing the following properties from type \'Readonly<Pick<TableDashboardResourceListProps, \\"source\\" | \\"isLoading\\" | \\"dashboards\\" | \\"itemsPerPage\\" | \\"errorText\\"> & OwnProps>\': isLoading, dashboards, errorText", "2224258167"],
[325, 16, 7, "Type \'string | null\' is not assignable to type \'string | undefined\'.\\n Type \'null\' is not assignable to type \'string | undefined\'.", "3817619378"]
"js/pages/TableDetailPage/index.tsx:3727993506": [
[185, 10, 13, "Type \'null\' is not assignable to type \'((newValue: string, onSuccess?: (() => any) | undefined, onFailure?: (() => any) | undefined) => void) | undefined\'.", "67794331"],
[240, 11, 26, "Type \'{ itemsPerPage: number; source: string; }\' is missing the following properties from type \'Readonly<Pick<TableDashboardResourceListProps, \\"source\\" | \\"isLoading\\" | \\"dashboards\\" | \\"itemsPerPage\\" | \\"errorText\\"> & OwnProps>\': isLoading, dashboards, errorText", "2224258167"],
[329, 16, 7, "Type \'string | null\' is not assignable to type \'string | undefined\'.\\n Type \'null\' is not assignable to type \'string | undefined\'.", "3817619378"]
],
"js/utils/navigationUtils.ts:1127210474": [
[19, 50, 21, "Type \'undefined\' cannot be used as an index type.", "602535635"]
......
......@@ -16,7 +16,7 @@ import {
mapStateToProps,
SearchFilter,
SearchFilterProps,
FilterSection,
FilterSectionItem,
CheckboxFilterSection,
} from '.';
......@@ -52,7 +52,7 @@ describe('SearchFilter', () => {
let wrapper;
let content;
let mockCheckboxFilterData: CheckboxFilterSection;
let mockInputFilterData: FilterSection;
let mockInputFilterData: FilterSectionItem;
beforeAll(() => {
const setupResult = setup();
props = setupResult.props;
......@@ -127,13 +127,11 @@ describe('SearchFilter', () => {
});
describe('render', () => {
let props;
let wrapper;
let renderFilterSectionsSpy;
beforeAll(() => {
const setupResult = setup();
props = setupResult.props;
wrapper = setupResult.wrapper;
renderFilterSectionsSpy = jest.spyOn(
wrapper.instance(),
......
......@@ -7,25 +7,25 @@ import { connect } from 'react-redux';
import { GlobalState } from 'ducks/rootReducer';
import { getFilterConfigByResource } from 'config/config-utils';
import { FilterType, ResourceType } from 'interfaces';
import { FilterType } from 'interfaces';
import { CheckboxFilterProperties } from './CheckBoxFilter';
import FilterSection from './FilterSection';
import './styles.scss';
export interface FilterSection {
export interface FilterSectionItem {
categoryId: string;
helpText?: string;
title: string;
type: FilterType;
}
export interface CheckboxFilterSection extends FilterSection {
export interface CheckboxFilterSection extends FilterSectionItem {
options: CheckboxFilterProperties[];
}
export interface StateFromProps {
filterSections: FilterSection[];
filterSections: FilterSectionItem[];
}
export type SearchFilterProps = StateFromProps;
......@@ -33,7 +33,7 @@ export type SearchFilterProps = StateFromProps;
export class SearchFilter extends React.Component<SearchFilterProps> {
createFilterSection = (
key: string,
section: FilterSection | CheckboxFilterSection
section: FilterSectionItem | CheckboxFilterSection
) => {
const { categoryId, helpText, title, type } = section;
const options = (section as CheckboxFilterSection).options
......@@ -52,7 +52,9 @@ export class SearchFilter extends React.Component<SearchFilterProps> {
};
renderFilterSections = () => {
return this.props.filterSections.map((section) =>
const { filterSections } = this.props;
return filterSections.map((section) =>
this.createFilterSection(`section:${section.categoryId}`, section)
);
};
......@@ -65,8 +67,8 @@ export class SearchFilter extends React.Component<SearchFilterProps> {
export const mapStateToProps = (state: GlobalState) => {
const resourceType = state.search.resource;
const filterCategories = getFilterConfigByResource(resourceType);
const filterSections = [];
if (filterCategories) {
filterCategories.forEach((categoryConfig) => {
const section = {
......
......@@ -45,7 +45,9 @@ const ShimmeringIssuesLoader: React.FC = () => {
export class TableIssues extends React.Component<TableIssueProps> {
componentDidMount() {
this.props.getIssues(this.props.tableKey);
const { getIssues, tableKey } = this.props;
getIssues(tableKey);
}
renderIssue = (issue: Issue, index: number) => {
......@@ -77,20 +79,21 @@ export class TableIssues extends React.Component<TableIssueProps> {
};
renderIssueContent = () => {
if (this.props.issues.length === 0) {
const { issues } = this.props;
if (issues.length === 0) {
return <div className="issue-banner">{NO_DATA_ISSUES_TEXT}</div>;
}
return this.props.issues.map(this.renderIssue);
return issues.map(this.renderIssue);
};
renderIssueFooter = () => {
const hasIssues = this.props.issues.length !== 0;
const { issues, tableKey, tableName, allIssuesUrl, total } = this.props;
const hasIssues = issues.length !== 0;
const reportIssueLink = (
<div className={`table-report-new-issue ${hasIssues ? 'ml-1' : ''}`}>
<ReportTableIssue
tableKey={this.props.tableKey}
tableName={this.props.tableName}
/>
<ReportTableIssue tableKey={tableKey} tableName={tableName} />
</div>
);
......@@ -104,10 +107,10 @@ export class TableIssues extends React.Component<TableIssueProps> {
className="table-issue-more-issues"
target="_blank"
rel="noreferrer"
href={this.props.allIssuesUrl}
href={allIssuesUrl}
onClick={logClick}
>
View all {this.props.total} issues
View all {total} issues
</a>
|{reportIssueLink}
</span>
......@@ -115,7 +118,9 @@ export class TableIssues extends React.Component<TableIssueProps> {
};
render() {
if (this.props.isLoading) {
const { isLoading } = this.props;
if (isLoading) {
return (
<>
{this.renderIssueTitle()}
......
......@@ -131,26 +131,29 @@ export class TableDetail extends React.Component<
};
componentDidMount() {
const { index, source } = getLoggingParams(this.props.location.search);
const { location, getTableData } = this.props;
const { index, source } = getLoggingParams(location.search);
this.key = this.getTableKey();
this.props.getTableData(this.key, index, source);
getTableData(this.key, index, source);
this.didComponentMount = true;
}
componentDidUpdate() {
const { location, getTableData } = this.props;
const newKey = this.getTableKey();
if (this.key !== newKey) {
const { index, source } = getLoggingParams(this.props.location.search);
const { index, source } = getLoggingParams(location.search);
this.key = newKey;
this.props.getTableData(this.key, index, source);
getTableData(this.key, index, source);
}
}
getDisplayName() {
const { params } = this.props.match;
const { match } = this.props;
const { params } = match;
return `${params.schema}.${params.table}`;
}
......@@ -161,7 +164,8 @@ export class TableDetail extends React.Component<
we can't pass it as a single URL parameter without encodeURIComponent which makes ugly URLs.
DO NOT CHANGE
*/
const { params } = this.props.match;
const { match } = this.props;
const { params } = match;
return `${params.database}://${params.cluster}.${params.schema}/${params.table}`;
}
......@@ -367,7 +371,7 @@ export class TableDetail extends React.Component<
<EditableSection title={Constants.TAG_TITLE}>
<TagInput
resourceType={ResourceType.table}
uriKey={this.props.tableData.key}
uriKey={tableData.key}
/>
</EditableSection>
{this.renderProgrammaticDesc(
......
......@@ -71,9 +71,9 @@
"@types/react-tagsinput": "^3.19.7",
"@types/storybook__addon-knobs": "^5.2.1",
"@types/webpack": "^4.41.22",
"@typescript-eslint/eslint-plugin": "^3.9.0",
"@typescript-eslint/eslint-plugin-tslint": "^3.1.0",
"@typescript-eslint/parser": "^3.1.0",
"@typescript-eslint/eslint-plugin": "4.5.0",
"@typescript-eslint/eslint-plugin-tslint": "4.5.0",
"@typescript-eslint/parser": "4.5.0",
"anysort": "^2.0.0",
"babel-jest": "^26.3.0",
"babel-loader": "^8.1.0",
......@@ -84,7 +84,7 @@
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.6.1",
"eslint": "^7.2.0",
"eslint": "^7.11.0",
"eslint-config-airbnb-typescript": "^8.0.2",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.1",
......@@ -379,7 +379,8 @@
"no-restricted-properties": "off",
"no-restricted-syntax": "off",
"no-script-url": "warn",
"no-shadow": "warn",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "warn",
"no-undef": "off",
"no-underscore-dangle": "error",
"no-unneeded-ternary": "warn",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment