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`] = { ...@@ -290,13 +290,13 @@ exports[`strict null compilation`] = {
"js/pages/SearchPage/SearchFilter/FilterSection/index.tsx:2128122504": [ "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"] [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": [ "js/pages/SearchPage/SearchFilter/index.spec.tsx:2944458990": [
[234, 23, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'FilterConfig\'.", "2620553983"] [232, 23, 9, "Argument of type \'undefined\' is not assignable to parameter of type \'FilterConfig\'.", "2620553983"]
], ],
"js/pages/SearchPage/SearchFilter/index.tsx:2139967954": [ "js/pages/SearchPage/SearchFilter/index.tsx:1113311229": [
[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"], [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"],
[84, 26, 7, "Argument of type \'{ categoryId: string; helpText: string | undefined; title: string; type: FilterType; }\' is not assignable to parameter of type \'never\'.", "2519086860"], [86, 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"] [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": [ "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"], [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`] = { ...@@ -332,10 +332,10 @@ exports[`strict null compilation`] = {
"js/pages/TableDetailPage/index.spec.tsx:120018363": [ "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"] [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": [ "js/pages/TableDetailPage/index.tsx:3727993506": [
[181, 10, 13, "Type \'null\' is not assignable to type \'((newValue: string, onSuccess?: (() => any) | undefined, onFailure?: (() => any) | undefined) => void) | undefined\'.", "67794331"], [185, 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"], [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"],
[325, 16, 7, "Type \'string | null\' is not assignable to type \'string | undefined\'.\\n Type \'null\' is not assignable to type \'string | undefined\'.", "3817619378"] [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": [ "js/utils/navigationUtils.ts:1127210474": [
[19, 50, 21, "Type \'undefined\' cannot be used as an index type.", "602535635"] [19, 50, 21, "Type \'undefined\' cannot be used as an index type.", "602535635"]
......
...@@ -16,7 +16,7 @@ import { ...@@ -16,7 +16,7 @@ import {
mapStateToProps, mapStateToProps,
SearchFilter, SearchFilter,
SearchFilterProps, SearchFilterProps,
FilterSection, FilterSectionItem,
CheckboxFilterSection, CheckboxFilterSection,
} from '.'; } from '.';
...@@ -52,7 +52,7 @@ describe('SearchFilter', () => { ...@@ -52,7 +52,7 @@ describe('SearchFilter', () => {
let wrapper; let wrapper;
let content; let content;
let mockCheckboxFilterData: CheckboxFilterSection; let mockCheckboxFilterData: CheckboxFilterSection;
let mockInputFilterData: FilterSection; let mockInputFilterData: FilterSectionItem;
beforeAll(() => { beforeAll(() => {
const setupResult = setup(); const setupResult = setup();
props = setupResult.props; props = setupResult.props;
...@@ -127,13 +127,11 @@ describe('SearchFilter', () => { ...@@ -127,13 +127,11 @@ describe('SearchFilter', () => {
}); });
describe('render', () => { describe('render', () => {
let props;
let wrapper; let wrapper;
let renderFilterSectionsSpy; let renderFilterSectionsSpy;
beforeAll(() => { beforeAll(() => {
const setupResult = setup(); const setupResult = setup();
props = setupResult.props;
wrapper = setupResult.wrapper; wrapper = setupResult.wrapper;
renderFilterSectionsSpy = jest.spyOn( renderFilterSectionsSpy = jest.spyOn(
wrapper.instance(), wrapper.instance(),
......
...@@ -7,25 +7,25 @@ import { connect } from 'react-redux'; ...@@ -7,25 +7,25 @@ import { connect } from 'react-redux';
import { GlobalState } from 'ducks/rootReducer'; import { GlobalState } from 'ducks/rootReducer';
import { getFilterConfigByResource } from 'config/config-utils'; import { getFilterConfigByResource } from 'config/config-utils';
import { FilterType, ResourceType } from 'interfaces'; import { FilterType } from 'interfaces';
import { CheckboxFilterProperties } from './CheckBoxFilter'; import { CheckboxFilterProperties } from './CheckBoxFilter';
import FilterSection from './FilterSection'; import FilterSection from './FilterSection';
import './styles.scss'; import './styles.scss';
export interface FilterSection { export interface FilterSectionItem {
categoryId: string; categoryId: string;
helpText?: string; helpText?: string;
title: string; title: string;
type: FilterType; type: FilterType;
} }
export interface CheckboxFilterSection extends FilterSection { export interface CheckboxFilterSection extends FilterSectionItem {
options: CheckboxFilterProperties[]; options: CheckboxFilterProperties[];
} }
export interface StateFromProps { export interface StateFromProps {
filterSections: FilterSection[]; filterSections: FilterSectionItem[];
} }
export type SearchFilterProps = StateFromProps; export type SearchFilterProps = StateFromProps;
...@@ -33,7 +33,7 @@ export type SearchFilterProps = StateFromProps; ...@@ -33,7 +33,7 @@ export type SearchFilterProps = StateFromProps;
export class SearchFilter extends React.Component<SearchFilterProps> { export class SearchFilter extends React.Component<SearchFilterProps> {
createFilterSection = ( createFilterSection = (
key: string, key: string,
section: FilterSection | CheckboxFilterSection section: FilterSectionItem | CheckboxFilterSection
) => { ) => {
const { categoryId, helpText, title, type } = section; const { categoryId, helpText, title, type } = section;
const options = (section as CheckboxFilterSection).options const options = (section as CheckboxFilterSection).options
...@@ -52,7 +52,9 @@ export class SearchFilter extends React.Component<SearchFilterProps> { ...@@ -52,7 +52,9 @@ export class SearchFilter extends React.Component<SearchFilterProps> {
}; };
renderFilterSections = () => { renderFilterSections = () => {
return this.props.filterSections.map((section) => const { filterSections } = this.props;
return filterSections.map((section) =>
this.createFilterSection(`section:${section.categoryId}`, section) this.createFilterSection(`section:${section.categoryId}`, section)
); );
}; };
...@@ -65,8 +67,8 @@ export class SearchFilter extends React.Component<SearchFilterProps> { ...@@ -65,8 +67,8 @@ export class SearchFilter extends React.Component<SearchFilterProps> {
export const mapStateToProps = (state: GlobalState) => { export const mapStateToProps = (state: GlobalState) => {
const resourceType = state.search.resource; const resourceType = state.search.resource;
const filterCategories = getFilterConfigByResource(resourceType); const filterCategories = getFilterConfigByResource(resourceType);
const filterSections = []; const filterSections = [];
if (filterCategories) { if (filterCategories) {
filterCategories.forEach((categoryConfig) => { filterCategories.forEach((categoryConfig) => {
const section = { const section = {
......
...@@ -45,7 +45,9 @@ const ShimmeringIssuesLoader: React.FC = () => { ...@@ -45,7 +45,9 @@ const ShimmeringIssuesLoader: React.FC = () => {
export class TableIssues extends React.Component<TableIssueProps> { export class TableIssues extends React.Component<TableIssueProps> {
componentDidMount() { componentDidMount() {
this.props.getIssues(this.props.tableKey); const { getIssues, tableKey } = this.props;
getIssues(tableKey);
} }
renderIssue = (issue: Issue, index: number) => { renderIssue = (issue: Issue, index: number) => {
...@@ -77,20 +79,21 @@ export class TableIssues extends React.Component<TableIssueProps> { ...@@ -77,20 +79,21 @@ export class TableIssues extends React.Component<TableIssueProps> {
}; };
renderIssueContent = () => { 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 <div className="issue-banner">{NO_DATA_ISSUES_TEXT}</div>;
} }
return this.props.issues.map(this.renderIssue); return issues.map(this.renderIssue);
}; };
renderIssueFooter = () => { renderIssueFooter = () => {
const hasIssues = this.props.issues.length !== 0; const { issues, tableKey, tableName, allIssuesUrl, total } = this.props;
const hasIssues = issues.length !== 0;
const reportIssueLink = ( const reportIssueLink = (
<div className={`table-report-new-issue ${hasIssues ? 'ml-1' : ''}`}> <div className={`table-report-new-issue ${hasIssues ? 'ml-1' : ''}`}>
<ReportTableIssue <ReportTableIssue tableKey={tableKey} tableName={tableName} />
tableKey={this.props.tableKey}
tableName={this.props.tableName}
/>
</div> </div>
); );
...@@ -104,10 +107,10 @@ export class TableIssues extends React.Component<TableIssueProps> { ...@@ -104,10 +107,10 @@ export class TableIssues extends React.Component<TableIssueProps> {
className="table-issue-more-issues" className="table-issue-more-issues"
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
href={this.props.allIssuesUrl} href={allIssuesUrl}
onClick={logClick} onClick={logClick}
> >
View all {this.props.total} issues View all {total} issues
</a> </a>
|{reportIssueLink} |{reportIssueLink}
</span> </span>
...@@ -115,7 +118,9 @@ export class TableIssues extends React.Component<TableIssueProps> { ...@@ -115,7 +118,9 @@ export class TableIssues extends React.Component<TableIssueProps> {
}; };
render() { render() {
if (this.props.isLoading) { const { isLoading } = this.props;
if (isLoading) {
return ( return (
<> <>
{this.renderIssueTitle()} {this.renderIssueTitle()}
......
...@@ -131,26 +131,29 @@ export class TableDetail extends React.Component< ...@@ -131,26 +131,29 @@ export class TableDetail extends React.Component<
}; };
componentDidMount() { 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.key = this.getTableKey();
this.props.getTableData(this.key, index, source); getTableData(this.key, index, source);
this.didComponentMount = true; this.didComponentMount = true;
} }
componentDidUpdate() { componentDidUpdate() {
const { location, getTableData } = this.props;
const newKey = this.getTableKey(); const newKey = this.getTableKey();
if (this.key !== newKey) { if (this.key !== newKey) {
const { index, source } = getLoggingParams(this.props.location.search); const { index, source } = getLoggingParams(location.search);
this.key = newKey; this.key = newKey;
this.props.getTableData(this.key, index, source); getTableData(this.key, index, source);
} }
} }
getDisplayName() { getDisplayName() {
const { params } = this.props.match; const { match } = this.props;
const { params } = match;
return `${params.schema}.${params.table}`; return `${params.schema}.${params.table}`;
} }
...@@ -161,7 +164,8 @@ export class TableDetail extends React.Component< ...@@ -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. we can't pass it as a single URL parameter without encodeURIComponent which makes ugly URLs.
DO NOT CHANGE DO NOT CHANGE
*/ */
const { params } = this.props.match; const { match } = this.props;
const { params } = match;
return `${params.database}://${params.cluster}.${params.schema}/${params.table}`; return `${params.database}://${params.cluster}.${params.schema}/${params.table}`;
} }
...@@ -367,7 +371,7 @@ export class TableDetail extends React.Component< ...@@ -367,7 +371,7 @@ export class TableDetail extends React.Component<
<EditableSection title={Constants.TAG_TITLE}> <EditableSection title={Constants.TAG_TITLE}>
<TagInput <TagInput
resourceType={ResourceType.table} resourceType={ResourceType.table}
uriKey={this.props.tableData.key} uriKey={tableData.key}
/> />
</EditableSection> </EditableSection>
{this.renderProgrammaticDesc( {this.renderProgrammaticDesc(
......
...@@ -71,9 +71,9 @@ ...@@ -71,9 +71,9 @@
"@types/react-tagsinput": "^3.19.7", "@types/react-tagsinput": "^3.19.7",
"@types/storybook__addon-knobs": "^5.2.1", "@types/storybook__addon-knobs": "^5.2.1",
"@types/webpack": "^4.41.22", "@types/webpack": "^4.41.22",
"@typescript-eslint/eslint-plugin": "^3.9.0", "@typescript-eslint/eslint-plugin": "4.5.0",
"@typescript-eslint/eslint-plugin-tslint": "^3.1.0", "@typescript-eslint/eslint-plugin-tslint": "4.5.0",
"@typescript-eslint/parser": "^3.1.0", "@typescript-eslint/parser": "4.5.0",
"anysort": "^2.0.0", "anysort": "^2.0.0",
"babel-jest": "^26.3.0", "babel-jest": "^26.3.0",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5", "enzyme-adapter-react-16": "^1.15.5",
"enzyme-to-json": "^3.6.1", "enzyme-to-json": "^3.6.1",
"eslint": "^7.2.0", "eslint": "^7.11.0",
"eslint-config-airbnb-typescript": "^8.0.2", "eslint-config-airbnb-typescript": "^8.0.2",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.1", "eslint-plugin-import": "^2.21.1",
...@@ -379,7 +379,8 @@ ...@@ -379,7 +379,8 @@
"no-restricted-properties": "off", "no-restricted-properties": "off",
"no-restricted-syntax": "off", "no-restricted-syntax": "off",
"no-script-url": "warn", "no-script-url": "warn",
"no-shadow": "warn", "no-shadow": "off",
"@typescript-eslint/no-shadow": "warn",
"no-undef": "off", "no-undef": "off",
"no-underscore-dangle": "error", "no-underscore-dangle": "error",
"no-unneeded-ternary": "warn", "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