}>
+
)}>
{radios}
);
diff --git a/src/components/form/range/dual_range.test.tsx b/src/components/form/range/dual_range.test.tsx
index 45aef2b69eb..346e170be09 100644
--- a/src/components/form/range/dual_range.test.tsx
+++ b/src/components/form/range/dual_range.test.tsx
@@ -98,7 +98,10 @@ describe('EuiDualRange', () => {
{...props}
value={[20, 100]}
showTicks
- ticks={[{ label: '20kb', value: 20 }, { label: '100kb', value: 100 }]}
+ ticks={[
+ { label: '20kb', value: 20 },
+ { label: '100kb', value: 100 },
+ ]}
/>
);
diff --git a/src/components/form/range/range.test.tsx b/src/components/form/range/range.test.tsx
index 41d617d3e45..e526f9bb546 100644
--- a/src/components/form/range/range.test.tsx
+++ b/src/components/form/range/range.test.tsx
@@ -84,7 +84,10 @@ describe('EuiRange', () => {
);
diff --git a/src/components/form/range/range_thumb.tsx b/src/components/form/range/range_thumb.tsx
index 3ea95d375de..76afdfa7371 100644
--- a/src/components/form/range/range_thumb.tsx
+++ b/src/components/form/range/range_thumb.tsx
@@ -74,9 +74,9 @@ export const EuiRangeThumb: FunctionComponent
= ({
onMouseDown={onMouseDown}
disabled={disabled}
{...commonAttrs}
- {...rest as HTMLAttributes}
+ {...(rest as HTMLAttributes)}
/>
) : (
- } />
+
)} />
);
};
diff --git a/src/components/form/range/range_ticks.tsx b/src/components/form/range/range_ticks.tsx
index 0e744fed466..eb963f3e5cc 100644
--- a/src/components/form/range/range_ticks.tsx
+++ b/src/components/form/range/range_ticks.tsx
@@ -47,9 +47,10 @@ export type EuiRangeTicksProps = Omit<
onChange?: MouseEventHandler
;
};
-const EuiTickValue: FunctionComponent<
- EuiRangeTicksProps & { tickValue: any; percentageWidth: number }
-> = ({
+const EuiTickValue: FunctionComponent = ({
disabled,
ticks,
min,
diff --git a/src/components/form/range/range_track.tsx b/src/components/form/range/range_track.tsx
index d9c7934bda0..59bc8141e3e 100644
--- a/src/components/form/range/range_track.tsx
+++ b/src/components/form/range/range_track.tsx
@@ -47,16 +47,12 @@ export class EuiRangeTrack extends Component {
validateValueIsInStep = (value: number) => {
if (value < this.props.min) {
throw new Error(
- `The value of ${value} is lower than the min value of ${
- this.props.min
- }.`
+ `The value of ${value} is lower than the min value of ${this.props.min}.`
);
}
if (value > this.props.max) {
throw new Error(
- `The value of ${value} is higher than the max value of ${
- this.props.max
- }.`
+ `The value of ${value} is higher than the max value of ${this.props.max}.`
);
}
// Error out if the value doesn't line up with the sequence of steps
@@ -67,9 +63,7 @@ export class EuiRangeTrack extends Component {
)
) {
throw new Error(
- `The value of ${value} is not included in the possible sequence provided by the step of ${
- this.props.step
- }.`
+ `The value of ${value} is not included in the possible sequence provided by the step of ${this.props.step}.`
);
}
// Return the value if nothing fails
@@ -116,9 +110,7 @@ export class EuiRangeTrack extends Component {
// Error out if there are too many ticks to render
if (ticks.length > 20) {
throw new Error(
- `The number of ticks to render is too high (${
- ticks.length
- }), reduce the interval.`
+ `The number of ticks to render is too high (${ticks.length}), reduce the interval.`
);
}
diff --git a/src/components/header/header_links/header_link.tsx b/src/components/header/header_links/header_link.tsx
index 882d27d0ec3..72a0effb5d3 100644
--- a/src/components/header/header_links/header_link.tsx
+++ b/src/components/header/header_links/header_link.tsx
@@ -47,5 +47,5 @@ export const EuiHeaderLink: FunctionComponent = ({
color: isActive ? 'primary' : 'text',
};
- return ;
+ return ;
};
diff --git a/src/components/header/header_section/header_section_item.tsx b/src/components/header/header_section/header_section_item.tsx
index ee4cb3ed62b..63195b57e35 100644
--- a/src/components/header/header_section/header_section_item.tsx
+++ b/src/components/header/header_section/header_section_item.tsx
@@ -39,9 +39,12 @@ export type EuiHeaderSectionItemProps = CommonProps & {
children?: ReactNode;
};
-export const EuiHeaderSectionItem: FunctionComponent<
- EuiHeaderSectionItemProps
-> = ({ border = 'left', children, className, ...rest }) => {
+export const EuiHeaderSectionItem: FunctionComponent = ({
+ border = 'left',
+ children,
+ className,
+ ...rest
+}) => {
const classes = classNames(
'euiHeaderSectionItem',
borderToClassNameMap[border],
diff --git a/src/components/horizontal_rule/horizontal_rule.tsx b/src/components/horizontal_rule/horizontal_rule.tsx
index 2ca681e17b3..c9bf997db9b 100644
--- a/src/components/horizontal_rule/horizontal_rule.tsx
+++ b/src/components/horizontal_rule/horizontal_rule.tsx
@@ -53,9 +53,14 @@ const marginToClassNameMap = {
export const MARGINS = Object.keys(marginToClassNameMap);
-export const EuiHorizontalRule: FunctionComponent<
- CommonProps & HTMLAttributes & EuiHorizontalRuleProps
-> = ({ className, size = 'full', margin = 'l', ...rest }) => {
+export const EuiHorizontalRule: FunctionComponent &
+ EuiHorizontalRuleProps> = ({
+ className,
+ size = 'full',
+ margin = 'l',
+ ...rest
+}) => {
const classes = classNames(
'euiHorizontalRule',
sizeToClassNameMap[size],
diff --git a/src/components/i18n/i18n.tsx b/src/components/i18n/i18n.tsx
index 6f705cc86d7..1527a4c53cc 100644
--- a/src/components/i18n/i18n.tsx
+++ b/src/components/i18n/i18n.tsx
@@ -150,7 +150,9 @@ const EuiI18n = <
// A single default could be a string, react child, or render function
type DefaultRenderType> = K extends ReactChild
? K
- : (K extends () => infer RetValue ? RetValue : never);
+ : K extends () => infer RetValue
+ ? RetValue
+ : never;
// An array with multiple defaults can only be an array of strings or elements
type DefaultsRenderType<
diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx
index 1e1391a263d..f43cef72e71 100644
--- a/src/components/icon/icon.tsx
+++ b/src/components/icon/icon.tsx
@@ -706,7 +706,7 @@ export class EuiIcon extends PureComponent {
src={icon}
className={classes}
tabIndex={tabIndex}
- {...rest as HTMLAttributes}
+ {...(rest as HTMLAttributes)}
/>
);
} else {
diff --git a/src/components/inner_text/inner_text.tsx b/src/components/inner_text/inner_text.tsx
index 33bd4a02b07..982c180805a 100644
--- a/src/components/inner_text/inner_text.tsx
+++ b/src/components/inner_text/inner_text.tsx
@@ -29,7 +29,7 @@ type RefT = HTMLElement | Element | undefined | null;
export function useInnerText(
innerTextFallback?: string
-): [((node: RefT) => void), string | undefined] {
+): [(node: RefT) => void, string | undefined] {
const [ref, setRef] = useState(null);
const [innerText, setInnerText] = useState(innerTextFallback);
diff --git a/src/components/key_pad_menu/key_pad_menu_item.tsx b/src/components/key_pad_menu/key_pad_menu_item.tsx
index fb57e697042..403a055e88e 100644
--- a/src/components/key_pad_menu/key_pad_menu_item.tsx
+++ b/src/components/key_pad_menu/key_pad_menu_item.tsx
@@ -133,8 +133,8 @@ export const EuiKeyPadMenuItem: FunctionComponent = ({
return (
}
- {...rest as HTMLAttributes}>
+ {...(relObj as HTMLAttributes)}
+ {...(rest as HTMLAttributes)}>
{renderContent(
children,
label,
diff --git a/src/components/link/link.tsx b/src/components/link/link.tsx
index e3a4276d09e..4298f0fe8fe 100644
--- a/src/components/link/link.tsx
+++ b/src/components/link/link.tsx
@@ -131,7 +131,7 @@ const EuiLink = React.forwardRef<
return (
);
@@ -150,7 +150,7 @@ const EuiLink = React.forwardRef<
return (
}
- {...anchorProps as EuiLinkAnchorProps}>
+ {...(anchorProps as EuiLinkAnchorProps)}>
{children}
{externalLinkIcon}
diff --git a/src/components/list_group/list_group_item.tsx b/src/components/list_group/list_group_item.tsx
index 6a838ac8839..3176a7ad064 100644
--- a/src/components/list_group/list_group_item.tsx
+++ b/src/components/list_group/list_group_item.tsx
@@ -241,7 +241,7 @@ export const EuiListGroupItem: FunctionComponent = ({
target={target}
rel={secureRel}
onClick={onClick as AnchorHTMLAttributes['onClick']}
- {...rest as AnchorHTMLAttributes}>
+ {...(rest as AnchorHTMLAttributes)}>
{iconNode}
{labelContent}
@@ -254,7 +254,7 @@ export const EuiListGroupItem: FunctionComponent = ({
disabled={isDisabled}
onClick={onClick}
ref={buttonRef}
- {...rest as ButtonHTMLAttributes}>
+ {...(rest as ButtonHTMLAttributes)}>
{iconNode}
{labelContent}
diff --git a/src/components/list_group/pinnable_list_group/pinnable_list_group.tsx b/src/components/list_group/pinnable_list_group/pinnable_list_group.tsx
index 5ea51da53bd..18e3a78bae8 100644
--- a/src/components/list_group/pinnable_list_group/pinnable_list_group.tsx
+++ b/src/components/list_group/pinnable_list_group/pinnable_list_group.tsx
@@ -80,9 +80,14 @@ export interface EuiPinnableListGroupProps
unpinTitle?: (item: EuiPinnableListGroupItemProps) => string;
}
-export const EuiPinnableListGroup: FunctionComponent<
- EuiPinnableListGroupProps
-> = ({ className, listItems, pinTitle, unpinTitle, onPinClick, ...rest }) => {
+export const EuiPinnableListGroup: FunctionComponent = ({
+ className,
+ listItems,
+ pinTitle,
+ unpinTitle,
+ onPinClick,
+ ...rest
+}) => {
const classes = classNames('euiPinnableListGroup', className);
// Alter listItems object with extra props
diff --git a/src/components/loading/loading_chart.tsx b/src/components/loading/loading_chart.tsx
index 26794657c18..ab564ea56c0 100644
--- a/src/components/loading/loading_chart.tsx
+++ b/src/components/loading/loading_chart.tsx
@@ -31,16 +31,14 @@ export const SIZES = keysOf(sizeToClassNameMap);
export type EuiLoadingChartSize = keyof typeof sizeToClassNameMap;
-export const EuiLoadingChart: FunctionComponent<
- CommonProps &
- HTMLAttributes & {
- /**
- * Makes the loader animation black and white
- */
- mono?: boolean;
- size?: EuiLoadingChartSize;
- }
-> = ({ size = 'm', mono = false, className, ...rest }) => {
+export const EuiLoadingChart: FunctionComponent & {
+ /**
+ * Makes the loader animation black and white
+ */
+ mono?: boolean;
+ size?: EuiLoadingChartSize;
+ }> = ({ size = 'm', mono = false, className, ...rest }) => {
const classes = classNames(
'euiLoadingChart',
{ 'euiLoadingChart--mono': mono },
diff --git a/src/components/loading/loading_content.tsx b/src/components/loading/loading_content.tsx
index dfce122fe90..45657573a20 100644
--- a/src/components/loading/loading_content.tsx
+++ b/src/components/loading/loading_content.tsx
@@ -23,12 +23,10 @@ import { CommonProps } from '../common';
export type LineRange = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
-export const EuiLoadingContent: FunctionComponent<
- CommonProps &
- HTMLAttributes & {
- lines?: LineRange;
- }
-> = ({ lines = 3, className, ...rest }) => {
+export const EuiLoadingContent: FunctionComponent & {
+ lines?: LineRange;
+ }> = ({ lines = 3, className, ...rest }) => {
const classes = classNames('euiLoadingContent', className);
const lineElements = [];
diff --git a/src/components/loading/loading_elastic.tsx b/src/components/loading/loading_elastic.tsx
index 78b8632e8b0..9a817112faa 100644
--- a/src/components/loading/loading_elastic.tsx
+++ b/src/components/loading/loading_elastic.tsx
@@ -35,9 +35,9 @@ export interface EuiLoadingElasticProps {
size?: keyof typeof sizeToClassNameMap;
}
-export const EuiLoadingElastic: FunctionComponent<
- CommonProps & HTMLAttributes & EuiLoadingElasticProps
-> = ({ size = 'm', className, ...rest }) => {
+export const EuiLoadingElastic: FunctionComponent &
+ EuiLoadingElasticProps> = ({ size = 'm', className, ...rest }) => {
const classes = classNames(
'euiLoadingElastic',
sizeToClassNameMap[size],
diff --git a/src/components/loading/loading_kibana.tsx b/src/components/loading/loading_kibana.tsx
index d3f9d37cb26..ca0b36dc370 100644
--- a/src/components/loading/loading_kibana.tsx
+++ b/src/components/loading/loading_kibana.tsx
@@ -34,9 +34,9 @@ export interface EuiLoadingKibanaProps {
size?: keyof typeof sizeToClassNameMap;
}
-export const EuiLoadingKibana: FunctionComponent<
- CommonProps & HTMLAttributes & EuiLoadingKibanaProps
-> = ({ size = 'm', className, ...rest }) => {
+export const EuiLoadingKibana: FunctionComponent &
+ EuiLoadingKibanaProps> = ({ size = 'm', className, ...rest }) => {
const classes = classNames(
'euiLoadingKibana',
sizeToClassNameMap[size],
diff --git a/src/components/loading/loading_spinner.tsx b/src/components/loading/loading_spinner.tsx
index 2701fd4ba4f..a4c82fad6ff 100644
--- a/src/components/loading/loading_spinner.tsx
+++ b/src/components/loading/loading_spinner.tsx
@@ -32,12 +32,10 @@ export const SIZES = keysOf(sizeToClassNameMap);
export type EuiLoadingSpinnerSize = keyof typeof sizeToClassNameMap;
-export const EuiLoadingSpinner: FunctionComponent<
- CommonProps &
- HTMLAttributes & {
- size?: EuiLoadingSpinnerSize;
- }
-> = ({ size = 'm', className, ...rest }) => {
+export const EuiLoadingSpinner: FunctionComponent & {
+ size?: EuiLoadingSpinnerSize;
+ }> = ({ size = 'm', className, ...rest }) => {
const classes = classNames(
'euiLoadingSpinner',
sizeToClassNameMap[size],
diff --git a/src/components/page/page_content/page_content.tsx b/src/components/page/page_content/page_content.tsx
index 18c1aa59824..c707a6639c4 100644
--- a/src/components/page/page_content/page_content.tsx
+++ b/src/components/page/page_content/page_content.tsx
@@ -27,13 +27,13 @@ export type EuiPageContentVerticalPositions = 'center';
export type EuiPageContentHorizontalPositions = 'center';
const verticalPositionToClassNameMap: {
- [position in EuiPageContentVerticalPositions]: string | null
+ [position in EuiPageContentVerticalPositions]: string | null;
} = {
center: 'euiPageContent--verticalCenter',
};
const horizontalPositionToClassNameMap: {
- [position in EuiPageContentHorizontalPositions]: string | null
+ [position in EuiPageContentHorizontalPositions]: string | null;
} = {
center: 'euiPageContent--horizontalCenter',
};
diff --git a/src/components/page/page_content/page_content_header.tsx b/src/components/page/page_content/page_content_header.tsx
index 6c3521f79d2..8a7aba7744c 100644
--- a/src/components/page/page_content/page_content_header.tsx
+++ b/src/components/page/page_content/page_content_header.tsx
@@ -31,9 +31,12 @@ export interface EuiPageContentHeaderProps
responsive?: boolean;
}
-export const EuiPageContentHeader: FunctionComponent<
- EuiPageContentHeaderProps
-> = ({ children, className, responsive = true, ...rest }) => {
+export const EuiPageContentHeader: FunctionComponent = ({
+ children,
+ className,
+ responsive = true,
+ ...rest
+}) => {
const classes = classNames(
'euiPageContentHeader',
{
diff --git a/src/components/page/page_content/page_content_header_section.tsx b/src/components/page/page_content/page_content_header_section.tsx
index b8bb9420c37..93d45058d53 100644
--- a/src/components/page/page_content/page_content_header_section.tsx
+++ b/src/components/page/page_content/page_content_header_section.tsx
@@ -25,9 +25,11 @@ export interface EuiPageContentHeaderSectionProps
extends CommonProps,
HTMLAttributes {}
-export const EuiPageContentHeaderSection: FunctionComponent<
- EuiPageContentHeaderSectionProps
-> = ({ children, className, ...rest }) => {
+export const EuiPageContentHeaderSection: FunctionComponent = ({
+ children,
+ className,
+ ...rest
+}) => {
const classes = classNames('euiPageContentHeaderSection', className);
return (
diff --git a/src/components/page/page_header/page_header_section.tsx b/src/components/page/page_header/page_header_section.tsx
index 58f75f72ec5..51f313968a3 100644
--- a/src/components/page/page_header/page_header_section.tsx
+++ b/src/components/page/page_header/page_header_section.tsx
@@ -25,9 +25,11 @@ export interface EuiPageHeaderSectionProps
extends CommonProps,
HTMLAttributes {}
-export const EuiPageHeaderSection: FunctionComponent<
- EuiPageHeaderSectionProps
-> = ({ children, className, ...rest }) => {
+export const EuiPageHeaderSection: FunctionComponent = ({
+ children,
+ className,
+ ...rest
+}) => {
const classes = classNames('euiPageHeaderSection', className);
return (
diff --git a/src/components/pagination/pagination.tsx b/src/components/pagination/pagination.tsx
index 01e9d970969..8d7074f0c86 100644
--- a/src/components/pagination/pagination.tsx
+++ b/src/components/pagination/pagination.tsx
@@ -93,7 +93,7 @@ export const EuiPagination: FunctionComponent = ({
totalPages={pageCount}
onClick={(e: MouseEvent) => safeClick(e, pageIndex)}
pageIndex={pageIndex}
- {...hasControl && { 'aria-controls': ariaControls }}
+ {...(hasControl && { 'aria-controls': ariaControls })}
hideOnMobile
/>
);
diff --git a/src/components/pagination/pagination_button.tsx b/src/components/pagination/pagination_button.tsx
index 5dcab5b5466..a25ae8c7a26 100644
--- a/src/components/pagination/pagination_button.tsx
+++ b/src/components/pagination/pagination_button.tsx
@@ -89,7 +89,7 @@ export const EuiPaginationButton: FunctionComponent = ({
{(shortPageString: string) => (
+ {...(props as EuiButtonEmptyProps)}>
{pageNumber}
)}
diff --git a/src/components/panel/panel.tsx b/src/components/panel/panel.tsx
index e20ba2a8a6d..00830300d78 100644
--- a/src/components/panel/panel.tsx
+++ b/src/components/panel/panel.tsx
@@ -125,7 +125,7 @@ export const EuiPanel: FunctionComponent = ({
ref={panelRef as Ref}
className={classes}
onClick={onClick}
- {...rest as ButtonHTMLAttributes}>
+ {...(rest as ButtonHTMLAttributes)}>
{optionalBetaBadge}
{children}
@@ -136,7 +136,7 @@ export const EuiPanel: FunctionComponent = ({
}
className={classes}
- {...rest as HTMLAttributes}>
+ {...(rest as HTMLAttributes)}>
{optionalBetaBadge}
{children}
diff --git a/src/components/popover/popover.tsx b/src/components/popover/popover.tsx
index e96f718ddbf..5b88a7e03cf 100644
--- a/src/components/popover/popover.tsx
+++ b/src/components/popover/popover.tsx
@@ -162,7 +162,7 @@ export interface EuiPopoverProps {
type AnchorPosition = 'up' | 'right' | 'down' | 'left';
const anchorPositionToPopoverPositionMap: {
- [position in AnchorPosition]: EuiPopoverPosition
+ [position in AnchorPosition]: EuiPopoverPosition;
} = {
up: 'top',
right: 'right',
diff --git a/src/components/progress/progress.tsx b/src/components/progress/progress.tsx
index 60709aef019..5ad5921eb85 100644
--- a/src/components/progress/progress.tsx
+++ b/src/components/progress/progress.tsx
@@ -92,9 +92,10 @@ type Determinate = EuiProgressProps &
labelProps?: HTMLAttributes;
};
-export const EuiProgress: FunctionComponent<
- ExclusiveUnion
-> = ({
+export const EuiProgress: FunctionComponent> = ({
className,
color = 'secondary',
size = 'm',
@@ -172,13 +173,13 @@ export const EuiProgress: FunctionComponent<
max={max}
value={value}
aria-hidden={label && valueText ? true : false}
- {...rest as ProgressHTMLAttributes}
+ {...(rest as ProgressHTMLAttributes)}
/>
);
} else {
return (
- } />
+
)} />
);
}
};
diff --git a/src/components/resizable_container/helpers.ts b/src/components/resizable_container/helpers.ts
index 27caa43407d..dc7220b792d 100644
--- a/src/components/resizable_container/helpers.ts
+++ b/src/components/resizable_container/helpers.ts
@@ -33,7 +33,7 @@ interface Params {
setState: React.Dispatch
>;
containerRef: React.RefObject;
registryRef: React.MutableRefObject;
- onPanelWidthChange?: ({ }: { [key: string]: number }) => any;
+ onPanelWidthChange?: ({}: { [key: string]: number }) => any;
}
type onMouseMove = (event: MouseEvent | TouchEvent) => void;
diff --git a/src/components/resizable_container/resizable_container.tsx b/src/components/resizable_container/resizable_container.tsx
index 2721ac2b17a..8bded8a6220 100644
--- a/src/components/resizable_container/resizable_container.tsx
+++ b/src/components/resizable_container/resizable_container.tsx
@@ -68,7 +68,7 @@ export interface EuiResizableContainerProps
* Pure function which accepts an object where keys are IDs of panels, which sizes were changed,
* and values are actual sizes in percents
*/
- onPanelWidthChange?: ({ }: { [key: string]: number }) => any;
+ onPanelWidthChange?: ({}: { [key: string]: number }) => any;
style?: CSSProperties;
}
@@ -88,9 +88,7 @@ const initialState: EuiResizableContainerState = {
resizersSize: 0,
};
-export const EuiResizableContainer: FunctionComponent<
- EuiResizableContainerProps
-> = ({
+export const EuiResizableContainer: FunctionComponent = ({
direction = 'horizontal',
children,
className,
diff --git a/src/components/search_bar/query/ast.ts b/src/components/search_bar/query/ast.ts
index 668db0c238c..12fd16b39f1 100644
--- a/src/components/search_bar/query/ast.ts
+++ b/src/components/search_bar/query/ast.ts
@@ -413,26 +413,23 @@ export class _AST {
if (!existingClause) {
return new _AST([...this._clauses]);
}
- const clauses = this._clauses.reduce(
- (clauses, clause) => {
- if (clause !== existingClause) {
- clauses.push(clause);
- return clauses;
- }
- const filteredValue = (clause.value as Value[]).filter(
- val => !valuesEqual(val, value)
- );
- if (filteredValue.length === 0) {
- return clauses;
- }
- clauses.push({
- ...clause,
- value: filteredValue,
- });
+ const clauses = this._clauses.reduce((clauses, clause) => {
+ if (clause !== existingClause) {
+ clauses.push(clause);
return clauses;
- },
- [] as Clause[]
- );
+ }
+ const filteredValue = (clause.value as Value[]).filter(
+ val => !valuesEqual(val, value)
+ );
+ if (filteredValue.length === 0) {
+ return clauses;
+ }
+ clauses.push({
+ ...clause,
+ value: filteredValue,
+ });
+ return clauses;
+ }, [] as Clause[]);
return new _AST(clauses);
}
@@ -537,47 +534,44 @@ export class _AST {
*/
addClause(newClause: Clause) {
let added = false;
- const newClauses = this._clauses.reduce(
- (clauses, clause) => {
- if (newClause.type !== clause.type) {
- clauses.push(clause);
- return clauses;
- }
-
- switch (newClause.type) {
- case Term.TYPE:
- if (newClause.value !== (clause as TermClause).value) {
- clauses.push(clause);
- return clauses;
- }
- break;
-
- case Field.TYPE:
- if (
- newClause.field !== (clause as FieldClause).field ||
- newClause.value !== (clause as FieldClause).value
- ) {
- clauses.push(clause);
- return clauses;
- }
- break;
-
- case Is.TYPE:
- if (newClause.flag !== (clause as IsClause).flag) {
- clauses.push(clause);
- return clauses;
- }
- break;
-
- default:
- throw new Error(`unknown clause type [${newClause.type}]`);
- }
- added = true;
- clauses.push(newClause);
+ const newClauses = this._clauses.reduce((clauses, clause) => {
+ if (newClause.type !== clause.type) {
+ clauses.push(clause);
return clauses;
- },
- [] as Clause[]
- );
+ }
+
+ switch (newClause.type) {
+ case Term.TYPE:
+ if (newClause.value !== (clause as TermClause).value) {
+ clauses.push(clause);
+ return clauses;
+ }
+ break;
+
+ case Field.TYPE:
+ if (
+ newClause.field !== (clause as FieldClause).field ||
+ newClause.value !== (clause as FieldClause).value
+ ) {
+ clauses.push(clause);
+ return clauses;
+ }
+ break;
+
+ case Is.TYPE:
+ if (newClause.flag !== (clause as IsClause).flag) {
+ clauses.push(clause);
+ return clauses;
+ }
+ break;
+
+ default:
+ throw new Error(`unknown clause type [${newClause.type}]`);
+ }
+ added = true;
+ clauses.push(newClause);
+ return clauses;
+ }, [] as Clause[]);
if (!added) {
newClauses.push(newClause);
diff --git a/src/components/search_bar/query/ast_to_es_query_dsl.ts b/src/components/search_bar/query/ast_to_es_query_dsl.ts
index 6c718a1f7b3..0257a591f47 100644
--- a/src/components/search_bar/query/ast_to_es_query_dsl.ts
+++ b/src/components/search_bar/query/ast_to_es_query_dsl.ts
@@ -364,37 +364,34 @@ export const astToEsQueryDsl = (ast: _AST, options = {}): QueryContainer => {
// there is at least one GroupClause, wrap the above clauses in another layer and append the ORs
const must = groupClauses.reduce(
(must, groupClause) => {
- const clauses = groupClause.value.reduce(
- (clauses, clause) => {
- if (AST.Term.isInstance(clause)) {
- clauses.push(
- clausesToEsQueryDsl({
- terms: collectTerms([clause]),
- fields: EMPTY_FIELDS,
- is: [],
- })
- );
- } else if (AST.Field.isInstance(clause)) {
- clauses.push(
- clausesToEsQueryDsl({
- terms: EMPTY_TERMS,
- fields: collectFields([clause]),
- is: [],
- })
- );
- } else if (AST.Is.isInstance(clause)) {
- clauses.push(
- clausesToEsQueryDsl({
- terms: EMPTY_TERMS,
- fields: EMPTY_FIELDS,
- is: [clause],
- })
- );
- }
- return clauses;
- },
- [] as BoolQuery[]
- );
+ const clauses = groupClause.value.reduce((clauses, clause) => {
+ if (AST.Term.isInstance(clause)) {
+ clauses.push(
+ clausesToEsQueryDsl({
+ terms: collectTerms([clause]),
+ fields: EMPTY_FIELDS,
+ is: [],
+ })
+ );
+ } else if (AST.Field.isInstance(clause)) {
+ clauses.push(
+ clausesToEsQueryDsl({
+ terms: EMPTY_TERMS,
+ fields: collectFields([clause]),
+ is: [],
+ })
+ );
+ } else if (AST.Is.isInstance(clause)) {
+ clauses.push(
+ clausesToEsQueryDsl({
+ terms: EMPTY_TERMS,
+ fields: EMPTY_FIELDS,
+ is: [clause],
+ })
+ );
+ }
+ return clauses;
+ }, [] as BoolQuery[]);
must.push({
bool: {
diff --git a/src/components/search_bar/query/default_syntax.ts b/src/components/search_bar/query/default_syntax.ts
index 68792bd7028..c7bfd79ce1d 100644
--- a/src/components/search_bar/query/default_syntax.ts
+++ b/src/components/search_bar/query/default_syntax.ts
@@ -343,9 +343,7 @@ const validateFieldValue = (
schemaField.validate(value);
} catch (e) {
error(
- `Invalid value \`${expression}\` set for field \`${field}\` - ${
- e.message
- }`,
+ `Invalid value \`${expression}\` set for field \`${field}\` - ${e.message}`,
location
);
}
diff --git a/src/components/search_bar/query/execute_ast.test.ts b/src/components/search_bar/query/execute_ast.test.ts
index b233ed4a68c..ecf91cf20d0 100644
--- a/src/components/search_bar/query/execute_ast.test.ts
+++ b/src/components/search_bar/query/execute_ast.test.ts
@@ -181,27 +181,39 @@ describe('execute ast', () => {
});
test('is clause - applied', () => {
- const items = [{ name: 'john', open: true }, { name: 'joe', open: false }];
+ const items = [
+ { name: 'john', open: true },
+ { name: 'joe', open: false },
+ ];
const result = executeAst(AST.create([AST.Is.must('open')]), items);
expect(result).toHaveLength(1);
expect(result[0].name).toBe('john');
});
test('is clause - not applied', () => {
- const items = [{ name: 'john', open: true }, { name: 'joe', open: false }];
+ const items = [
+ { name: 'john', open: true },
+ { name: 'joe', open: false },
+ ];
const result = executeAst(AST.create([AST.Is.mustNot('open')]), items);
expect(result).toHaveLength(1);
expect(result[0].name).toBe('joe');
});
test('is clause - applied - missing field', () => {
- const items = [{ name: 'john', open: true }, { name: 'joe', open: false }];
+ const items = [
+ { name: 'john', open: true },
+ { name: 'joe', open: false },
+ ];
const result = executeAst(AST.create([AST.Is.must('closed')]), items);
expect(result).toHaveLength(0);
});
test('is clause - not applied - missing field', () => {
- const items = [{ name: 'john', open: true }, { name: 'joe', open: false }];
+ const items = [
+ { name: 'john', open: true },
+ { name: 'joe', open: false },
+ ];
const result = executeAst(AST.create([AST.Is.mustNot('closed')]), items);
expect(result).toHaveLength(2);
});
diff --git a/src/components/search_bar/query/execute_ast.ts b/src/components/search_bar/query/execute_ast.ts
index fb292a916d5..7488d8d2186 100644
--- a/src/components/search_bar/query/execute_ast.ts
+++ b/src/components/search_bar/query/execute_ast.ts
@@ -107,15 +107,12 @@ const fieldClauseMatcher = (
// You might think that we could specify `item: T` here and do something
// with `keyof`, but that wouldn't work with `nested.field.name`
const extractStringFieldsFromItem = (item: any) => {
- return Object.keys(item).reduce(
- (fields, key) => {
- if (isString(item[key])) {
- fields.push(key);
- }
- return fields;
- },
- [] as string[]
- );
+ return Object.keys(item).reduce((fields, key) => {
+ if (isString(item[key])) {
+ fields.push(key);
+ }
+ return fields;
+ }, [] as string[]);
};
const termClauseMatcher = (
diff --git a/src/components/selectable/selectable.tsx b/src/components/selectable/selectable.tsx
index 863c32b2e4e..df523aab065 100644
--- a/src/components/selectable/selectable.tsx
+++ b/src/components/selectable/selectable.tsx
@@ -458,9 +458,7 @@ export class EuiSelectable extends Component<
if (props && props['aria-describedby']) {
return {
- 'aria-describedby': `${
- props['aria-describedby']
- }${messageContentIdString}`,
+ 'aria-describedby': `${props['aria-describedby']}${messageContentIdString}`,
};
}
diff --git a/src/components/selectable/selectable_list/selectable_list.tsx b/src/components/selectable/selectable_list/selectable_list.tsx
index 084db29da12..22ecf00344b 100644
--- a/src/components/selectable/selectable_list/selectable_list.tsx
+++ b/src/components/selectable/selectable_list/selectable_list.tsx
@@ -208,7 +208,7 @@ export class EuiSelectableList extends Component {
role="presentation"
className="euiSelectableList__groupLabel"
style={style}
- {...optionRest as HTMLAttributes}>
+ {...(optionRest as HTMLAttributes)}>
{prepend}
{label}
{append}
@@ -238,7 +238,7 @@ export class EuiSelectableList extends Component {
aria-posinset={index + 1 - labelCount}
aria-setsize={data.length - labelCount}
allowExclusions={this.props.allowExclusions}
- {...optionRest as EuiSelectableListItemProps}>
+ {...(optionRest as EuiSelectableListItemProps)}>
{this.props.renderOption ? (
this.props.renderOption(option, this.props.searchValue)
) : (
diff --git a/src/components/selectable/selectable_message/selectable_message.tsx b/src/components/selectable/selectable_message/selectable_message.tsx
index 594dce9a1e4..166909f5d50 100644
--- a/src/components/selectable/selectable_message/selectable_message.tsx
+++ b/src/components/selectable/selectable_message/selectable_message.tsx
@@ -28,9 +28,11 @@ export type EuiSelectableMessageProps = Omit<
> &
CommonProps & {};
-export const EuiSelectableMessage: React.FunctionComponent<
- EuiSelectableMessageProps
-> = ({ children, className, ...rest }) => {
+export const EuiSelectableMessage: React.FunctionComponent = ({
+ children,
+ className,
+ ...rest
+}) => {
const classes = classNames('euiSelectableMessage', className);
return (
diff --git a/src/components/side_nav/side_nav_item.tsx b/src/components/side_nav/side_nav_item.tsx
index 5c08c429cd2..fc84f0ec289 100644
--- a/src/components/side_nav/side_nav_item.tsx
+++ b/src/components/side_nav/side_nav_item.tsx
@@ -53,7 +53,7 @@ type ExcludeEuiSideNavItemProps = Pick<
Exclude
>;
type OmitEuiSideNavItemProps = {
- [K in keyof ExcludeEuiSideNavItemProps]: T[K]
+ [K in keyof ExcludeEuiSideNavItemProps]: T[K];
};
interface GuaranteedRenderItemProps {
diff --git a/src/components/stat/stat.tsx b/src/components/stat/stat.tsx
index 7052340d490..09f34a309cc 100644
--- a/src/components/stat/stat.tsx
+++ b/src/components/stat/stat.tsx
@@ -93,9 +93,9 @@ export interface EuiStatProps {
descriptionElement?: string;
}
-export const EuiStat: FunctionComponent<
- CommonProps & Omit, 'title'> & EuiStatProps
-> = ({
+export const EuiStat: FunctionComponent, 'title'> &
+ EuiStatProps> = ({
children,
className,
description,
diff --git a/src/components/suggest/suggest_input.tsx b/src/components/suggest/suggest_input.tsx
index 5b46c6aa6a4..b92c3d7989f 100644
--- a/src/components/suggest/suggest_input.tsx
+++ b/src/components/suggest/suggest_input.tsx
@@ -79,9 +79,7 @@ const statusMap: StatusMap = {
loading: {},
};
-export const EuiSuggestInput: FunctionComponent<
- EuiSuggestInputProps
-> = props => {
+export const EuiSuggestInput: FunctionComponent = props => {
const [value, setValue] = useState('');
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
diff --git a/src/components/suggest/suggest_item.tsx b/src/components/suggest/suggest_item.tsx
index 6f7f9edbf48..36bffa87680 100644
--- a/src/components/suggest/suggest_item.tsx
+++ b/src/components/suggest/suggest_item.tsx
@@ -149,13 +149,16 @@ export const EuiSuggestItem: FunctionComponent = ({
if (onClick) {
return (
-