Skip to content

Commit

Permalink
chore: ran eslint
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Iglesias <[email protected]>
  • Loading branch information
Golodhros committed Oct 31, 2022
1 parent c03478f commit 75b38ea
Show file tree
Hide file tree
Showing 34 changed files with 191 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ const AnnouncementsList: React.FC<AnnouncementsListProps> = ({
listContent = [<EmptyAnnouncementItem />];
}
if (announcements.length > 0) {
listContent = getLatestsAnnouncements(
announcements
).map(({ date, title, html_content }) => (
<AnnouncementItem
key={`key:${date}`}
date={date}
title={title}
html_content={html_content}
/>
));
listContent = getLatestsAnnouncements(announcements).map(
({ date, title, html_content }) => (
<AnnouncementItem
key={`key:${date}`}
date={date}
title={title}
html_content={html_content}
/>
)
);
}
if (hasError) {
listContent = [<AnnouncementErrorItem />];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,20 @@ import InfoButton from '.';
export const InfoButtonStory = () => (
<>
<StorySection title="Info Button">
<InfoButton
infoText={'Some info text to share'}
title={'Popover Title'}
/>
<InfoButton infoText="Some info text to share" title="Popover Title" />
</StorySection>
<StorySection title="Info Button to left">
<InfoButton
infoText={'Some info text to share'}
title={'Popover Title'}
placement={'left'}
infoText="Some info text to share"
title="Popover Title"
placement="left"
/>
</StorySection>
<StorySection title="Info Button small size">
<InfoButton
infoText={'Some info text to share'}
title={'Popover Title'}
placement={'left'}
infoText="Some info text to share"
title="Popover Title"
placement="left"
size={IconSizes.SMALL}
/>
</StorySection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ import {
export const SVGIcons = () => (
<>
<StorySection title="Alert">
<AlertIcon stroke={'currentColor'} />
<AlertIcon stroke="currentColor" />
</StorySection>
<StorySection title="Down">
<DownIcon fill={'#9191A8'} />
<DownIcon fill="#9191A8" />
</StorySection>
<StorySection title="Up">
<UpIcon fill={'#9191A8'} />
<UpIcon fill="#9191A8" />
</StorySection>
<StorySection title="Right">
<RightIcon fill={'#9191A8'} />
<RightIcon fill="#9191A8" />
</StorySection>
<StorySection title="Left">
<LeftIcon fill={'#9191A8'} />
<LeftIcon fill="#9191A8" />
</StorySection>
<StorySection title="Information">
<InformationIcon fill={'#9191A8'} />
<InformationIcon fill="#9191A8" />
</StorySection>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,8 @@ describe('ResultItemList', () => {
.renderResultItems(props.suggestedResults);
const expectedOnItemSelect = props.onItemSelect(props.resourceType);
listItems.forEach((item, index) => {
const {
href,
iconClass,
subtitle,
titleNode,
type,
} = props.suggestedResults[index];
const { href, iconClass, subtitle, titleNode, type } =
props.suggestedResults[index];
expect(item.props.href).toBe(href);
expect(item.props.onItemSelect()).toBe(expectedOnItemSelect);
expect(item.props.iconClass).toBe(`icon icon-dark ${iconClass}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,8 @@ export class SearchItem extends React.Component<SearchItemProps, {}> {
}

export const mapStateToProps = (state: GlobalState, ownProps: OwnProps) => {
const {
isLoading,
dashboards,
features,
tables,
users,
} = state.search.inlineResults;
const { isLoading, dashboards, features, tables, users } =
state.search.inlineResults;
let hasResults = false;
switch (ownProps.resourceType) {
case ResourceType.dashboard:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,8 @@ export class InlineSearchResults extends React.Component<
}

export const mapStateToProps = (state: GlobalState) => {
const {
isLoading,
dashboards,
features,
tables,
users,
} = state.search.inlineResults;
const { isLoading, dashboards, features, tables, users } =
state.search.inlineResults;
return {
isLoading,
dashboards,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe('InlineSearchResults', () => {
const setup = (propOverrides?: Partial<InlineSearchResultsProps>) => {
const props: InlineSearchResultsProps = {
isLoading: false,
dashboards: allResourcesExample.dashboards as SearchResults<DashboardResource>,
dashboards:
allResourcesExample.dashboards as SearchResults<DashboardResource>,
features: allResourcesExample.features as SearchResults<FeatureResource>,
tables: allResourcesExample.tables as SearchResults<TableResource>,
users: allResourcesExample.users as SearchResults<UserResource>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ describe('Table', () => {
it('renders nine cells', () => {
const { wrapper } = setup();
const expected = 9;
const actual = wrapper.find('.ams-table-row .ams-table-cell')
.length;
const actual = wrapper.find(
'.ams-table-row .ams-table-cell'
).length;

expect(actual).toEqual(expected);
});
Expand Down Expand Up @@ -204,8 +205,9 @@ describe('Table', () => {
it('renders twelve cells', () => {
const { wrapper } = setup({ columns, data });
const expected = 12;
const actual = wrapper.find('.ams-table-row .ams-table-cell')
.length;
const actual = wrapper.find(
'.ams-table-row .ams-table-cell'
).length;

expect(actual).toEqual(expected);
});
Expand All @@ -221,8 +223,9 @@ describe('Table', () => {
data,
columns,
});
const expected = data.filter((item) => item.isExpandable === true)
.length;
const expected = data.filter(
(item) => item.isExpandable === true
).length;
const actual = wrapper.find(
'.ams-table-body .ams-table-expanding-button'
).length;
Expand All @@ -237,8 +240,9 @@ describe('Table', () => {
columns,
});
const expected = data.length;
const actual = wrapper.find('.ams-table-body .ams-table-row')
.length;
const actual = wrapper.find(
'.ams-table-body .ams-table-row'
).length;

expect(actual).toEqual(expected);
});
Expand Down Expand Up @@ -420,10 +424,9 @@ describe('Table', () => {

describe('when components are passed', () => {
describe('when one component', () => {
const {
columns,
data,
} = dataBuilder.withOneComponentColumn().build();
const { columns, data } = dataBuilder
.withOneComponentColumn()
.build();

describe('table body', () => {
it('renders the first column as a component wrapped value', () => {
Expand All @@ -442,10 +445,9 @@ describe('Table', () => {
});

describe('when multiple components per cell', () => {
const {
columns,
data,
} = dataBuilder.withMultipleComponentsColumn().build();
const { columns, data } = dataBuilder
.withMultipleComponentsColumn()
.build();

describe('table body', () => {
it('renders the first column as a component wrapped value', () => {
Expand Down Expand Up @@ -630,10 +632,9 @@ describe('Table', () => {
});

describe('when onRowClick is passed', () => {
const {
columns,
data,
} = new TestDataBuilder().withFourColumns().build();
const { columns, data } = new TestDataBuilder()
.withFourColumns()
.build();

describe('when clicking on row', () => {
it('calls the onRowClick handler', () => {
Expand Down Expand Up @@ -871,8 +872,9 @@ describe('Table', () => {
});

const expected = data.length;
const actual = wrapper.find('.ams-table-body .ams-table-row')
.length;
const actual = wrapper.find(
'.ams-table-body .ams-table-row'
).length;

expect(actual).toEqual(expected);
});
Expand Down Expand Up @@ -1010,8 +1012,8 @@ describe('Table', () => {
});

const mockToggleExpandingRows = jest.fn().mockImplementation(() => {
const currentShouldExpandAllRows = wrapper.props().options
?.shouldExpandAllRows;
const currentShouldExpandAllRows =
wrapper.props().options?.shouldExpandAllRows;

wrapper.setProps({
options: {
Expand Down Expand Up @@ -1059,8 +1061,8 @@ describe('Table', () => {
});

const mockToggleExpandingRows = jest.fn().mockImplementation(() => {
const currentShouldExpandAllRows = wrapper.props().options
?.shouldExpandAllRows;
const currentShouldExpandAllRows =
wrapper.props().options?.shouldExpandAllRows;

wrapper.setProps({
options: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,11 +723,8 @@ const getTableRows = (tableRowDetails: TableRowDetails) => {
expandedRows.includes(item.key) &&
formatChildrenData
) {
const {
rowValuesToDisplay,
formattedChildren,
arrayCount,
} = handleSpecificTypeRowData(item, formatChildrenData);
const { rowValuesToDisplay, formattedChildren, arrayCount } =
handleSpecificTypeRowData(item, formatChildrenData);

const additionalTableColCount = columns.length - 1;
const openerRow = getSpecificTypeOpenerRow(
Expand Down Expand Up @@ -781,9 +778,8 @@ const useTableHooks = ({
[preExpandPanelKey]
);

const [expandedRows, setExpandedRows] = React.useState<RowKey[]>(
initialExpandedRows
);
const [expandedRows, setExpandedRows] =
React.useState<RowKey[]>(initialExpandedRows);

React.useEffect(() => {
expandOrCollapseAllRows({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,25 @@ import TestDataBuilder from './testDataBuilder';

const dataBuilder = new TestDataBuilder();
const { columns, data } = dataBuilder.build();
const {
columns: alignedColumns,
data: alignedData,
} = dataBuilder.withAlignedColumns().build();
const {
columns: differentWidthColumns,
} = dataBuilder.withFixedWidthColumns().build();
const {
columns: fourColumns,
data: fourColData,
} = dataBuilder.withFourColumns().build();
const {
columns: customColumns,
data: customColumnsData,
} = dataBuilder.withOneComponentColumn().build();
const {
columns: multipleCustomColumns,
data: multipleCustomComlumnsData,
} = dataBuilder.withMultipleComponentsColumn().build();
const {
columns: columnsWithAction,
data: dataWithAction,
} = dataBuilder.withActionCell().build();
const {
columns: columnsWithCollapsedRow,
data: dataWithCollapsedRow,
} = dataBuilder.withCollapsedRow().build();
const { columns: alignedColumns, data: alignedData } = dataBuilder
.withAlignedColumns()
.build();
const { columns: differentWidthColumns } = dataBuilder
.withFixedWidthColumns()
.build();
const { columns: fourColumns, data: fourColData } = dataBuilder
.withFourColumns()
.build();
const { columns: customColumns, data: customColumnsData } = dataBuilder
.withOneComponentColumn()
.build();
const { columns: multipleCustomColumns, data: multipleCustomComlumnsData } =
dataBuilder.withMultipleComponentsColumn().build();
const { columns: columnsWithAction, data: dataWithAction } = dataBuilder
.withActionCell()
.build();
const { columns: columnsWithCollapsedRow, data: dataWithCollapsedRow } =
dataBuilder.withCollapsedRow().build();
const expandRowComponent = (rowValue, index) => (
<strong>
{index}:{rowValue.value}
Expand Down
Loading

0 comments on commit 75b38ea

Please sign in to comment.