diff --git a/package.json b/package.json index e50988a1a40..11cf2093f13 100644 --- a/package.json +++ b/package.json @@ -139,19 +139,19 @@ "enzyme": "^3.11.0", "enzyme-adapter-react-16": "^1.15.3", "enzyme-to-json": "^3.5.0", - "eslint": "^6.8.0", - "eslint-config-prettier": "^6.11.0", - "eslint-import-resolver-webpack": "^0.12.2", + "eslint": "^7.10.0", + "eslint-config-prettier": "^6.12.0", + "eslint-import-resolver-webpack": "^0.13.0", "eslint-plugin-babel": "^5.3.1", - "eslint-plugin-import": "^2.22.0", - "eslint-plugin-jest": "^23.20.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jest": "^24.1.0", "eslint-plugin-jsx-a11y": "^6.3.1", "eslint-plugin-local": "^1.0.0", - "eslint-plugin-mocha": "^6.3.0", + "eslint-plugin-mocha": "^8.0.0", "eslint-plugin-prefer-object-spread": "^1.2.1", "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react": "^7.20.6", - "eslint-plugin-react-hooks": "^3.0.0", + "eslint-plugin-react": "^7.21.3", + "eslint-plugin-react-hooks": "^4.1.2", "faker": "^4.1.0", "file-loader": "^6.1.0", "findup": "^0.1.5", @@ -172,7 +172,7 @@ "postcss-inline-svg": "^4.1.0", "postcss-loader": "^4.0.1", "pre-commit": "^1.2.2", - "prettier": "^1.19.1", + "prettier": "^2.1.2", "prettier-stylelint": "^0.4.2", "prompt": "^1.0.0", "prop-types": "^15.6.0", diff --git a/packages/react-datepicker/.eslintrc b/packages/react-datepicker/.eslintrc index 732ecf48c49..5a37e3e7f4c 100644 --- a/packages/react-datepicker/.eslintrc +++ b/packages/react-datepicker/.eslintrc @@ -1,4 +1,6 @@ { + "root": true, + "env": { "browser": true, "es6": true diff --git a/src-docs/src/actions/locale_actions.js b/src-docs/src/actions/locale_actions.js index 17e84a49056..c306dc9b991 100644 --- a/src-docs/src/actions/locale_actions.js +++ b/src-docs/src/actions/locale_actions.js @@ -1,6 +1,6 @@ import ActionTypes from './action_types'; -export const toggleLocale = locale => ({ +export const toggleLocale = (locale) => ({ type: ActionTypes.TOGGLE_LOCALE, data: { locale, diff --git a/src-docs/src/components/guide_page/guide_page.js b/src-docs/src/components/guide_page/guide_page.js index 30136d6c98c..21c51f9d68c 100644 --- a/src-docs/src/components/guide_page/guide_page.js +++ b/src-docs/src/components/guide_page/guide_page.js @@ -28,9 +28,7 @@ const GuidePageComponent = ({ label="Beta" tooltipContent="This component is still under development and may contain breaking changes in the nearby future." /> - ) : ( - undefined - ); + ) : undefined; const tabs = [ { diff --git a/src-docs/src/components/guide_page/guide_page_chrome.js b/src-docs/src/components/guide_page/guide_page_chrome.js index e23e7cfa44d..06c8bae4bd8 100644 --- a/src-docs/src/components/guide_page/guide_page_chrome.js +++ b/src-docs/src/components/guide_page/guide_page_chrome.js @@ -21,7 +21,7 @@ import { GuideThemeSelector } from '../guide_theme_selector'; import { EuiHighlight } from '../../../../src/components/highlight'; import { EuiBadge } from '../../../../src/components/badge'; -const scrollTo = position => { +const scrollTo = (position) => { window.scrollTo({ top: position, behavior: 'smooth' }); }; @@ -64,7 +64,7 @@ export class GuidePageChrome extends Component { }); }; - onSearchChange = event => { + onSearchChange = (event) => { this.setState({ search: event.target.value, isSideNavOpenOnMobile: event.target.value !== '', @@ -177,7 +177,7 @@ export class GuidePageChrome extends Component { } renderSubSections = (href, subSections = [], searchTerm = '') => { - const subSectionsWithTitles = subSections.filter(item => { + const subSectionsWithTitles = subSections.filter((item) => { if (!item.title) { return false; } @@ -214,16 +214,16 @@ export class GuidePageChrome extends Component { }); }; - renderSideNav = sideNav => { + renderSideNav = (sideNav) => { // TODO: Add contents pages const sideNavSections = []; const searchTerm = this.state.search.toLowerCase(); - sideNav.forEach(section => { + sideNav.forEach((section) => { let hasMatchingSubItem = false; - const matchingItems = section.items.filter(item => { + const matchingItems = section.items.filter((item) => { if (item.hidden) { return false; } @@ -242,7 +242,7 @@ export class GuidePageChrome extends Component { } }); - const items = matchingItems.map(item => { + const items = matchingItems.map((item) => { const { name, path, sections, isNew } = item; const href = `#/${path}`; diff --git a/src-docs/src/components/guide_section/guide_section.js b/src-docs/src/components/guide_section/guide_section.js index 910c02a3fa1..60160d0bb27 100644 --- a/src-docs/src/components/guide_section/guide_section.js +++ b/src-docs/src/components/guide_section/guide_section.js @@ -29,9 +29,9 @@ import { cleanEuiImports } from '../../services'; import { extendedTypesInfo } from './guide_section_extends'; -export const markup = text => { +export const markup = (text) => { const regex = /(#[a-zA-Z]+)|(`[^`]+`)/g; - return text.split('\n').map(token => { + return text.split('\n').map((token) => { const values = token.split(regex).map((token, index) => { if (!token) { return ''; @@ -54,7 +54,7 @@ export const markup = text => { if (token.includes('\n')) { return token .split('\n') - .map(item => [item,
]); + .map((item) => [item,
]); } return token; }); @@ -62,7 +62,7 @@ export const markup = text => { }); }; -export const humanizeType = type => { +export const humanizeType = (type) => { if (!type) { return ''; } @@ -162,7 +162,7 @@ export class GuideSection extends Component { this.memoScroll = 0; } - onSort = componentName => { + onSort = (componentName) => { const { sortedComponents } = this.state; if ( !sortedComponents[componentName] || @@ -182,13 +182,13 @@ export class GuideSection extends Component { } }; - onSelectedTabChanged = selectedTab => { + onSelectedTabChanged = (selectedTab) => { const { name } = selectedTab; let renderedCode = null; if (name === 'html' || name === 'javascript') { const { code } = this.props.source.find( - sourceObject => sourceObject.type === name + (sourceObject) => sourceObject.type === name ); renderedCode = code; @@ -255,7 +255,7 @@ export class GuideSection extends Component { }; renderTabs() { - return this.tabs.map(tab => ( + return this.tabs.map((tab) => ( this.onSelectedTabChanged(tab)} isSelected={tab === this.state.selectedTab} @@ -336,7 +336,7 @@ export class GuideSection extends Component { }); } - const rows = propNames.map(propName => { + const rows = propNames.map((propName) => { const { description: propDescription = '', required, @@ -448,7 +448,7 @@ export class GuideSection extends Component { }); const extendedTypes = extendedInterfaces - ? extendedInterfaces.filter(type => !!extendedTypesInfo[type]) + ? extendedInterfaces.filter((type) => !!extendedTypesInfo[type]) : []; // if there is an HTMLAttributes type present among others, remove HTMLAttributes if (extendedTypes.includes('HTMLAttributes') && extendedTypes.length > 1) { @@ -545,7 +545,7 @@ export class GuideSection extends Component { renderProps() { const { props } = this.props; return this.componentNames - .map(componentName => + .map((componentName) => this.renderPropsForComponent(componentName, props[componentName]) ) .reduce((a, b) => a.concat(b), []); // Flatten the resulting array diff --git a/src-docs/src/components/guide_theme_selector/guide_theme_selector.js b/src-docs/src/components/guide_theme_selector/guide_theme_selector.js index 7138a616770..b1a6257117b 100644 --- a/src-docs/src/components/guide_theme_selector/guide_theme_selector.js +++ b/src-docs/src/components/guide_theme_selector/guide_theme_selector.js @@ -7,7 +7,7 @@ import { EUI_THEMES } from '../../../../src/themes'; export const GuideThemeSelector = () => { return ( - {context => } + {(context) => } ); }; @@ -18,7 +18,7 @@ const GuideThemeSelectorComponent = ({ context }) => { { + onChange={(e) => { context.changeTheme(e.target.value); }} aria-label="Switch the theme" diff --git a/src-docs/src/index.js b/src-docs/src/index.js index b8edd3c4f0b..b0c3e98bd1f 100644 --- a/src-docs/src/index.js +++ b/src-docs/src/index.js @@ -55,7 +55,7 @@ ReactDOM.render( { + render={(props) => { const { location } = props; // prevents encoded urls with a section id to fail if (location.pathname.includes('%23')) { diff --git a/src-docs/src/routes.js b/src-docs/src/routes.js index 040874736ff..2e361642dd5 100644 --- a/src-docs/src/routes.js +++ b/src-docs/src/routes.js @@ -231,7 +231,7 @@ import { ElasticChartsPieExample } from './views/elastic_charts/pie_example'; * Lowercases input and replaces spaces with hyphens: * e.g. 'GridView Example' -> 'gridview-example' */ -const slugify = str => { +const slugify = (str) => { const parts = str .toLowerCase() .replace(/[-]+/g, ' ') @@ -264,11 +264,11 @@ const createExample = (example, customTitle) => { playground, guidelines, } = example; - sections.forEach(section => { + sections.forEach((section) => { section.id = slugify(section.title || title); }); - const renderedSections = sections.map(section => + const renderedSections = sections.map((section) => createElement(GuideSection, { key: section.title || title, ...section, @@ -343,7 +343,7 @@ const navigation = [ PopoverExample, ResizableContainerExample, SpacerExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Navigation', @@ -361,7 +361,7 @@ const navigation = [ SideNavExample, StepsExample, TabsExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Tabular content', @@ -375,7 +375,7 @@ const navigation = [ DataGridFooterRowExample, TableExample, TableInMemoryExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Display', @@ -402,7 +402,7 @@ const navigation = [ ToastExample, ToolTipExample, TourExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Forms', @@ -422,7 +422,7 @@ const navigation = [ SelectableExample, SuggestExample, SuperDatePickerExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Editors & syntax', @@ -432,7 +432,7 @@ const navigation = [ MarkdownPluginExample, CodeEditorExample, CodeExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Elastic Charts', @@ -442,7 +442,7 @@ const navigation = [ ElasticChartsTimeExample, ElasticChartsCategoryExample, ElasticChartsPieExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Utilities', @@ -470,7 +470,7 @@ const navigation = [ TextDiffExample, ToggleExample, WindowEventExample, - ].map(example => createExample(example)), + ].map((example) => createExample(example)), }, { name: 'Package', @@ -504,10 +504,10 @@ const allRoutes = navigation.reduce((accummulatedRoutes, section) => { export default { navigation, - getRouteForPath: path => { + getRouteForPath: (path) => { // React-router kinda sucks. Sometimes the path contains a leading slash, sometimes it doesn't. const normalizedPath = path[0] === '/' ? path.slice(1, path.length) : path; - return allRoutes.find(route => normalizedPath === route.path); + return allRoutes.find((route) => normalizedPath === route.path); }, getAppRoutes: function getAppRoutes() { @@ -515,7 +515,7 @@ export default { }, getPreviousRoute: function getPreviousRoute(routeName) { - const index = allRoutes.findIndex(item => { + const index = allRoutes.findIndex((item) => { return item.name === routeName; }); @@ -523,7 +523,7 @@ export default { }, getNextRoute: function getNextRoute(routeName) { - const index = allRoutes.findIndex(item => { + const index = allRoutes.findIndex((item) => { return item.name === routeName; }); diff --git a/src-docs/src/services/playground/dummyFunction.js b/src-docs/src/services/playground/dummyFunction.js index af9c023e5d3..01d3272693e 100644 --- a/src-docs/src/services/playground/dummyFunction.js +++ b/src-docs/src/services/playground/dummyFunction.js @@ -1,7 +1,7 @@ import * as t from '@babel/types'; export const dummyFunction = { - generate: val => { + generate: (val) => { if (!val) return null; const obj = t.arrowFunctionExpression([], t.blockStatement([]), false); return obj; diff --git a/src-docs/src/services/playground/iconValidator.js b/src-docs/src/services/playground/iconValidator.js index c2ce4474cd5..336f9180dfd 100644 --- a/src-docs/src/services/playground/iconValidator.js +++ b/src-docs/src/services/playground/iconValidator.js @@ -11,7 +11,7 @@ export const iconValidator = (prop = { custom: {} }) => { type: PropTypes.String, custom: { ...prop.custom, - validator: val => iconOptions[val], + validator: (val) => iconOptions[val], }, }; return newProp; diff --git a/src-docs/src/services/playground/knobs.js b/src-docs/src/services/playground/knobs.js index c4897a4fbf4..3094bf950cb 100644 --- a/src-docs/src/services/playground/knobs.js +++ b/src-docs/src/services/playground/knobs.js @@ -95,7 +95,7 @@ const Knob = ({ set(e.target.value)} + onChange={(e) => set(e.target.value)} aria-label={description} compressed fullWidth @@ -108,7 +108,7 @@ const Knob = ({ case PropTypes.Date: if (custom && custom.validator) { knobProps = {}; - knobProps.onChange = e => { + knobProps.onChange = (e) => { const value = e.target.value; if (custom.validator(value)) set(value); else set(undefined); @@ -116,14 +116,14 @@ const Knob = ({ } else if (custom && custom.sanitize) { knobProps = {}; knobProps.value = val; - knobProps.onChange = e => { + knobProps.onChange = (e) => { const value = e.target.value; set(custom.sanitize(value)); }; } else { knobProps = {}; knobProps.value = val; - knobProps.onChange = e => { + knobProps.onChange = (e) => { const value = e.target.value; set(value); }; @@ -153,7 +153,7 @@ const Knob = ({ id={name} label="" checked={val} - onChange={e => { + onChange={(e) => { set(e.target.checked); }} compressed @@ -172,7 +172,7 @@ const Knob = ({ if (valueKey && !valueKey.includes('__')) { valueKey = `${valueKey}__${name}`; } - const flattenedOptions = optionsKeys.map(key => ({ + const flattenedOptions = optionsKeys.map((key) => ({ id: `${key}__${name}`, label: options[key], })); @@ -182,7 +182,7 @@ const Knob = ({ { + onChange={(id) => { let val = id; if (val.includes('__')) val = val.split('__')[0]; set(val); @@ -193,7 +193,7 @@ const Knob = ({ ); } else { - const flattenedOptions = optionsKeys.map(key => ({ + const flattenedOptions = optionsKeys.map((key) => ({ value: key, text: options[key], })); @@ -207,7 +207,7 @@ const Knob = ({ id={name} options={flattenedOptions} value={valueKey || defaultValue} - onChange={e => { + onChange={(e) => { set(e.target.value); }} aria-label={`Select ${name}`} @@ -225,7 +225,7 @@ const Knob = ({ { + onChange={(e) => { set(e.target.value); }} /> @@ -242,7 +242,7 @@ const Knob = ({ id={name} label={custom.label || ''} checked={typeof val !== 'undefined' && val} - onChange={e => { + onChange={(e) => { const value = e.target.checked; set(value ? value : undefined); @@ -356,7 +356,7 @@ const KnobColumn = ({ state, knobNames, error, set }) => { hidden={state[name].hidden} options={state[name].options} placeholder={state[name].placeholder} - set={value => set(value, name)} + set={(value) => set(value, name)} enumName={state[name].enumName} defaultValue={state[name].defaultValue} custom={state[name] && state[name].custom} diff --git a/src-docs/src/services/playground/mapOptions.js b/src-docs/src/services/playground/mapOptions.js index d84c182f00e..2e28c3ce285 100644 --- a/src-docs/src/services/playground/mapOptions.js +++ b/src-docs/src/services/playground/mapOptions.js @@ -1,4 +1,4 @@ -export const mapOptions = optionArray => { +export const mapOptions = (optionArray) => { const options = {}; for (let i = 0; i < optionArray.length; i++) { diff --git a/src-docs/src/services/playground/playground.js b/src-docs/src/services/playground/playground.js index 72882d5d8c9..503154b23be 100644 --- a/src-docs/src/services/playground/playground.js +++ b/src-docs/src/services/playground/playground.js @@ -7,7 +7,7 @@ import { EuiSpacer, EuiTitle, EuiCodeBlock } from '../../../../src/components'; import Knobs from './knobs'; export default ({ config, setGhostBackground, playgroundClassName }) => { - const getSnippet = code => { + const getSnippet = (code) => { let regex = /return \(([\S\s]*?)(;)$/gm; let newCode = code.match(regex); @@ -37,7 +37,7 @@ export default ({ config, setGhostBackground, playgroundClassName }) => { const { state } = params.knobProps; if (setGhostBackground) { let needGhostTheme = false; - Object.keys(setGhostBackground).forEach(name => { + Object.keys(setGhostBackground).forEach((name) => { if (state[name].value === setGhostBackground[name]) needGhostTheme = true; }); diff --git a/src-docs/src/services/playground/props.js b/src-docs/src/services/playground/props.js index dad2f859be9..67f4bce7d90 100644 --- a/src-docs/src/services/playground/props.js +++ b/src-docs/src/services/playground/props.js @@ -1,7 +1,7 @@ /* eslint-disable guard-for-in */ import { PropTypes } from 'react-view'; -const getProp = prop => { +const getProp = (prop) => { const newProp = {}; if (prop.description) newProp.description = prop.description; newProp.custom = { origin: prop }; @@ -63,7 +63,7 @@ const getProp = prop => { return newProp; }; -const propUtilityForPlayground = props => { +const propUtilityForPlayground = (props) => { const modifiedProps = {}; for (const key in props) { diff --git a/src-docs/src/services/routing/routing.js b/src-docs/src/services/routing/routing.js index 324ba4ae316..869e55b718d 100644 --- a/src-docs/src/services/routing/routing.js +++ b/src-docs/src/services/routing/routing.js @@ -1,14 +1,14 @@ // See `/wiki/react-router.md` -const isModifiedEvent = event => +const isModifiedEvent = (event) => !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); -const isLeftClickEvent = event => event.button === 0; +const isLeftClickEvent = (event) => event.button === 0; const resolveToLocation = (to, router) => typeof to === 'function' ? to(router.location) : to; let router; -export const registerRouter = reactRouter => { +export const registerRouter = (reactRouter) => { router = reactRouter; }; @@ -16,7 +16,7 @@ export const registerRouter = reactRouter => { * The logic for generating hrefs and onClick handlers from the `to` prop is largely borrowed from * https://github.com/ReactTraining/react-router/blob/v3/modules/Link.js. */ -export const getRouterLinkProps = to => { +export const getRouterLinkProps = (to) => { const location = resolveToLocation(to, router); const href = router.history.createHref({ @@ -25,7 +25,7 @@ export const getRouterLinkProps = to => { hash: '', }); - const onClick = event => { + const onClick = (event) => { if (event.defaultPrevented) { return; } diff --git a/src-docs/src/services/string/clean_imports.js b/src-docs/src/services/string/clean_imports.js index 8619547766e..6d32f05db2a 100644 --- a/src-docs/src/services/string/clean_imports.js +++ b/src-docs/src/services/string/clean_imports.js @@ -1,8 +1,8 @@ -export const hasDisplayToggles = code => { +export const hasDisplayToggles = (code) => { return /DisplayToggles/.test(code); }; -export const cleanEuiImports = code => { +export const cleanEuiImports = (code) => { return code .replace(/(from )'(..\/)+src\/components(\/?';)/, "from '@elastic/eui';") .replace( @@ -11,13 +11,13 @@ export const cleanEuiImports = code => { ); }; -export const listExtraDeps = code => { +export const listExtraDeps = (code) => { return code .match( // Match anything not directly calling eui (like lib dirs) /import(?!.*(elastic\/eui|\.))\s.*?'(@[^.]+?\/)?[^.]+?['\/]/g ) - .map(match => match.match(/'(.+)['\/]/)[1]) + .map((match) => match.match(/'(.+)['\/]/)[1]) .reduce((deps, dep) => { // Make sure that we are using the latest version of a dep deps[dep] = 'latest'; diff --git a/src-docs/src/services/theme/theme.js b/src-docs/src/services/theme/theme.js index 6dcdc1e623f..04c44ee2246 100644 --- a/src-docs/src/services/theme/theme.js +++ b/src-docs/src/services/theme/theme.js @@ -5,8 +5,8 @@ export function registerTheme(theme, cssFiles) { } export function applyTheme(newTheme) { - Object.keys(themes).forEach(theme => - themes[theme].forEach(cssFile => cssFile.unuse()) + Object.keys(themes).forEach((theme) => + themes[theme].forEach((cssFile) => cssFile.unuse()) ); - themes[newTheme].forEach(cssFile => cssFile.use()); + themes[newTheme].forEach((cssFile) => cssFile.use()); } diff --git a/src-docs/src/views/accessibility/skip_link.js b/src-docs/src/views/accessibility/skip_link.js index 90dd813c8b7..51a86f38f66 100644 --- a/src-docs/src/views/accessibility/skip_link.js +++ b/src-docs/src/views/accessibility/skip_link.js @@ -35,7 +35,7 @@ export default () => { setFixed(e.target.checked)} + onChange={(e) => setFixed(e.target.checked)} /> ( + onToggle={(isOpen) => console.log(`EuiAccordion is now ${isOpen ? 'open' : 'closed'}`) } paddingSize="l"> diff --git a/src-docs/src/views/accordion/accordion_forceState.js b/src-docs/src/views/accordion/accordion_forceState.js index e0c5301795d..c4a81c143a7 100644 --- a/src-docs/src/views/accordion/accordion_forceState.js +++ b/src-docs/src/views/accordion/accordion_forceState.js @@ -24,12 +24,12 @@ export default () => { }, ]; - const onChange = id => { + const onChange = (id) => { setTrigger(id === toggleButtons[0].id ? 'open' : 'closed'); setID(id); }; - const onToggle = isOpen => { + const onToggle = (isOpen) => { const newState = isOpen ? 'open' : 'closed'; setTrigger(newState); setID(`${idPrefix}--${newState}`); diff --git a/src-docs/src/views/accordion/accordion_isLoading.js b/src-docs/src/views/accordion/accordion_isLoading.js index ebf4f248281..ee2230476b4 100644 --- a/src-docs/src/views/accordion/accordion_isLoading.js +++ b/src-docs/src/views/accordion/accordion_isLoading.js @@ -33,9 +33,9 @@ export default () => { const [label, setLabel] = useState('False'); const [toggleIdSelected, setToggleIdSelected] = useState(`${idPrefix}0`); - const onChange = optionId => { + const onChange = (optionId) => { setToggleIdSelected(optionId); - setLabel(toggleButtons.find(x => x.id === optionId).label); + setLabel(toggleButtons.find((x) => x.id === optionId).label); }; let isLoadingMessage; diff --git a/src-docs/src/views/app_view.js b/src-docs/src/views/app_view.js index e3e89dd8804..596f2a397a3 100644 --- a/src-docs/src/views/app_view.js +++ b/src-docs/src/views/app_view.js @@ -47,7 +47,7 @@ export class AppView extends Component { const i18n = { mappingFunc: mappingFuncs[locale], - formatNumber: value => new Intl.NumberFormat(locale).format(value), + formatNumber: (value) => new Intl.NumberFormat(locale).format(value), locale, }; @@ -65,7 +65,7 @@ export class AppView extends Component {
- {context => { + {(context) => { return React.cloneElement(children, { selectedTheme: context.theme, title: currentRoute.name, @@ -83,7 +83,7 @@ export class AppView extends Component { return
{this.renderContent()}
; } - onKeydown = event => { + onKeydown = (event) => { if (event.target !== document.body) { return; } diff --git a/src-docs/src/views/avatar/playground.js b/src-docs/src/views/avatar/playground.js index 3f7392b6bc0..660472dec71 100644 --- a/src-docs/src/views/avatar/playground.js +++ b/src-docs/src/views/avatar/playground.js @@ -13,7 +13,7 @@ export default () => { value: undefined, custom: { ...propsToUse.color.custom, - validator: val => { + validator: (val) => { try { checkValidColor(val); return true; diff --git a/src-docs/src/views/badge/badge.js b/src-docs/src/views/badge/badge.js index 9d6c9b90ae0..3071a4fc862 100644 --- a/src-docs/src/views/badge/badge.js +++ b/src-docs/src/views/badge/badge.js @@ -42,7 +42,7 @@ export default () => { - {badges.map(badge => ( + {badges.map((badge) => ( {badge} @@ -58,7 +58,7 @@ export default () => { responsive={false} gutterSize="xs" style={{ maxWidth: '300px' }}> - {customBadges.map(badge => ( + {customBadges.map((badge) => ( {badge} @@ -77,7 +77,7 @@ export default () => { setDisabled(e.target.checked)} + onChange={(e) => setDisabled(e.target.checked)} /> diff --git a/src-docs/src/views/badge/playground.js b/src-docs/src/views/badge/playground.js index a4c60df5a37..f5b378c6a8d 100644 --- a/src-docs/src/views/badge/playground.js +++ b/src-docs/src/views/badge/playground.js @@ -42,7 +42,7 @@ export const badgeConfig = () => { value: 'Badge content', hidden: true, custom: { - sanitize: val => { + sanitize: (val) => { return val.replace(/<(?:"[^"]"['"]|'[^']'['"]|[^'">])+>/g, ''); }, }, diff --git a/src-docs/src/views/breadcrumbs/breadcrumbs.js b/src-docs/src/views/breadcrumbs/breadcrumbs.js index c89c2db6982..fbc425a9aa4 100644 --- a/src-docs/src/views/breadcrumbs/breadcrumbs.js +++ b/src-docs/src/views/breadcrumbs/breadcrumbs.js @@ -15,7 +15,7 @@ export default () => { { text: 'Animals', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); console.log('You clicked Animals'); }, @@ -27,7 +27,7 @@ export default () => { { text: 'Boa constrictor', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); console.log('You clicked Boa constrictor'); }, diff --git a/src-docs/src/views/button/button_ghost.js b/src-docs/src/views/button/button_ghost.js index b282c4ddc18..8b7be264463 100644 --- a/src-docs/src/views/button/button_ghost.js +++ b/src-docs/src/views/button/button_ghost.js @@ -13,7 +13,7 @@ import { export default () => { const [toggle0On, setToggle0On] = useState(false); - const onToggle0Change = e => { + const onToggle0Change = (e) => { setToggle0On(e.target.checked); }; diff --git a/src-docs/src/views/button/button_group.js b/src-docs/src/views/button/button_group.js index acd993e0399..f54514806b8 100644 --- a/src-docs/src/views/button/button_group.js +++ b/src-docs/src/views/button/button_group.js @@ -138,15 +138,15 @@ export default () => { `${idPrefix2}4` ); - const onChange = optionId => { + const onChange = (optionId) => { setToggleIdSelected(optionId); }; - const onChangeDisabled = optionId => { + const onChangeDisabled = (optionId) => { setToggleIdDisabled(optionId); }; - const onChangeMulti = optionId => { + const onChangeMulti = (optionId) => { const newToggleIdToSelectedMap = { ...toggleIdToSelectedMap, ...{ @@ -156,15 +156,15 @@ export default () => { setToggleIdToSelectedMap(newToggleIdToSelectedMap); }; - const onChangeIcons = optionId => { + const onChangeIcons = (optionId) => { setToggleIconIdSelected(optionId); }; - const onChangeCompressed = optionId => { + const onChangeCompressed = (optionId) => { setToggleCompressedIdSelected(optionId); }; - const onChangeIconsMulti = optionId => { + const onChangeIconsMulti = (optionId) => { const newToggleIconIdToSelectedMap = { ...toggleIconIdToSelectedMap, ...{ @@ -175,7 +175,7 @@ export default () => { setToggleIconIdToSelectedMap(newToggleIconIdToSelectedMap); }; - const onChangeIconsMultiIcons = optionId => { + const onChangeIconsMultiIcons = (optionId) => { const newToggleIconIdToSelectedMapIcon = { ...toggleIconIdToSelectedMapIcon, ...{ @@ -192,7 +192,7 @@ export default () => { legend="This is a basic group" options={toggleButtons} idSelected={toggleIdSelected} - onChange={id => onChange(id)} + onChange={(id) => onChange(id)} /> @@ -204,7 +204,7 @@ export default () => { name="primary" options={toggleButtonsMulti} idToSelectedMap={toggleIdToSelectedMap} - onChange={id => onChangeMulti(id)} + onChange={(id) => onChangeMulti(id)} color="primary" type="multi" /> @@ -218,7 +218,7 @@ export default () => { name="disabledGroup" options={toggleButtonsDisabled} idSelected={toggleIdDisabled} - onChange={id => onChangeDisabled(id)} + onChange={(id) => onChangeDisabled(id)} buttonSize="m" isDisabled isFullWidth @@ -233,7 +233,7 @@ export default () => { name="textAlign" options={toggleButtonsIcons} idSelected={toggleIconIdSelected} - onChange={id => onChangeIcons(id)} + onChange={(id) => onChangeIcons(id)} isIconOnly />    @@ -241,7 +241,7 @@ export default () => { legend="Text style" options={toggleButtonsIconsMulti} idToSelectedMap={toggleIconIdToSelectedMap} - onChange={id => onChangeIconsMulti(id)} + onChange={(id) => onChangeIconsMulti(id)} type="multi" isIconOnly /> @@ -259,7 +259,7 @@ export default () => { legend="This is a basic group" options={toggleButtonsCompressed} idSelected={toggleCompressedIdSelected} - onChange={id => onChangeCompressed(id)} + onChange={(id) => onChangeCompressed(id)} buttonSize="compressed" isFullWidth /> @@ -274,7 +274,7 @@ export default () => { className="eui-displayInlineBlock" options={toggleButtonsIconsMulti} idToSelectedMap={toggleIconIdToSelectedMapIcon} - onChange={id => onChangeIconsMultiIcons(id)} + onChange={(id) => onChangeIconsMultiIcons(id)} type="multi" buttonSize="compressed" isIconOnly diff --git a/src-docs/src/views/button/button_icon.js b/src-docs/src/views/button/button_icon.js index db9d4ceb536..47b9e8cda9c 100644 --- a/src-docs/src/views/button/button_icon.js +++ b/src-docs/src/views/button/button_icon.js @@ -19,7 +19,7 @@ const colors = [ export default () => ( - {colors.map(color => ( + {colors.map((color) => ( { const toggle3On = true; const [toggle4On, setToggle4On] = useState(true); - const onToggle0Change = e => { + const onToggle0Change = (e) => { setToggle0On(e.target.checked); }; - const onToggle1Change = e => { + const onToggle1Change = (e) => { setToggle1On(e.target.checked); }; - const onToggle4Change = e => { + const onToggle4Change = (e) => { setToggle4On(e.target.checked); }; diff --git a/src-docs/src/views/card/card.js b/src-docs/src/views/card/card.js index 179fe318eb1..7efc087fa76 100644 --- a/src-docs/src/views/card/card.js +++ b/src-docs/src/views/card/card.js @@ -9,7 +9,7 @@ import { const icons = ['Beats', 'Cloud', 'Logging', 'Kibana']; -const cardNodes = icons.map(function(item, index) { +const cardNodes = icons.map(function (item, index) { return ( { setNestedRadio(nestedRadio)} + onChange={(nestedRadio) => setNestedRadio(nestedRadio)} disabled={radio !== 'radio2'} /> diff --git a/src-docs/src/views/card/card_selectable.js b/src-docs/src/views/card/card_selectable.js index 7a6cd1711a0..c63e5052468 100644 --- a/src-docs/src/views/card/card_selectable.js +++ b/src-docs/src/views/card/card_selectable.js @@ -20,7 +20,7 @@ export default () => { setCard2(!card2Selected); }; - const detailsClicked = e => { + const detailsClicked = (e) => { e.stopPropagation(); console.log('Details clicked'); }; diff --git a/src-docs/src/views/code_editor/code_editor.js b/src-docs/src/views/code_editor/code_editor.js index a4de220b4dc..beb83b5ad22 100644 --- a/src-docs/src/views/code_editor/code_editor.js +++ b/src-docs/src/views/code_editor/code_editor.js @@ -9,7 +9,7 @@ import 'brace/ext/language_tools'; export default () => { const [value, updateValue] = useState(''); - const onChange = value => { + const onChange = (value) => { updateValue(value); }; diff --git a/src-docs/src/views/code_editor/custom_mode.js b/src-docs/src/views/code_editor/custom_mode.js index be9a19f5bc9..0faa4659055 100644 --- a/src-docs/src/views/code_editor/custom_mode.js +++ b/src-docs/src/views/code_editor/custom_mode.js @@ -12,7 +12,7 @@ class MyCustomAceMode extends TextMode { export default () => { const [value, updateValue] = useState(''); - const onChange = value => { + const onChange = (value) => { updateValue(value); }; diff --git a/src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx b/src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx index 4f663f4830f..b53fe0fae16 100644 --- a/src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx +++ b/src-docs/src/views/collapsible_nav/collapsible_nav_all.tsx @@ -40,7 +40,7 @@ const TopLinks: EuiPinnableListGroupItemProps[] = [ }, ]; const KibanaLinks: EuiPinnableListGroupItemProps[] = KibanaNavLinks.map( - link => { + (link) => { return { ...link, href: '#/navigation/collapsible-nav', @@ -121,7 +121,7 @@ export default () => { links: EuiPinnableListGroupItemProps[], showPinned = false ): EuiPinnableListGroupItemProps[] { - return links.map(link => { + return links.map((link) => { const { pinned, ...rest } = link; return { pinned: showPinned ? pinned : false, @@ -252,7 +252,7 @@ export default () => { return ( - {setIsFullScreen => ( + {(setIsFullScreen) => ( ( - {customPalettes.map(palette => ( + {customPalettes.map((palette) => (

{palette.title}

@@ -61,7 +61,7 @@ export default () => ( alignItems="flexStart" responsive={false} wrap> - {palette.palette.map(hexCode => ( + {palette.palette.map((hexCode) => ( { const [length, setLength] = useState(10); - const onLengthChange = e => { + const onLengthChange = (e) => { setLength(e.currentTarget.value); }; @@ -46,7 +46,7 @@ export default () => { className="guideColorPalette__swatchHolder" gutterSize="none" responsive={false}> - {colorPalette(palette, Number(length), i > 1).map(hexCode => ( + {colorPalette(palette, Number(length), i > 1).map((hexCode) => ( ))}
diff --git a/src-docs/src/views/color_palette/color_palette_quantitative.js b/src-docs/src/views/color_palette/color_palette_quantitative.js index c7fb55d0c8e..077f5b59d08 100644 --- a/src-docs/src/views/color_palette/color_palette_quantitative.js +++ b/src-docs/src/views/color_palette/color_palette_quantitative.js @@ -35,7 +35,7 @@ const paletteNames = Object.keys(paletteData); export default () => { const [length, setLength] = useState(5); - const onLengthChange = e => { + const onLengthChange = (e) => { setLength(e.currentTarget.value); }; @@ -54,14 +54,14 @@ export default () => { - {paletteNames.map(paletteName => ( + {paletteNames.map((paletteName) => ( - {paletteData[paletteName](Number(length)).map(hexCode => ( + {paletteData[paletteName](Number(length)).map((hexCode) => ( ))} diff --git a/src-docs/src/views/color_palette/shared.js b/src-docs/src/views/color_palette/shared.js index 73bd93e6d01..1b459bafbe4 100644 --- a/src-docs/src/views/color_palette/shared.js +++ b/src-docs/src/views/color_palette/shared.js @@ -26,7 +26,7 @@ export const ColorPaletteCopyCode = ({ textToCopy, code }) => { - {copy => ( + {(copy) => ( {code} diff --git a/src-docs/src/views/color_picker/color_stops.js b/src-docs/src/views/color_picker/color_stops.js index 11a6fa51bed..b181e7452cc 100644 --- a/src-docs/src/views/color_picker/color_stops.js +++ b/src-docs/src/views/color_picker/color_stops.js @@ -22,13 +22,13 @@ export default () => { }, ]); - const handleExtendedChange = colorStops => { + const handleExtendedChange = (colorStops) => { setExtendedColorStops(colorStops); }; const [emptyColorStops, setEmptyColorStops] = useState([]); - const handleEmptyChange = colorStops => { + const handleEmptyChange = (colorStops) => { setEmptyColorStops(colorStops); }; diff --git a/src-docs/src/views/color_picker/color_stops_range.js b/src-docs/src/views/color_picker/color_stops_range.js index 8be3ac082e7..b4bfe959225 100644 --- a/src-docs/src/views/color_picker/color_stops_range.js +++ b/src-docs/src/views/color_picker/color_stops_range.js @@ -5,19 +5,19 @@ import { EuiColorStops, EuiFormRow } from '../../../../src/components'; export default () => { const [emptyColorStops, setEmptyColorStops] = useState([]); - const handleEmptyChange = colorStops => { + const handleEmptyChange = (colorStops) => { setEmptyColorStops(colorStops); }; const [emptyColorStops2, setEmptyColorStops2] = useState([]); - const handleEmptyChange2 = colorStops => { + const handleEmptyChange2 = (colorStops) => { setEmptyColorStops2(colorStops); }; const [emptyColorStops3, setEmptyColorStops3] = useState([]); - const handleEmptyChange3 = colorStops => { + const handleEmptyChange3 = (colorStops) => { setEmptyColorStops3(colorStops); }; @@ -25,7 +25,7 @@ export default () => { { stop: 10, color: '#D36086' }, ]); - const handleSingleChange = colorStops => { + const handleSingleChange = (colorStops) => { setSingleColorStops(colorStops); }; @@ -33,7 +33,7 @@ export default () => { { stop: 10, color: '#D36086' }, ]); - const handleSingleChange2 = colorStops => { + const handleSingleChange2 = (colorStops) => { setSingleColorStops2(colorStops); }; @@ -41,7 +41,7 @@ export default () => { { stop: 10, color: '#D36086' }, ]); - const handleSingleChange3 = colorStops => { + const handleSingleChange3 = (colorStops) => { setSingleColorStops3(colorStops); }; diff --git a/src-docs/src/views/combo_box/async.js b/src-docs/src/views/combo_box/async.js index ce657888891..90c58dff646 100644 --- a/src-docs/src/views/combo_box/async.js +++ b/src-docs/src/views/combo_box/async.js @@ -43,11 +43,11 @@ export default () => { const [isLoading, setLoading] = useState(false); const [options, setOptions] = useState([]); let searchTimeout; - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; - const onSearchChange = useCallback(searchValue => { + const onSearchChange = useCallback((searchValue) => { setLoading(true); setOptions([]); @@ -58,7 +58,7 @@ export default () => { // Simulate a remotely-executed search. setLoading(false); setOptions( - allOptions.filter(option => + allOptions.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) ) ); @@ -79,7 +79,7 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.value.trim().toLowerCase() === normalizedSearchValue + (option) => option.value.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { // Simulate creating this option on the server. @@ -88,7 +88,7 @@ export default () => { } // Select the option. - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; useEffect(() => { diff --git a/src-docs/src/views/combo_box/colors.js b/src-docs/src/views/combo_box/colors.js index 4f876f845d1..24cc0df2c11 100644 --- a/src-docs/src/views/combo_box/colors.js +++ b/src-docs/src/views/combo_box/colors.js @@ -53,7 +53,7 @@ export default () => { const [options, setOptions] = useState(optionsStatic); const [selectedOptions, setSelected] = useState([options[2], options[5]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -75,14 +75,14 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { setOptions([...options, newOption]); } // Select the option. - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; return ( diff --git a/src-docs/src/views/combo_box/combo_box.js b/src-docs/src/views/combo_box/combo_box.js index 08d8a2aeaee..766a73b06e3 100644 --- a/src-docs/src/views/combo_box/combo_box.js +++ b/src-docs/src/views/combo_box/combo_box.js @@ -42,7 +42,7 @@ export default () => { const [options, setOptions] = useState(optionsStatic); const [selectedOptions, setSelected] = useState([options[2], options[4]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -60,7 +60,7 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { setOptions([...options, newOption]); diff --git a/src-docs/src/views/combo_box/combo_box_delimiter.js b/src-docs/src/views/combo_box/combo_box_delimiter.js index 1a8536b2e14..40ca5f262e1 100644 --- a/src-docs/src/views/combo_box/combo_box_delimiter.js +++ b/src-docs/src/views/combo_box/combo_box_delimiter.js @@ -42,7 +42,7 @@ export default () => { const [options, setOptions] = useState(staticOptions); const [selectedOptions, setSelected] = useState([options[2], options[4]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -60,7 +60,7 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { setOptions([...options, newOption]); @@ -69,7 +69,7 @@ export default () => { // Select the option. // Use the previousState parameter (prevSelected) from the setState // instance (setSelected) to ensure looped calls do not override each other - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; return ( diff --git a/src-docs/src/views/combo_box/combo_box_duplicates.js b/src-docs/src/views/combo_box/combo_box_duplicates.js index 36ff2ade2b4..6564cc409d8 100644 --- a/src-docs/src/views/combo_box/combo_box_duplicates.js +++ b/src-docs/src/views/combo_box/combo_box_duplicates.js @@ -27,7 +27,7 @@ export default () => { const [options, setOptions] = useState(optionsStatic); const [selectedOptions, setSelected] = useState([options[2], options[4]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -45,7 +45,7 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { setOptions([...options, newOption]); diff --git a/src-docs/src/views/combo_box/containers.js b/src-docs/src/views/combo_box/containers.js index 0f84e859fea..de12e482761 100644 --- a/src-docs/src/views/combo_box/containers.js +++ b/src-docs/src/views/combo_box/containers.js @@ -70,7 +70,7 @@ export default () => { setPopover(false); }; - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -92,14 +92,14 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { setOptions([...options, newOption]); } // Select the option. - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; const comboBox = ( diff --git a/src-docs/src/views/combo_box/custom_options_only.js b/src-docs/src/views/combo_box/custom_options_only.js index 205c0552231..26314eab4bc 100644 --- a/src-docs/src/views/combo_box/custom_options_only.js +++ b/src-docs/src/views/combo_box/custom_options_only.js @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { EuiComboBox, EuiFormRow } from '../../../../src/components'; -const isValid = value => { +const isValid = (value) => { // Only allow letters. No spaces, numbers, or special characters. return value.match(/^[a-zA-Z]+$/) !== null; }; @@ -11,7 +11,7 @@ export default () => { const [selectedOptions, setSelected] = useState([]); const [isInvalid, setInvalid] = useState(false); - const onCreateOption = searchValue => { + const onCreateOption = (searchValue) => { if (!isValid(searchValue)) { // Return false to explicitly reject the user's input. return false; @@ -25,7 +25,7 @@ export default () => { setSelected([...selectedOptions, newOption]); }; - const onSearchChange = searchValue => { + const onSearchChange = (searchValue) => { if (!searchValue) { setInvalid(false); @@ -35,7 +35,7 @@ export default () => { setInvalid(!isValid(searchValue)); }; - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); setInvalid(false); }; diff --git a/src-docs/src/views/combo_box/disabled.js b/src-docs/src/views/combo_box/disabled.js index 66d94b65749..2ba24c5553e 100644 --- a/src-docs/src/views/combo_box/disabled.js +++ b/src-docs/src/views/combo_box/disabled.js @@ -41,7 +41,7 @@ export default () => { const [selectedOptions, setSelected] = useState([options[2], options[4]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -59,14 +59,14 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { updateOptions([...options, newOption]); } // Select the option. - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; return ( diff --git a/src-docs/src/views/combo_box/disallow_custom_options.js b/src-docs/src/views/combo_box/disallow_custom_options.js index ad743f56e31..8cb6945c727 100644 --- a/src-docs/src/views/combo_box/disallow_custom_options.js +++ b/src-docs/src/views/combo_box/disallow_custom_options.js @@ -42,7 +42,7 @@ export default () => { const [error, setError] = useState(undefined); const [inputRef, setInputRef] = useState(undefined); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); setError(undefined); }; diff --git a/src-docs/src/views/combo_box/groups.js b/src-docs/src/views/combo_box/groups.js index d1d12bcc6e7..8e5c3b4729c 100644 --- a/src-docs/src/views/combo_box/groups.js +++ b/src-docs/src/views/combo_box/groups.js @@ -47,7 +47,7 @@ export default () => { soundGroup.options[3], ]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -69,7 +69,7 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { if (allOptions[allOptions.length - 1].label !== 'Custom') { diff --git a/src-docs/src/views/combo_box/render_option.js b/src-docs/src/views/combo_box/render_option.js index 28cb9cf1e5f..b3fe6e07d98 100644 --- a/src-docs/src/views/combo_box/render_option.js +++ b/src-docs/src/views/combo_box/render_option.js @@ -91,7 +91,7 @@ export default () => { const [options, setOptions] = useState(optionsStatic); const [selectedOptions, setSelected] = useState([options[2], options[5]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -114,7 +114,7 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { options.push(newOption); @@ -122,7 +122,7 @@ export default () => { } // Select the option. - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; const renderOption = (option, searchValue, contentClassName) => { diff --git a/src-docs/src/views/combo_box/single_selection.js b/src-docs/src/views/combo_box/single_selection.js index 3da807d85b5..daca4a28f0d 100644 --- a/src-docs/src/views/combo_box/single_selection.js +++ b/src-docs/src/views/combo_box/single_selection.js @@ -41,7 +41,7 @@ const options = [ export default () => { const [selectedOptions, setSelected] = useState([options[2]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { // We should only get back either 0 or 1 options. setSelected(selectedOptions); }; diff --git a/src-docs/src/views/combo_box/single_selection_custom_options.js b/src-docs/src/views/combo_box/single_selection_custom_options.js index 57a3eee84b5..587e3ceb29e 100644 --- a/src-docs/src/views/combo_box/single_selection_custom_options.js +++ b/src-docs/src/views/combo_box/single_selection_custom_options.js @@ -30,7 +30,7 @@ const options = [ export default () => { const [selectedOptions, setSelected] = useState([options[2]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { // We should only get back either 0 or 1 options. setSelected(selectedOptions); }; diff --git a/src-docs/src/views/combo_box/startingWith.js b/src-docs/src/views/combo_box/startingWith.js index 9e40ddc92f5..be2954dfa8e 100644 --- a/src-docs/src/views/combo_box/startingWith.js +++ b/src-docs/src/views/combo_box/startingWith.js @@ -42,7 +42,7 @@ export default () => { const [options, setOptions] = useState(optionsStatic); const [selectedOptions, setSelected] = useState([options[2], options[4]]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; @@ -60,14 +60,14 @@ export default () => { // Create the option if it doesn't exist. if ( flattenedOptions.findIndex( - option => option.label.trim().toLowerCase() === normalizedSearchValue + (option) => option.label.trim().toLowerCase() === normalizedSearchValue ) === -1 ) { setOptions([...options, newOption]); } // Select the option. - setSelected(prevSelected => [...prevSelected, newOption]); + setSelected((prevSelected) => [...prevSelected, newOption]); }; return ( diff --git a/src-docs/src/views/combo_box/virtualized.js b/src-docs/src/views/combo_box/virtualized.js index 143e2fd83fb..81e60fac953 100644 --- a/src-docs/src/views/combo_box/virtualized.js +++ b/src-docs/src/views/combo_box/virtualized.js @@ -18,7 +18,7 @@ for (let i = 1; i < 5000; i++) { export default () => { const [selectedOptions, setSelected] = useState([]); - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); }; diff --git a/src-docs/src/views/comment/comment_actions.tsx b/src-docs/src/views/comment/comment_actions.tsx index 1a31073d6a6..42512c2dfd2 100644 --- a/src-docs/src/views/comment/comment_actions.tsx +++ b/src-docs/src/views/comment/comment_actions.tsx @@ -30,7 +30,7 @@ export default class extends Component { }; togglePopover = () => { - this.setState(prevState => ({ + this.setState((prevState) => ({ isPopoverOpen: !prevState.isPopoverOpen, })); }; diff --git a/src-docs/src/views/context_menu/context_menu_with_content.js b/src-docs/src/views/context_menu/context_menu_with_content.js index 1212fb59ec8..163bb3f5d69 100644 --- a/src-docs/src/views/context_menu/context_menu_with_content.js +++ b/src-docs/src/views/context_menu/context_menu_with_content.js @@ -15,7 +15,7 @@ function flattenPanelTree(tree, array = []) { array.push(tree); if (tree.items) { - tree.items.forEach(item => { + tree.items.forEach((item) => { if (item.panel) { flattenPanelTree(item.panel, array); item.panel = item.panel.id; @@ -46,7 +46,7 @@ export default () => { setDynamicPopover(false); }; - const createPanelTree = Content => { + const createPanelTree = (Content) => { return flattenPanelTree({ id: 0, title: 'View options', diff --git a/src-docs/src/views/copy/copy.js b/src-docs/src/views/copy/copy.js index 043659957b5..1a2812e4ada 100644 --- a/src-docs/src/views/copy/copy.js +++ b/src-docs/src/views/copy/copy.js @@ -11,7 +11,7 @@ import { export default () => { const [copyText, setCopyText] = useState('I am the text that will be copied'); - const onChange = e => { + const onChange = (e) => { setCopyText(e.target.value); }; @@ -24,7 +24,9 @@ export default () => { - {copy => Click to copy input text} + {(copy) => ( + Click to copy input text + )}
); diff --git a/src-docs/src/views/datagrid/additional_controls.js b/src-docs/src/views/datagrid/additional_controls.js index 62c69d0ca4f..82f73f448d4 100644 --- a/src-docs/src/views/datagrid/additional_controls.js +++ b/src-docs/src/views/datagrid/additional_controls.js @@ -47,11 +47,11 @@ export default () => { ); const setPageIndex = useCallback( - pageIndex => setPagination({ ...pagination, pageIndex }), + (pageIndex) => setPagination({ ...pagination, pageIndex }), [pagination, setPagination] ); const setPageSize = useCallback( - pageSize => setPagination({ ...pagination, pageSize, pageIndex: 0 }), + (pageSize) => setPagination({ ...pagination, pageSize, pageIndex: 0 }), [pagination, setPagination] ); diff --git a/src-docs/src/views/datagrid/column_actions.js b/src-docs/src/views/datagrid/column_actions.js index a5143dbf38d..b2e2d117f29 100644 --- a/src-docs/src/views/datagrid/column_actions.js +++ b/src-docs/src/views/datagrid/column_actions.js @@ -78,11 +78,11 @@ export default () => { ); const setPageIndex = useCallback( - pageIndex => setPagination({ ...pagination, pageIndex }), + (pageIndex) => setPagination({ ...pagination, pageIndex }), [pagination, setPagination] ); const setPageSize = useCallback( - pageSize => setPagination({ ...pagination, pageSize, pageIndex: 0 }), + (pageSize) => setPagination({ ...pagination, pageSize, pageIndex: 0 }), [pagination, setPagination] ); diff --git a/src-docs/src/views/datagrid/column_widths.js b/src-docs/src/views/datagrid/column_widths.js index 2d0d5ed6159..161eba3af8e 100644 --- a/src-docs/src/views/datagrid/column_widths.js +++ b/src-docs/src/views/datagrid/column_widths.js @@ -54,11 +54,11 @@ export default () => { ); const setPageIndex = useCallback( - pageIndex => setPagination({ ...pagination, pageIndex }), + (pageIndex) => setPagination({ ...pagination, pageIndex }), [pagination, setPagination] ); const setPageSize = useCallback( - pageSize => setPagination({ ...pagination, pageSize, pageIndex: 0 }), + (pageSize) => setPagination({ ...pagination, pageSize, pageIndex: 0 }), [pagination, setPagination] ); diff --git a/src-docs/src/views/datagrid/container.js b/src-docs/src/views/datagrid/container.js index 9e3727053a3..26ae4672a48 100644 --- a/src-docs/src/views/datagrid/container.js +++ b/src-docs/src/views/datagrid/container.js @@ -43,11 +43,11 @@ export default () => { ); const setPageIndex = useCallback( - pageIndex => setPagination({ ...pagination, pageIndex }), + (pageIndex) => setPagination({ ...pagination, pageIndex }), [pagination, setPagination] ); const setPageSize = useCallback( - pageSize => setPagination({ ...pagination, pageSize, pageIndex: 0 }), + (pageSize) => setPagination({ ...pagination, pageSize, pageIndex: 0 }), [pagination, setPagination] ); diff --git a/src-docs/src/views/datagrid/control_columns.js b/src-docs/src/views/datagrid/control_columns.js index a9ebbfb4cca..169495fdd86 100644 --- a/src-docs/src/views/datagrid/control_columns.js +++ b/src-docs/src/views/datagrid/control_columns.js @@ -144,7 +144,7 @@ const SelectionHeaderCell = () => { aria-label="Select all rows" indeterminate={isIndeterminate} checked={selectedRows.size > 0} - onChange={e => { + onChange={(e) => { if (isIndeterminate) { // clear selection updateSelectedRows({ action: 'clear' }); @@ -172,7 +172,7 @@ const SelectionRowCell = ({ rowIndex }) => { id={`${rowIndex}`} aria-label={`Select row ${rowIndex}, ${data[rowIndex].name}`} checked={isChecked} - onChange={e => { + onChange={(e) => { if (e.target.checked) { updateSelectedRows({ action: 'add', rowIndex }); } else { @@ -184,7 +184,7 @@ const SelectionRowCell = ({ rowIndex }) => { ); }; -const FlyoutRowCell = rowIndex => { +const FlyoutRowCell = (rowIndex) => { let flyout; const [isFlyoutOpen, setIsFlyoutOpen] = useState(false); if (isFlyoutOpen) { @@ -315,11 +315,11 @@ export default function DataGrid() { pageSize: 15, }); const setPageIndex = useCallback( - pageIndex => setPagination({ ...pagination, pageIndex }), + (pageIndex) => setPagination({ ...pagination, pageIndex }), [pagination, setPagination] ); const setPageSize = useCallback( - pageSize => setPagination({ ...pagination, pageSize, pageIndex: 0 }), + (pageSize) => setPagination({ ...pagination, pageSize, pageIndex: 0 }), [pagination, setPagination] ); diff --git a/src-docs/src/views/datagrid/datagrid.js b/src-docs/src/views/datagrid/datagrid.js index 1322ccd7f11..38f299b6158 100644 --- a/src-docs/src/views/datagrid/datagrid.js +++ b/src-docs/src/views/datagrid/datagrid.js @@ -156,19 +156,24 @@ export default () => { // ** Pagination config const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const onChangeItemsPerPage = useCallback( - pageSize => - setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })), + (pageSize) => + setPagination((pagination) => ({ + ...pagination, + pageSize, + pageIndex: 0, + })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); // ** Sorting config const [sortingColumns, setSortingColumns] = useState([]); const onSort = useCallback( - sortingColumns => { + (sortingColumns) => { setSortingColumns(sortingColumns); }, [setSortingColumns] @@ -219,7 +224,7 @@ export default () => { onChangeItemsPerPage: onChangeItemsPerPage, onChangePage: onChangePage, }} - onColumnResize={eventData => { + onColumnResize={(eventData) => { console.log(eventData); }} /> diff --git a/src-docs/src/views/datagrid/focus.js b/src-docs/src/views/datagrid/focus.js index 79932b66ee7..4008f25af6d 100644 --- a/src-docs/src/views/datagrid/focus.js +++ b/src-docs/src/views/datagrid/focus.js @@ -58,7 +58,7 @@ for (let i = 0; i < 10; i++) { ]); } -const renderHeaderIcon = areHeadersInteractive => +const renderHeaderIcon = (areHeadersInteractive) => areHeadersInteractive ? ( export default () => { const [areHeadersInteractive, setAreHeadersInteractive] = useState(false); const switchInteractiveHeaders = useCallback( - e => setAreHeadersInteractive(e.target.checked), + (e) => setAreHeadersInteractive(e.target.checked), [setAreHeadersInteractive] ); @@ -225,11 +225,12 @@ export default () => { pageSizeOptions: [4], }); const onChangeItemsPerPage = useCallback( - pageSize => setPagination(pagination => ({ ...pagination, pageSize })), + (pageSize) => setPagination((pagination) => ({ ...pagination, pageSize })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); diff --git a/src-docs/src/views/datagrid/footer_row.js b/src-docs/src/views/datagrid/footer_row.js index a15c5794b52..6d7a247ebe9 100644 --- a/src-docs/src/views/datagrid/footer_row.js +++ b/src-docs/src/views/datagrid/footer_row.js @@ -57,12 +57,17 @@ export default () => { // ** Pagination config const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const onChangeItemsPerPage = useCallback( - pageSize => - setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })), + (pageSize) => + setPagination((pagination) => ({ + ...pagination, + pageSize, + pageIndex: 0, + })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); @@ -109,7 +114,7 @@ export default () => { setShowFooterRow(e.target.checked)} + onChange={(e) => setShowFooterRow(e.target.checked)} /> @@ -128,7 +133,7 @@ export default () => { onChangeItemsPerPage: onChangeItemsPerPage, onChangePage: onChangePage, }} - onColumnResize={eventData => { + onColumnResize={(eventData) => { console.log(eventData); }} gridStyle={{ diff --git a/src-docs/src/views/datagrid/in_memory.js b/src-docs/src/views/datagrid/in_memory.js index 0730b764ee5..b523d0eb95f 100644 --- a/src-docs/src/views/datagrid/in_memory.js +++ b/src-docs/src/views/datagrid/in_memory.js @@ -57,19 +57,24 @@ export default () => { // ** Pagination config const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const onChangeItemsPerPage = useCallback( - pageSize => - setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })), + (pageSize) => + setPagination((pagination) => ({ + ...pagination, + pageSize, + pageIndex: 0, + })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); // ** Sorting config const [sortingColumns, setSortingColumns] = useState([]); const onSort = useCallback( - sortingColumns => { + (sortingColumns) => { setSortingColumns(sortingColumns); }, [setSortingColumns] diff --git a/src-docs/src/views/datagrid/in_memory_enhancements.js b/src-docs/src/views/datagrid/in_memory_enhancements.js index 559f63fd329..4ef6f0a0b53 100644 --- a/src-docs/src/views/datagrid/in_memory_enhancements.js +++ b/src-docs/src/views/datagrid/in_memory_enhancements.js @@ -56,19 +56,24 @@ export default () => { // ** Pagination config const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const onChangeItemsPerPage = useCallback( - pageSize => - setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })), + (pageSize) => + setPagination((pagination) => ({ + ...pagination, + pageSize, + pageIndex: 0, + })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); // ** Sorting config const [sortingColumns, setSortingColumns] = useState([]); const onSort = useCallback( - sortingColumns => { + (sortingColumns) => { setSortingColumns(sortingColumns); }, [setSortingColumns] diff --git a/src-docs/src/views/datagrid/in_memory_pagination.js b/src-docs/src/views/datagrid/in_memory_pagination.js index 59e2b6a4648..354399b3a94 100644 --- a/src-docs/src/views/datagrid/in_memory_pagination.js +++ b/src-docs/src/views/datagrid/in_memory_pagination.js @@ -56,19 +56,24 @@ export default () => { // ** Pagination config const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const onChangeItemsPerPage = useCallback( - pageSize => - setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })), + (pageSize) => + setPagination((pagination) => ({ + ...pagination, + pageSize, + pageIndex: 0, + })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); // ** Sorting config const [sortingColumns, setSortingColumns] = useState([]); const onSort = useCallback( - sortingColumns => { + (sortingColumns) => { setSortingColumns(sortingColumns); }, [setSortingColumns] diff --git a/src-docs/src/views/datagrid/in_memory_sorting.js b/src-docs/src/views/datagrid/in_memory_sorting.js index 65ee297fcb1..c7ac04261d4 100644 --- a/src-docs/src/views/datagrid/in_memory_sorting.js +++ b/src-docs/src/views/datagrid/in_memory_sorting.js @@ -56,19 +56,24 @@ export default () => { // ** Pagination config const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 }); const onChangeItemsPerPage = useCallback( - pageSize => - setPagination(pagination => ({ ...pagination, pageSize, pageIndex: 0 })), + (pageSize) => + setPagination((pagination) => ({ + ...pagination, + pageSize, + pageIndex: 0, + })), [setPagination] ); const onChangePage = useCallback( - pageIndex => setPagination(pagination => ({ ...pagination, pageIndex })), + (pageIndex) => + setPagination((pagination) => ({ ...pagination, pageIndex })), [setPagination] ); // ** Sorting config const [sortingColumns, setSortingColumns] = useState([]); const onSort = useCallback( - sortingColumns => { + (sortingColumns) => { setSortingColumns(sortingColumns); }, [setSortingColumns] diff --git a/src-docs/src/views/datagrid/schema.js b/src-docs/src/views/datagrid/schema.js index 3a5823ef879..9488369bcaf 100644 --- a/src-docs/src/views/datagrid/schema.js +++ b/src-docs/src/views/datagrid/schema.js @@ -74,7 +74,7 @@ for (let i = 1; i < 5; i++) { }); } -const Franchise = props => { +const Franchise = (props) => { return (
@@ -121,7 +121,7 @@ export default class DataGridSchema extends Component { }; } - setSorting = sortingColumns => { + setSorting = (sortingColumns) => { const data = [...this.state.data].sort((a, b) => { for (let i = 0; i < sortingColumns.length; i++) { const column = sortingColumns[i]; @@ -138,17 +138,17 @@ export default class DataGridSchema extends Component { this.setState({ data, sortingColumns }); }; - setPageIndex = pageIndex => + setPageIndex = (pageIndex) => this.setState(({ pagination }) => ({ pagination: { ...pagination, pageIndex }, })); - setPageSize = pageSize => + setPageSize = (pageSize) => this.setState(({ pagination }) => ({ pagination: { ...pagination, pageSize, pageIndex: 0 }, })); - setVisibleColumns = visibleColumns => this.setState({ visibleColumns }); + setVisibleColumns = (visibleColumns) => this.setState({ visibleColumns }); dummyIcon = () => ( + return stringContents.replace(/((\d{3})+)$/, (match) => // then replace each group of xyz digits with ,xyz match.replace(/(\d{3})/g, ',$1') ); diff --git a/src-docs/src/views/datagrid/styling.js b/src-docs/src/views/datagrid/styling.js index 8a776030638..c50c85f0e61 100644 --- a/src-docs/src/views/datagrid/styling.js +++ b/src-docs/src/views/datagrid/styling.js @@ -273,91 +273,91 @@ export default class DataGrid extends Component { }; } - onBorderChange = optionId => { + onBorderChange = (optionId) => { this.setState({ borderSelected: optionId, }); }; - onFontSizeChange = optionId => { + onFontSizeChange = (optionId) => { this.setState({ fontSizeSelected: optionId, }); }; - onCellPaddingChange = optionId => { + onCellPaddingChange = (optionId) => { this.setState({ cellPaddingSelected: optionId, }); }; - onStripesChange = optionId => { + onStripesChange = (optionId) => { this.setState({ stripesSelected: optionId === 'true', }); }; - onRowHoverChange = optionId => { + onRowHoverChange = (optionId) => { this.setState({ rowHoverSelected: optionId, }); }; - onHeaderChange = optionId => { + onHeaderChange = (optionId) => { this.setState({ headerSelected: optionId, }); }; - onFooterChange = optionId => { + onFooterChange = (optionId) => { this.setState({ footerSelected: optionId, }); }; - onShowSortSelectorChange = optionId => { + onShowSortSelectorChange = (optionId) => { this.setState({ showSortSelector: optionId === 'true', }); }; - onShowStyleSelectorChange = optionId => { + onShowStyleSelectorChange = (optionId) => { this.setState({ showStyleSelector: optionId === 'true', }); }; - onShowColumnSelectorChange = optionId => { + onShowColumnSelectorChange = (optionId) => { this.setState({ showColumnSelector: optionId === 'true', }); }; - onAllowHideColumnsChange = optionId => { + onAllowHideColumnsChange = (optionId) => { this.setState({ allowHideColumns: optionId === 'true', }); }; - onAllowOrderingColumnsChange = optionId => { + onAllowOrderingColumnsChange = (optionId) => { this.setState({ allowOrderingColumns: optionId === 'true', }); }; - onShowFullScreenSelectorChange = optionId => { + onShowFullScreenSelectorChange = (optionId) => { this.setState({ showFullScreenSelector: optionId === 'true', }); }; - onShowToolbarChange = optionId => { + onShowToolbarChange = (optionId) => { this.setState({ showToolbar: optionId === 'true', }); }; - onToolbarPropTypeIsBooleanChange = optionId => { + onToolbarPropTypeIsBooleanChange = (optionId) => { this.setState({ toolbarPropTypeIsBoolean: optionId === 'true', }); @@ -387,17 +387,17 @@ export default class DataGrid extends Component { }); } - setPageIndex = pageIndex => + setPageIndex = (pageIndex) => this.setState(({ pagination }) => ({ pagination: { ...pagination, pageIndex }, })); - setPageSize = pageSize => + setPageSize = (pageSize) => this.setState(({ pagination }) => ({ pagination: { ...pagination, pageSize, pageIndex: 0 }, })); - setVisibleColumns = visibleColumns => this.setState({ visibleColumns }); + setVisibleColumns = (visibleColumns) => this.setState({ visibleColumns }); render() { const { pagination } = this.state; diff --git a/src-docs/src/views/date_picker/classes.js b/src-docs/src/views/date_picker/classes.js index 606a1c3c7e5..77ec572c447 100644 --- a/src-docs/src/views/date_picker/classes.js +++ b/src-docs/src/views/date_picker/classes.js @@ -11,7 +11,7 @@ import { export default () => { const [startDate, setStartDate] = useState(moment()); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; @@ -44,7 +44,7 @@ export default () => { selected={startDate} showTimeSelect onChange={handleChange} - dayClassName={date => + dayClassName={(date) => date.date() < Math.random() * 31 ? 'dpTest__purpleDay' : undefined } /> diff --git a/src-docs/src/views/date_picker/date_picker.js b/src-docs/src/views/date_picker/date_picker.js index ea69a701547..a145fb00057 100644 --- a/src-docs/src/views/date_picker/date_picker.js +++ b/src-docs/src/views/date_picker/date_picker.js @@ -7,7 +7,7 @@ import { EuiDatePicker, EuiFormRow } from '../../../../src/components'; export default () => { const [startDate, setStartDate] = useState(moment()); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; diff --git a/src-docs/src/views/date_picker/inline.js b/src-docs/src/views/date_picker/inline.js index 7a3682ffb6b..f660d9351a5 100644 --- a/src-docs/src/views/date_picker/inline.js +++ b/src-docs/src/views/date_picker/inline.js @@ -7,7 +7,7 @@ import { EuiDatePicker } from '../../../../src/components'; export default () => { const [startDate, setStartDate] = useState(moment()); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; diff --git a/src-docs/src/views/date_picker/locale.js b/src-docs/src/views/date_picker/locale.js index 47c8e856149..06314be3a0a 100644 --- a/src-docs/src/views/date_picker/locale.js +++ b/src-docs/src/views/date_picker/locale.js @@ -11,7 +11,7 @@ import { export default () => { const [startDate, setStartDate] = useState(moment()); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; diff --git a/src-docs/src/views/date_picker/min_max.js b/src-docs/src/views/date_picker/min_max.js index 8e545dc24e7..34835639c52 100644 --- a/src-docs/src/views/date_picker/min_max.js +++ b/src-docs/src/views/date_picker/min_max.js @@ -82,12 +82,8 @@ export default class extends Component { showTimeSelect selected={this.state.startDate2} onChange={this.handleChange2} - minTime={moment() - .hours(17) - .minutes(0)} - maxTime={moment() - .hours(20) - .minutes(30)} + minTime={moment().hours(17).minutes(0)} + maxTime={moment().hours(20).minutes(30)} /> @@ -110,12 +106,8 @@ export default class extends Component { selected={this.state.startDate4} onChange={this.handleChange4} excludeTimes={[ - moment() - .hours(0) - .minutes(0), - moment() - .hours(17) - .minutes(0), + moment().hours(0).minutes(0), + moment().hours(17).minutes(0), ]} /> diff --git a/src-docs/src/views/date_picker/open_to_date.js b/src-docs/src/views/date_picker/open_to_date.js index 75e47dfb3c4..48b03d7fff4 100644 --- a/src-docs/src/views/date_picker/open_to_date.js +++ b/src-docs/src/views/date_picker/open_to_date.js @@ -7,7 +7,7 @@ import { EuiDatePicker, EuiFormRow } from '../../../../src/components'; export default () => { const [startDate, setStartDate] = useState(null); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; diff --git a/src-docs/src/views/date_picker/states.js b/src-docs/src/views/date_picker/states.js index ee2e1abfa4c..dbca3463c0d 100644 --- a/src-docs/src/views/date_picker/states.js +++ b/src-docs/src/views/date_picker/states.js @@ -10,7 +10,7 @@ import { DisplayToggles } from '../form_controls/display_toggles'; export default () => { const [startDate, setStartDate] = useState(null); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; diff --git a/src-docs/src/views/date_picker/time_select.js b/src-docs/src/views/date_picker/time_select.js index d0a86a49ff4..163c60a6525 100644 --- a/src-docs/src/views/date_picker/time_select.js +++ b/src-docs/src/views/date_picker/time_select.js @@ -11,7 +11,7 @@ import { export default () => { const [startDate, setStartDate] = useState(moment()); - const handleChange = date => { + const handleChange = (date) => { setStartDate(date); }; @@ -49,15 +49,9 @@ export default () => { dateFormat="hh:mm a" timeFormat="hh:mm a" injectTimes={[ - moment() - .hours(0) - .minutes(1), - moment() - .hours(0) - .minutes(5), - moment() - .hours(23) - .minutes(59), + moment().hours(0).minutes(1), + moment().hours(0).minutes(5), + moment().hours(23).minutes(59), ]} /> diff --git a/src-docs/src/views/date_picker/utc.js b/src-docs/src/views/date_picker/utc.js index 1edc144b145..215be8acd73 100644 --- a/src-docs/src/views/date_picker/utc.js +++ b/src-docs/src/views/date_picker/utc.js @@ -27,13 +27,13 @@ export default class extends Component { this.onSelectChange = this.onSelectChange.bind(this); } - onSelectChange = e => { + onSelectChange = (e) => { this.setState({ utcOffset: parseInt(e.target.value, 10), }); }; - handleChange = date => { + handleChange = (date) => { this.setState({ startDate: date, }); diff --git a/src-docs/src/views/delay_render/delay_hide.js b/src-docs/src/views/delay_render/delay_hide.js index ae888613f85..df13fa142a3 100644 --- a/src-docs/src/views/delay_render/delay_hide.js +++ b/src-docs/src/views/delay_render/delay_hide.js @@ -12,11 +12,11 @@ export default () => { const [minimumDuration, setDuration] = useState(3000); const [hide, setHide] = useState(false); - const onChangeMinimumDuration = event => { + const onChangeMinimumDuration = (event) => { setDuration(parseInt(event.target.value, 10)); }; - const onChangeHide = event => { + const onChangeHide = (event) => { setHide(event.target.checked); }; diff --git a/src-docs/src/views/delay_render/delay_render.js b/src-docs/src/views/delay_render/delay_render.js index ff175f46bb6..87520ca01ad 100644 --- a/src-docs/src/views/delay_render/delay_render.js +++ b/src-docs/src/views/delay_render/delay_render.js @@ -12,11 +12,11 @@ export default () => { const [minimumDelay, setDelay] = useState(3000); const [render, setRender] = useState(false); - const onChangeMinimumDelay = event => { + const onChangeMinimumDelay = (event) => { setDelay(parseInt(event.target.value, 10)); }; - const onChangeHide = event => { + const onChangeHide = (event) => { setRender(event.target.checked); }; diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop.js b/src-docs/src/views/drag_and_drop/drag_and_drop.js index 50cf5b3531e..f68f9b444c3 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop.js @@ -11,7 +11,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop_bare.js b/src-docs/src/views/drag_and_drop/drag_and_drop_bare.js index e33c16541cb..a39b661ec09 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop_bare.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop_bare.js @@ -9,7 +9,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop_clone.js b/src-docs/src/views/drag_and_drop/drag_and_drop_clone.js index 451fb60f38c..3008b882f63 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop_clone.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop_clone.js @@ -16,7 +16,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop_complex.js b/src-docs/src/views/drag_and_drop/drag_and_drop_complex.js index 7d6a33a9b6f..48c03dfd079 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop_complex.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop_complex.js @@ -13,7 +13,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), @@ -77,7 +77,7 @@ export default () => { style={{ flex: '1 0 50%' }} disableInteractiveElementBlocking // Allows button to be drag handle > - {provided => ( + {(provided) => ( - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), @@ -43,7 +43,7 @@ export default () => { index={idx} draggableId={id} customDragHandle={true}> - {provided => ( + {(provided) => ( diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop_disable_blocking.js b/src-docs/src/views/drag_and_drop/drag_and_drop_disable_blocking.js index 3fa2d00b308..5b49b1bcdab 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop_disable_blocking.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop_disable_blocking.js @@ -11,7 +11,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop_move_lists.js b/src-docs/src/views/drag_and_drop/drag_and_drop_move_lists.js index 4f84222f4dc..75e35689a94 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop_move_lists.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop_move_lists.js @@ -15,7 +15,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), diff --git a/src-docs/src/views/drag_and_drop/drag_and_drop_types.js b/src-docs/src/views/drag_and_drop/drag_and_drop_types.js index 990c028389b..2d146561269 100644 --- a/src-docs/src/views/drag_and_drop/drag_and_drop_types.js +++ b/src-docs/src/views/drag_and_drop/drag_and_drop_types.js @@ -14,7 +14,7 @@ import { htmlIdGenerator } from '../../../../src/services'; const makeId = htmlIdGenerator(); const makeList = (number, start = 1) => - Array.from({ length: number }, (v, k) => k + start).map(el => { + Array.from({ length: number }, (v, k) => k + start).map((el) => { return { content: `Item ${el}`, id: makeId(), diff --git a/src-docs/src/views/elastic_charts/category_chart.js b/src-docs/src/views/elastic_charts/category_chart.js index 0506c808afd..1e2c907d786 100644 --- a/src-docs/src/views/elastic_charts/category_chart.js +++ b/src-docs/src/views/elastic_charts/category_chart.js @@ -38,25 +38,25 @@ export const CategoryChart = () => { const [formatted, setFormatted] = useState(false); const [chartType, setChartType] = useState('BarSeries'); - const onMultiChange = multiObject => { + const onMultiChange = (multiObject) => { const { multi, stacked } = multiObject; setMulti(multi); setStacked(stacked); }; - const onRotatedChange = e => { + const onRotatedChange = (e) => { setRotated(e.target.checked); }; - const onOrderedChange = e => { + const onOrderedChange = (e) => { setOrdered(e.target.checked); }; - const onFormatChange = e => { + const onFormatChange = (e) => { setFormatted(e.target.checked); }; - const onChartTypeChange = chartType => { + const onChartTypeChange = (chartType) => { setChartType(chartType); }; @@ -109,7 +109,7 @@ export const CategoryChart = () => { id="left-axis" position={rotated ? 'bottom' : 'left'} tickFormat={ - formatted ? d => `${round(Number(d) / 1000, 2)}k` : undefined + formatted ? (d) => `${round(Number(d) / 1000, 2)}k` : undefined } /> @@ -204,7 +204,7 @@ export const CategoryChart = () => { ${formatted ? 'tickFormat={d => `${round(Number(d) / 1000, 2)}k`}' : ''} /> `}> - {copy => ( + {(copy) => ( Copy code of current configuration diff --git a/src-docs/src/views/elastic_charts/pie.js b/src-docs/src/views/elastic_charts/pie.js index 41cff00ae08..77afd9f371d 100644 --- a/src-docs/src/views/elastic_charts/pie.js +++ b/src-docs/src/views/elastic_charts/pie.js @@ -46,12 +46,12 @@ export default () => { count: 319, }, ]} - valueAccessor={d => d.count} + valueAccessor={(d) => d.count} layers={[ { - groupByRollup: d => d.status, + groupByRollup: (d) => d.status, shape: { - fillColor: d => + fillColor: (d) => euiChartTheme.theme.colors.vizColors[d.sortIndex], }, }, @@ -85,13 +85,13 @@ export default () => { percent: 8.7, }, ]} - valueAccessor={d => Number(d.percent)} + valueAccessor={(d) => Number(d.percent)} valueFormatter={() => ''} layers={[ { - groupByRollup: d => d.language, + groupByRollup: (d) => d.language, shape: { - fillColor: d => + fillColor: (d) => euiChartTheme.theme.colors.vizColors[d.sortIndex], }, }, diff --git a/src-docs/src/views/elastic_charts/pie_alts.js b/src-docs/src/views/elastic_charts/pie_alts.js index 74a18f7be43..a577136225d 100644 --- a/src-docs/src/views/elastic_charts/pie_alts.js +++ b/src-docs/src/views/elastic_charts/pie_alts.js @@ -67,7 +67,7 @@ export default () => { data = _.orderBy(DATASET, 'issueType', 'asc'); if (ordered) { - const totals = _.mapValues(_.groupBy(DATASET, 'vizType'), groups => + const totals = _.mapValues(_.groupBy(DATASET, 'vizType'), (groups) => _.sumBy(groups, 'count') ); @@ -79,7 +79,7 @@ export default () => { } } - const tickFormat = tick => { + const tickFormat = (tick) => { if (formatted) { return `${Number(tick * 100).toFixed(0)}%`; } else if (!grouped && String(tick).length > 1) { @@ -201,7 +201,7 @@ export default () => { setFormattedData(e.target.checked)} + onChange={(e) => setFormattedData(e.target.checked)} /> )} @@ -215,19 +215,19 @@ export default () => { setStacked(e.target.checked)} + onChange={(e) => setStacked(e.target.checked)} /> setGrouped(e.target.checked)} + onChange={(e) => setGrouped(e.target.checked)} /> setFormatted(e.target.checked)} + onChange={(e) => setFormatted(e.target.checked)} /> @@ -239,13 +239,13 @@ export default () => { setOrdered(e.target.checked)} + onChange={(e) => setOrdered(e.target.checked)} /> setRotated(e.target.checked)} + onChange={(e) => setRotated(e.target.checked)} /> @@ -302,7 +302,7 @@ export default () => { } /> `}> - {copy => ( + {(copy) => ( - {introCards.map(card => ( + {introCards.map((card) => ( { const [showLegend, setShowLegend] = useState(false); const [showValues, setShowValues] = useState(true); - const onNumChartsChange = e => { + const onNumChartsChange = (e) => { setNumSlices(e.target.value); }; - const onSliceOrderChange = optionId => { + const onSliceOrderChange = (optionId) => { const sliceOrderLabel = sliceOrderRadios.find(({ id }) => id === optionId) .label; if (sliceOrderLabel.includes('Counter')) { @@ -106,7 +106,7 @@ export default () => { setSliceOrderIdSelected(optionId); }; - const onGroupChange = e => { + const onGroupChange = (e) => { setGrouped(e.target.checked); }; @@ -149,14 +149,14 @@ export default () => { Number(d.percent)} + valueAccessor={(d) => Number(d.percent)} valueFormatter={showValues ? undefined : () => ''} valueGetter={showValues ? 'percent' : undefined} layers={[ { - groupByRollup: d => d.browser, + groupByRollup: (d) => d.browser, shape: { - fillColor: d => + fillColor: (d) => euiChartTheme.theme.colors.vizColors[d.sortIndex], }, }, @@ -180,7 +180,7 @@ export default () => { legend="Chart type" options={pieTypeRadios} idSelected={pieTypeIdSelected} - onChange={id => { + onChange={(id) => { setPieTypeIdSelected(id); }} buttonSize="compressed" @@ -197,13 +197,13 @@ export default () => { setShowValues(e.target.checked)} + onChange={(e) => setShowValues(e.target.checked)} /> setShowLegend(e.target.checked)} + onChange={(e) => setShowLegend(e.target.checked)} /> @@ -307,7 +307,7 @@ export default () => { }} /> `}> - {copy => ( + {(copy) => ( { ); }; -export const ChartTypeCard = props => { +export const ChartTypeCard = (props) => { const idPrefix = 'chartType'; const toggleButtonsIcons = [ @@ -74,7 +74,7 @@ export const ChartTypeCard = props => { const [toggleIdSelected, setToggleIdSelectd] = useState(`${idPrefix}0`); - const onChartTypeChange = optionId => { + const onChartTypeChange = (optionId) => { setToggleIdSelectd(optionId); const chartType = toggleButtonsIcons.find(({ id }) => id === optionId) @@ -111,11 +111,11 @@ ChartTypeCard.propTypes = { disabled: PropTypes.bool, }; -export const MultiChartCard = props => { +export const MultiChartCard = (props) => { const [multi, setMulti] = useState(false); const [stacked, setStacked] = useState(false); - const onMultiChange = e => { + const onMultiChange = (e) => { const isStacked = e.target.checked ? stacked : false; setMulti(e.target.checked); @@ -127,7 +127,7 @@ export const MultiChartCard = props => { }); }; - const onStackedChange = e => { + const onStackedChange = (e) => { setStacked(e.target.checked); props.onChange({ multi: multi, stacked: e.target.checked }); diff --git a/src-docs/src/views/elastic_charts/sizes.js b/src-docs/src/views/elastic_charts/sizes.js index 17146fd9c28..0c1b5beeb4a 100644 --- a/src-docs/src/views/elastic_charts/sizes.js +++ b/src-docs/src/views/elastic_charts/sizes.js @@ -56,25 +56,25 @@ export class Sizes extends Component { this.changePropsBasedOnWidth(100); }; - onStackedChange = e => { + onStackedChange = (e) => { this.setState({ stacked: e.target.checked, }); }; - onMultiChange = multiObject => { + onMultiChange = (multiObject) => { this.setState({ ...multiObject, }); }; - onChartTypeChange = optionId => { + onChartTypeChange = (optionId) => { this.setState({ toggleIdSelected: optionId, }); }; - onWidthChartsChange = e => { + onWidthChartsChange = (e) => { this.setState({ width: e.target.value, }); @@ -82,7 +82,7 @@ export class Sizes extends Component { this.changePropsBasedOnWidth(e.target.value); }; - changePropsBasedOnWidth = width => { + changePropsBasedOnWidth = (width) => { const data1 = TIME_DATA.slice(); const data2 = TIME_DATA_2.slice(); let tooltipProps; @@ -99,7 +99,7 @@ export class Sizes extends Component { } if (width < this.mediumSize) { - const headerFormatter = tooltipData => { + const headerFormatter = (tooltipData) => { return `${formatDate( tooltipData.value, dateFormatAliases.shortDateTime @@ -341,7 +341,7 @@ export class Sizes extends Component { style={${JSON.stringify(yAxisStyle)}} /> `}> - {copy => ( + {(copy) => ( { ? EUI_CHARTS_THEME_DARK.theme : EUI_CHARTS_THEME_LIGHT.theme; - const barPaletteIndex = paletteNames.findIndex(item => item === barPalette); + const barPaletteIndex = paletteNames.findIndex((item) => item === barPalette); const customTheme = barPaletteIndex > 0 diff --git a/src-docs/src/views/elastic_charts/theming_categorical.js b/src-docs/src/views/elastic_charts/theming_categorical.js index 60c253a5849..b371dc771bf 100644 --- a/src-docs/src/views/elastic_charts/theming_categorical.js +++ b/src-docs/src/views/elastic_charts/theming_categorical.js @@ -76,19 +76,19 @@ export const Categorical = () => { ? EUI_CHARTS_THEME_DARK.theme : EUI_CHARTS_THEME_LIGHT.theme; - const onNumChartsChange = e => { + const onNumChartsChange = (e) => { updateCorrectChart(Number(e.target.value), colorType); setNumCharts(e.target.value); }; - const onColorTypeChange = optionId => { + const onColorTypeChange = (optionId) => { const colorType = colorTypeRadios.find(({ id }) => id === optionId).label; updateCorrectChart(Number(numCharts), colorType); setColorType(colorType); setColorTypeIdSelected(optionId); }; - const onGroupChange = e => { + const onGroupChange = (e) => { const colorType = e.target.checked ? 'Grouped' : colorTypeRadios.find(({ id }) => id === colorTypeIdSelected).label; @@ -121,9 +121,9 @@ export const Categorical = () => { } }; - const createCategoryChart = numCharts => { + const createCategoryChart = (numCharts) => { const dg = new DataGenerator(); - const data = dg.generateGroupedSeries(20, numCharts).map(item => { + const data = dg.generateGroupedSeries(20, numCharts).map((item) => { item.g = `Categorical ${item.g.toUpperCase()}`; return item; }); @@ -135,12 +135,12 @@ export const Categorical = () => { setChartType('LineSeries'); }; - const createQuantityChart = numCharts => { + const createQuantityChart = (numCharts) => { const vizColors = euiPalettePositive(numCharts); // convert series labels to percentages const dg = new DataGenerator(); - const data = dg.generateGroupedSeries(20, numCharts).map(item => { + const data = dg.generateGroupedSeries(20, numCharts).map((item) => { const increment = 100 / numCharts; const index = item.g.charCodeAt(0) - 97; const lower = Math.floor(increment * index); @@ -159,7 +159,7 @@ export const Categorical = () => { setChartType('BarSeries'); }; - const createTrendChart = numCharts => { + const createTrendChart = (numCharts) => { const vizColors = euiPaletteForStatus(numCharts); // convert series labels to better/worse @@ -167,7 +167,7 @@ export const Categorical = () => { const numOfHalf = Math.floor(numCharts / 2); const dg = new DataGenerator(); - const data = dg.generateGroupedSeries(20, numCharts).map(item => { + const data = dg.generateGroupedSeries(20, numCharts).map((item) => { const index = item.g.charCodeAt(0) - 97; let howManyErs; if (oddSeries && index === numOfHalf) { @@ -194,7 +194,7 @@ export const Categorical = () => { setChartType('BarSeries'); }; - const createHighlightChart = numCharts => { + const createHighlightChart = (numCharts) => { const vizColors = euiPaletteGray(numCharts); vizColors[vizColors.length - 1] = highlightColor; @@ -229,9 +229,7 @@ export const Categorical = () => { compared to others - ) : ( - undefined - ); + ) : undefined; const customTheme = vizColors ? [ @@ -268,7 +266,7 @@ export const Categorical = () => { ChartType = CHART_COMPONENTS.LineSeries; for (let index = 0; index < 4; index++) { - const data = dg.generateGroupedSeries(20, 1).map(item => { + const data = dg.generateGroupedSeries(20, 1).map((item) => { item.y += index * 5; return item; }); @@ -434,7 +432,7 @@ export const Categorical = () => { showGridLines /> `}> - {copy => ( + {(copy) => ( { const [stacked, setStacked] = useState(false); const [chartType, setChartType] = useState('BarSeries'); - const onMultiChange = multiObject => { + const onMultiChange = (multiObject) => { const { multi, stacked } = multiObject; setMulti(multi); setStacked(stacked); }; - const onChartTypeChange = chartType => { + const onChartTypeChange = (chartType) => { setChartType(chartType); }; @@ -177,7 +177,7 @@ export const TimeChart = () => { showGridLines /> `}> - {copy => ( + {(copy) => ( { d.count} + valueAccessor={(d) => d.count} layers={[ { - groupByRollup: d => d.total, + groupByRollup: (d) => d.total, shape: { fillColor: isDarkTheme ? EUI_CHARTS_THEME_DARK.partition.sectorLineStroke @@ -57,15 +57,15 @@ export default () => { hideInLegend: true, }, { - groupByRollup: d => d.vizType, + groupByRollup: (d) => d.vizType, shape: { - fillColor: d => groupedPalette[d.sortIndex * 3], + fillColor: (d) => groupedPalette[d.sortIndex * 3], }, }, { - groupByRollup: d => d.issueType, + groupByRollup: (d) => d.issueType, shape: { - fillColor: d => + fillColor: (d) => groupedPalette[d.parent.sortIndex * 3 + d.sortIndex + 1], }, }, @@ -91,14 +91,14 @@ export default () => { d.count} + valueAccessor={(d) => d.count} valueGetter="percent" topGroove={0} layers={[ { - groupByRollup: d => d.vizType, + groupByRollup: (d) => d.vizType, shape: { - fillColor: d => groupedPalette[d.sortIndex * 3], + fillColor: (d) => groupedPalette[d.sortIndex * 3], }, fillLabel: { valueFormatter: () => '', @@ -106,9 +106,9 @@ export default () => { }, }, { - groupByRollup: d => d.issueType, + groupByRollup: (d) => d.issueType, shape: { - fillColor: d => + fillColor: (d) => groupedPalette[d.parent.sortIndex * 3 + d.sortIndex], }, }, diff --git a/src-docs/src/views/expression/columns.js b/src-docs/src/views/expression/columns.js index ce8521d310a..b5bed2035bf 100644 --- a/src-docs/src/views/expression/columns.js +++ b/src-docs/src/views/expression/columns.js @@ -74,14 +74,14 @@ export default () => { }); }; - const changeExample2 = e => { + const changeExample2 = (e) => { setExample2({ value: e.target.value, isOpen: false, }); }; - const onChange = selectedOptions => { + const onChange = (selectedOptions) => { setSelected(selectedOptions); const indices = selectedOptions.map((s, index) => { return ( diff --git a/src-docs/src/views/expression/expression.js b/src-docs/src/views/expression/expression.js index bb9113635c3..25ca938343b 100644 --- a/src-docs/src/views/expression/expression.js +++ b/src-docs/src/views/expression/expression.js @@ -60,14 +60,14 @@ export default () => { }); }; - const changeExample1 = event => { + const changeExample1 = (event) => { setExample1({ ...example1, value: event.target.value, }); }; - const changeExample2Value = e => { + const changeExample2Value = (e) => { const sanitizedValue = parseInt(e.target.value, 10); setExample2({ ...example2, @@ -75,7 +75,7 @@ export default () => { }); }; - const changeExample2Description = event => { + const changeExample2Description = (event) => { setExample2({ ...example2, description: event.target.value, diff --git a/src-docs/src/views/facet/facet_layout.js b/src-docs/src/views/facet/facet_layout.js index 1ac403ab02d..0cc5c9b7895 100644 --- a/src-docs/src/views/facet/facet_layout.js +++ b/src-docs/src/views/facet/facet_layout.js @@ -18,46 +18,46 @@ export default () => { const [loading, setLoading] = useState(false); const [selectedOptionId, setSelectedOptionId] = useState(undefined); - const facet0Clicked = id => { + const facet0Clicked = (id) => { setIcon(false); setDisabled(false); setAvatars(false); setLoading(false); - setSelectedOptionId(selectedOptionId => + setSelectedOptionId((selectedOptionId) => selectedOptionId === id ? undefined : id ); }; - const facet1Clicked = id => { + const facet1Clicked = (id) => { setIcon(true); setDisabled(false); setAvatars(false); setLoading(false); - setSelectedOptionId(selectedOptionId => + setSelectedOptionId((selectedOptionId) => selectedOptionId === id ? undefined : id ); }; - const facet2Clicked = id => { - setDisabled(disabled => !disabled); - setSelectedOptionId(selectedOptionId => + const facet2Clicked = (id) => { + setDisabled((disabled) => !disabled); + setSelectedOptionId((selectedOptionId) => selectedOptionId === id ? undefined : id ); }; - const facet3Clicked = id => { + const facet3Clicked = (id) => { setIcon(false); setDisabled(false); setAvatars(true); setLoading(false); - setSelectedOptionId(selectedOptionId => + setSelectedOptionId((selectedOptionId) => selectedOptionId === id ? undefined : id ); }; - const facet4Clicked = id => { + const facet4Clicked = (id) => { setLoading(true); - setSelectedOptionId(selectedOptionId => + setSelectedOptionId((selectedOptionId) => selectedOptionId === id ? undefined : id ); }; @@ -113,10 +113,10 @@ export default () => { setLoading(false); }, 1200); - const facets = align => { + const facets = (align) => { return ( <> - {list.map(facet => { + {list.map((facet) => { let iconNode; if (icon) { iconNode = ; diff --git a/src-docs/src/views/facet/playground.js b/src-docs/src/views/facet/playground.js index b825d1d4f6d..4f0e93daacd 100644 --- a/src-docs/src/views/facet/playground.js +++ b/src-docs/src/views/facet/playground.js @@ -45,7 +45,7 @@ export const facetButtonConfig = () => { }, customProps: { onClick: { - generate: val => { + generate: (val) => { if (!val) return null; const obj = t.arrowFunctionExpression( [], diff --git a/src-docs/src/views/flyout/flyout_complicated.js b/src-docs/src/views/flyout/flyout_complicated.js index cce6ee80904..f0f3270f0f4 100644 --- a/src-docs/src/views/flyout/flyout_complicated.js +++ b/src-docs/src/views/flyout/flyout_complicated.js @@ -47,9 +47,10 @@ export default () => { const closePopover = () => setIsPopoverOpen(false); - const togglePopover = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const togglePopover = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); - const onSelectedTabChanged = id => setSelectedTabId(id); + const onSelectedTabChanged = (id) => setSelectedTabId(id); const renderTabs = tabs.map((tab, index) => ( { }, ]; - const onSuperSelectChange = value => { + const onSuperSelectChange = (value) => { setSuperSelectValue(value); }; @@ -215,7 +216,7 @@ export default () => { onSuperSelectChange(value)} + onChange={(value) => onSuperSelectChange(value)} itemLayoutAlign="top" hasDividers /> diff --git a/src-docs/src/views/form_compressed/complex_example.js b/src-docs/src/views/form_compressed/complex_example.js index ee27973a81c..3e16c4ef5e5 100644 --- a/src-docs/src/views/form_compressed/complex_example.js +++ b/src-docs/src/views/form_compressed/complex_example.js @@ -86,23 +86,23 @@ export default () => { setGranularityToggleButtonsIdSelected, ] = useState(`${idPrefix}4`); - const onPopoverSliderValueChange = e => { + const onPopoverSliderValueChange = (e) => { setPopoverSliderValues(e.target.value); }; - const onColorChange = value => { + const onColorChange = (value) => { setColor(value); }; - const onRangeChange = e => { + const onRangeChange = (e) => { setOpacityValue(e.target.value); }; - const onDualChange = value => { + const onDualChange = (value) => { setDualValue(value); }; - const onTypeStyleChange = optionId => { + const onTypeStyleChange = (optionId) => { const newTypeStyleToggleButtonsIdToSelectedMap = { ...typeStyleToggleButtonsIdToSelectedMap, ...{ @@ -115,7 +115,7 @@ export default () => { ); }; - const onGranularityChange = optionId => { + const onGranularityChange = (optionId) => { setGranularityToggleButtonsIdSelected(optionId); }; diff --git a/src-docs/src/views/form_compressed/form_compressed.js b/src-docs/src/views/form_compressed/form_compressed.js index 3cf11b14a03..42c0dc21ba2 100644 --- a/src-docs/src/views/form_compressed/form_compressed.js +++ b/src-docs/src/views/form_compressed/form_compressed.js @@ -41,7 +41,7 @@ export default () => { const [value, setValue] = useState(20); - const onRangeChange = e => { + const onRangeChange = (e) => { setValue(e.target.value); }; @@ -49,7 +49,7 @@ export default () => { setIsSwitchChecked(!isSwitchChecked); }; - const onCheckboxChange = optionId => { + const onCheckboxChange = (optionId) => { const newCheckboxIdToSelectedMap = { ...checkboxIdToSelectedMap, ...{ @@ -91,7 +91,7 @@ export default () => { ]} compressed selectedOptions={comboBoxSelectionOptions} - onChange={comboBoxSelectionOptions => + onChange={(comboBoxSelectionOptions) => setComboBoxSelectionOptions(comboBoxSelectionOptions) } /> diff --git a/src-docs/src/views/form_compressed/form_horizontal.js b/src-docs/src/views/form_compressed/form_horizontal.js index f624b6f0b04..06ed6c015a9 100644 --- a/src-docs/src/views/form_compressed/form_horizontal.js +++ b/src-docs/src/views/form_compressed/form_horizontal.js @@ -16,7 +16,7 @@ export default () => { const [comboBoxSelectionOptions, setComboBoxSelectionOptions] = useState([]); const [value, setValue] = useState('20'); - const onRangeChange = e => { + const onRangeChange = (e) => { setValue(e.target.value); }; @@ -57,7 +57,7 @@ export default () => { ]} compressed selectedOptions={comboBoxSelectionOptions} - onChange={comboBoxSelectionOptions => + onChange={(comboBoxSelectionOptions) => setComboBoxSelectionOptions(comboBoxSelectionOptions) } /> diff --git a/src-docs/src/views/form_controls/checkbox.js b/src-docs/src/views/form_controls/checkbox.js index 5bfe1014c27..2d8c5359e13 100644 --- a/src-docs/src/views/form_controls/checkbox.js +++ b/src-docs/src/views/form_controls/checkbox.js @@ -8,7 +8,7 @@ export default () => { const [checked, setChecked] = useState(false); const [indeterminate, setindeterminate] = useState(true); - const onChange = e => { + const onChange = (e) => { setChecked(e.target.checked); }; @@ -22,7 +22,7 @@ export default () => { id={htmlIdGenerator()()} label="I am a checkbox" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} /> @@ -40,7 +40,7 @@ export default () => { id={htmlIdGenerator()()} label="I am a disabled checkbox" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} disabled /> @@ -50,7 +50,7 @@ export default () => { id={htmlIdGenerator()()} label="I am a compressed checkbox" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} compressed /> diff --git a/src-docs/src/views/form_controls/checkbox_group.js b/src-docs/src/views/form_controls/checkbox_group.js index bb432591d05..4d4e2542609 100644 --- a/src-docs/src/views/form_controls/checkbox_group.js +++ b/src-docs/src/views/form_controls/checkbox_group.js @@ -28,7 +28,7 @@ export default () => { [`${idPrefix}1`]: true, }); - const onChange = optionId => { + const onChange = (optionId) => { const newCheckboxIdToSelectedMap = { ...checkboxIdToSelectedMap, ...{ @@ -48,7 +48,7 @@ export default () => { onChange(id)} + onChange={(id) => onChange(id)} /> ); diff --git a/src-docs/src/views/form_controls/display_toggles.js b/src-docs/src/views/form_controls/display_toggles.js index ac85f8bf0a4..9b50dadf3d2 100644 --- a/src-docs/src/views/form_controls/display_toggles.js +++ b/src-docs/src/views/form_controls/display_toggles.js @@ -95,7 +95,7 @@ export class DisplayToggles extends Component { compressed label={'disabled'} checked={this.state.disabled} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'disabled') } /> @@ -107,7 +107,7 @@ export class DisplayToggles extends Component { compressed label={'readOnly'} checked={this.state.readOnly} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'readOnly') } /> @@ -119,7 +119,7 @@ export class DisplayToggles extends Component { compressed label={'loading'} checked={this.state.loading} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'loading') } /> @@ -131,7 +131,7 @@ export class DisplayToggles extends Component { compressed label={'invalid'} checked={this.state.invalid} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'invalid') } /> @@ -143,7 +143,7 @@ export class DisplayToggles extends Component { compressed label={'fullWidth'} checked={this.state.fullWidth} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'fullWidth') } /> @@ -164,7 +164,7 @@ export class DisplayToggles extends Component { } checked={this.state.compressed} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'compressed') } /> @@ -176,7 +176,7 @@ export class DisplayToggles extends Component { compressed label={'prepend'} checked={this.state.prepend} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'prepend') } /> @@ -188,7 +188,7 @@ export class DisplayToggles extends Component { compressed label={'append'} checked={this.state.append} - onChange={e => + onChange={(e) => this.updateProperty(e.target.checked, 'append') } /> diff --git a/src-docs/src/views/form_controls/field_number.js b/src-docs/src/views/form_controls/field_number.js index 95ce6813838..9eea42ff895 100644 --- a/src-docs/src/views/form_controls/field_number.js +++ b/src-docs/src/views/form_controls/field_number.js @@ -6,7 +6,7 @@ import { DisplayToggles } from './display_toggles'; export default () => { const [value, setValue] = useState(''); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; @@ -16,7 +16,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} aria-label="Use aria labels when no actual label is in use" /> diff --git a/src-docs/src/views/form_controls/field_password.js b/src-docs/src/views/form_controls/field_password.js index 95bf792e517..816e849cda8 100644 --- a/src-docs/src/views/form_controls/field_password.js +++ b/src-docs/src/views/form_controls/field_password.js @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import { EuiFieldPassword, EuiSwitch } from '../../../../src/components'; import { DisplayToggles } from './display_toggles'; -export default function() { +export default function () { const [value, setValue] = useState(''); const [dual, setDual] = useState(true); @@ -17,7 +17,7 @@ export default function() { compressed label={'dual'} checked={dual} - onChange={e => { + onChange={(e) => { setDual(e.target.checked); }} />, @@ -26,7 +26,7 @@ export default function() { placeholder="Placeholder text" type={dual ? 'dual' : undefined} value={value} - onChange={e => setValue(e.target.value)} + onChange={(e) => setValue(e.target.value)} aria-label="Use aria labels when no actual label is in use" /> diff --git a/src-docs/src/views/form_controls/field_search.js b/src-docs/src/views/form_controls/field_search.js index 914f3d53829..6367c081c09 100644 --- a/src-docs/src/views/form_controls/field_search.js +++ b/src-docs/src/views/form_controls/field_search.js @@ -7,7 +7,7 @@ export default () => { const [isClearable, setIsClearable] = useState(true); const [value, setValue] = useState(''); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; @@ -21,7 +21,7 @@ export default () => { compressed label={'clearable'} checked={isClearable} - onChange={e => { + onChange={(e) => { setIsClearable(e.target.checked); }} />, @@ -29,7 +29,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} isClearable={isClearable} aria-label="Use aria labels when no actual label is in use" /> diff --git a/src-docs/src/views/form_controls/field_text.js b/src-docs/src/views/form_controls/field_text.js index 3369c564123..c4b5f4f747f 100644 --- a/src-docs/src/views/form_controls/field_text.js +++ b/src-docs/src/views/form_controls/field_text.js @@ -3,10 +3,10 @@ import React, { useState } from 'react'; import { EuiFieldText } from '../../../../src/components'; import { DisplayToggles } from './display_toggles'; -export default function() { +export default function () { const [value, setValue] = useState(''); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; @@ -16,7 +16,7 @@ export default function() { onChange(e)} + onChange={(e) => onChange(e)} aria-label="Use aria labels when no actual label is in use" /> diff --git a/src-docs/src/views/form_controls/file_picker.js b/src-docs/src/views/form_controls/file_picker.js index 1978309c338..4241345b3ac 100644 --- a/src-docs/src/views/form_controls/file_picker.js +++ b/src-docs/src/views/form_controls/file_picker.js @@ -14,7 +14,7 @@ export default () => { const [files, setFiles] = useState({}); const [large, setLarge] = useState(true); - const onChange = files => { + const onChange = (files) => { setFiles(files); }; @@ -48,7 +48,7 @@ export default () => { compressed label={'large'} checked={large} - onChange={e => { + onChange={(e) => { setLarge(e.target.checked); }} />, @@ -57,7 +57,7 @@ export default () => { id="asdf2" multiple initialPromptText="Select or drag and drop multiple files" - onChange={files => { + onChange={(files) => { onChange(files); }} display={large ? 'large' : 'default'} diff --git a/src-docs/src/views/form_controls/prepend_append.js b/src-docs/src/views/form_controls/prepend_append.js index 50d23e9d7df..b1dd0839e6d 100644 --- a/src-docs/src/views/form_controls/prepend_append.js +++ b/src-docs/src/views/form_controls/prepend_append.js @@ -23,19 +23,19 @@ export default () => { setCompressed(e.target.checked)} + onChange={(e) => setCompressed(e.target.checked)} />   setDisabled(e.target.checked)} + onChange={(e) => setDisabled(e.target.checked)} />   setReadOnly(e.target.checked)} + onChange={(e) => setReadOnly(e.target.checked)} /> { const [checked, setChecked] = useState(false); - const onChange = e => { + const onChange = (e) => { setChecked(e.target.checked); }; @@ -17,7 +17,7 @@ export default () => { id={htmlIdGenerator()()} label="I am a radio" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} /> @@ -26,7 +26,7 @@ export default () => { id={htmlIdGenerator()()} label="I am a disabled radio" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} disabled /> @@ -36,7 +36,7 @@ export default () => { id={htmlIdGenerator()()} label="I am a compressed radio" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} compressed /> diff --git a/src-docs/src/views/form_controls/radio_group.js b/src-docs/src/views/form_controls/radio_group.js index e2364eba1f6..1f3d61b84fc 100644 --- a/src-docs/src/views/form_controls/radio_group.js +++ b/src-docs/src/views/form_controls/radio_group.js @@ -26,7 +26,7 @@ export default () => { const [radioIdSelected, setRadioIdSelected] = useState(`${idPrefix}1`); - const onChange = optionId => { + const onChange = (optionId) => { setRadioIdSelected(optionId); }; @@ -40,7 +40,7 @@ export default () => { onChange(id)} + onChange={(id) => onChange(id)} name="radio group" legend={{ children: This is a legend for a radio group, diff --git a/src-docs/src/views/form_controls/select.js b/src-docs/src/views/form_controls/select.js index be9e10d04d9..b8b7f96183d 100644 --- a/src-docs/src/views/form_controls/select.js +++ b/src-docs/src/views/form_controls/select.js @@ -12,7 +12,7 @@ export default () => { const [value, setValue] = useState(options[1].value); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; @@ -23,7 +23,7 @@ export default () => { id="selectDocExample" options={options} value={value} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} aria-label="Use aria labels when no actual label is in use" /> diff --git a/src-docs/src/views/form_controls/switch.js b/src-docs/src/views/form_controls/switch.js index ea0f5822da4..54f3625fe3b 100644 --- a/src-docs/src/views/form_controls/switch.js +++ b/src-docs/src/views/form_controls/switch.js @@ -5,7 +5,7 @@ import { EuiSwitch, EuiSpacer } from '../../../../src/components'; export default () => { const [checked, setChecked] = useState(false); - const onChange = e => { + const onChange = (e) => { setChecked(e.target.checked); }; @@ -14,7 +14,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} /> @@ -22,7 +22,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} disabled /> @@ -32,7 +32,7 @@ export default () => { showLabel={false} label="I am a switch without a visible label" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} /> @@ -40,7 +40,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} compressed /> @@ -49,7 +49,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} compressed disabled /> @@ -60,7 +60,7 @@ export default () => { showLabel={false} label="I am a compressed switch without a visible label" checked={checked} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} compressed /> diff --git a/src-docs/src/views/form_controls/text_area.js b/src-docs/src/views/form_controls/text_area.js index a533a602eee..ff086038886 100644 --- a/src-docs/src/views/form_controls/text_area.js +++ b/src-docs/src/views/form_controls/text_area.js @@ -6,7 +6,7 @@ import { DisplayToggles } from './display_toggles'; export default () => { const [value, setValue] = useState(''); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; @@ -17,7 +17,7 @@ export default () => { placeholder="Placeholder text" aria-label="Use aria labels when no actual label is in use" value={value} - onChange={e => onChange(e)} + onChange={(e) => onChange(e)} /> ); diff --git a/src-docs/src/views/form_layouts/form_rows.js b/src-docs/src/views/form_layouts/form_rows.js index 3c9de690d24..702582d28b0 100644 --- a/src-docs/src/views/form_layouts/form_rows.js +++ b/src-docs/src/views/form_layouts/form_rows.js @@ -42,7 +42,7 @@ export default () => { setIsSwitchChecked(!isSwitchChecked); }; - const onCheckboxChange = optionId => { + const onCheckboxChange = (optionId) => { const newCheckboxIdToSelectedMap = { ...checkboxIdToSelectedMap, ...{ diff --git a/src-docs/src/views/guidelines/_get_sass_vars.js b/src-docs/src/views/guidelines/_get_sass_vars.js index 98a49e48f17..dc68e32e53c 100644 --- a/src-docs/src/views/guidelines/_get_sass_vars.js +++ b/src-docs/src/views/guidelines/_get_sass_vars.js @@ -3,7 +3,7 @@ import darkColors from '!!sass-vars-to-js-loader!../../../../src/themes/eui/eui_ import lightAmsterdamColors from '!!sass-vars-to-js-loader!../../../../src/themes/eui-amsterdam/eui_amsterdam_colors_light.scss'; import darkAmsterdamColors from '!!sass-vars-to-js-loader!../../../../src/themes/eui-amsterdam/eui_amsterdam_colors_dark.scss'; -export const getSassVars = theme => { +export const getSassVars = (theme) => { let palette; switch (theme) { case 'amsterdam-dark': diff --git a/src-docs/src/views/guidelines/colors/_utilities.js b/src-docs/src/views/guidelines/colors/_utilities.js index f2825b08859..037ecbf75c9 100644 --- a/src-docs/src/views/guidelines/colors/_utilities.js +++ b/src-docs/src/views/guidelines/colors/_utilities.js @@ -132,7 +132,7 @@ color: $${foreground};`; beforeMessage={beforeMessage} afterMessage={Copied!} textToCopy={textToCopy}> - {copy => ( + {(copy) => ( )} - {colorsForContrast.map(color2 => { + {colorsForContrast.map((color2) => { if (colorIsCore(color) && colorIsCore(color2)) { // i.e. don't render if both are core colors return; diff --git a/src-docs/src/views/guidelines/colors/contrast_slider.js b/src-docs/src/views/guidelines/colors/contrast_slider.js index 501e391d6ca..1b5f20a7d57 100644 --- a/src-docs/src/views/guidelines/colors/contrast_slider.js +++ b/src-docs/src/views/guidelines/colors/contrast_slider.js @@ -103,7 +103,7 @@ export const ContrastSlider = ({ max={7} step={0.5} value={value} - onChange={e => { + onChange={(e) => { setValue(e.currentTarget.value); onChange(e.currentTarget.value, checked); }} @@ -124,7 +124,7 @@ export const ContrastSlider = ({ { + onChange={(e) => { setChecked(e.target.checked); onChange(value, e.target.checked); }} diff --git a/src-docs/src/views/guidelines/colors/core_palette.js b/src-docs/src/views/guidelines/colors/core_palette.js index 9c4c8afd25f..a672d7a4428 100644 --- a/src-docs/src/views/guidelines/colors/core_palette.js +++ b/src-docs/src/views/guidelines/colors/core_palette.js @@ -35,10 +35,10 @@ export const CorePalette = ({ theme, colors }) => { } afterMessage={Color name copied!} textToCopy={color}> - {copy => ( + {(copy) => (
@@ -390,7 +390,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiColors.map(function(color, index) { + {euiColors.map(function (color, index) { return renderPaletteColor(palette, color, index); })}
@@ -631,7 +631,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiFontSizes.map(function(size, index) { + {euiFontSizes.map(function (size, index) { return renderFontSize(size, index); })} @@ -643,7 +643,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiTextColors.map(function(color, index) { + {euiTextColors.map(function (color, index) { return renderPaletteColor(palette, color, index); })} @@ -693,7 +693,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiBorders.map(function(border, index) { + {euiBorders.map(function (border, index) { return renderBorder(border, index); })} @@ -739,7 +739,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiShadows.map(function(shadow, index) { + {euiShadows.map(function (shadow, index) { return renderShadow(shadow, index); })} @@ -905,7 +905,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiBreakPoints.map(function(size, index) { + {euiBreakPoints.map(function (size, index) { return renderBreakpoint(size, index); })} @@ -982,7 +982,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiAnimationSpeeds.map(function(speed, index) { + {euiAnimationSpeeds.map(function (speed, index) { return renderAnimationSpeed(speed, index); })} @@ -993,7 +993,7 @@ export const SassGuidelines = ({ selectedTheme }) => { - {euiAnimationTimings.map(function(speed, index) { + {euiAnimationTimings.map(function (speed, index) { return renderAnimationTiming(speed, index); })} diff --git a/src-docs/src/views/header/header.js b/src-docs/src/views/header/header.js index 5892fc782be..0ca78b09618 100644 --- a/src-docs/src/views/header/header.js +++ b/src-docs/src/views/header/header.js @@ -32,7 +32,7 @@ export default () => { e.preventDefault()} + onClick={(e) => e.preventDefault()} aria-label="Go to home page" /> ); @@ -42,7 +42,7 @@ export default () => { { text: 'Management', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, 'data-test-subj': 'breadcrumbsAnimals', @@ -51,21 +51,21 @@ export default () => { { text: 'Truncation test is here for a really long item', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, }, { text: 'Hidden', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, }, { text: 'Users', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, }, @@ -246,7 +246,7 @@ const HeaderSpacesMenu = () => { const [spaces, setSpaces] = useState(spacesValues); const [selectedSpace, setSelectedSpace] = useState( - spaces.filter(option => option.checked)[0] + spaces.filter((option) => option.checked)[0] ); const [isOpen, setIsOpen] = useState(false); @@ -262,9 +262,9 @@ const HeaderSpacesMenu = () => { setIsOpen(false); }; - const onChange = options => { + const onChange = (options) => { setSpaces(options); - setSelectedSpace(options.filter(option => option.checked)[0]); + setSelectedSpace(options.filter((option) => option.checked)[0]); setIsOpen(false); }; diff --git a/src-docs/src/views/header/header_alert.js b/src-docs/src/views/header/header_alert.js index 38ccd4c48b9..8d70a32c42c 100644 --- a/src-docs/src/views/header/header_alert.js +++ b/src-docs/src/views/header/header_alert.js @@ -37,7 +37,7 @@ export default () => { setPosition(e.target.checked ? 'fixed' : 'static')} + onChange={(e) => setPosition(e.target.checked ? 'fixed' : 'static')} /> diff --git a/src-docs/src/views/header/header_position.js b/src-docs/src/views/header/header_position.js index 684e63bc8a4..fb3930a358c 100644 --- a/src-docs/src/views/header/header_position.js +++ b/src-docs/src/views/header/header_position.js @@ -22,7 +22,7 @@ export default () => { setPosition(e.target.checked ? 'fixed' : 'static')} + onChange={(e) => setPosition(e.target.checked ? 'fixed' : 'static')} /> diff --git a/src-docs/src/views/header/header_sections.js b/src-docs/src/views/header/header_sections.js index 0637e36159d..6725bd9b33b 100644 --- a/src-docs/src/views/header/header_sections.js +++ b/src-docs/src/views/header/header_sections.js @@ -18,7 +18,7 @@ export default () => { e.preventDefault()} + onClick={(e) => e.preventDefault()} aria-label="Go to home page" /> ); @@ -33,14 +33,14 @@ export default () => { { text: 'Management', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, }, { text: 'Users', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, }, diff --git a/src-docs/src/views/header/header_stacked.js b/src-docs/src/views/header/header_stacked.js index 9af48de2a9d..7e983b15fe2 100644 --- a/src-docs/src/views/header/header_stacked.js +++ b/src-docs/src/views/header/header_stacked.js @@ -17,7 +17,7 @@ export default () => { { text: 'Management', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); }, }, @@ -91,7 +91,7 @@ export default () => { setIsFixed(e.target.checked)} + onChange={(e) => setIsFixed(e.target.checked)} /> {headers} diff --git a/src-docs/src/views/highlight_and_mark/highlight.js b/src-docs/src/views/highlight_and_mark/highlight.js index 2a2b39e2fcd..6a191c8deb9 100644 --- a/src-docs/src/views/highlight_and_mark/highlight.js +++ b/src-docs/src/views/highlight_and_mark/highlight.js @@ -12,10 +12,10 @@ export function Highlight() { const [searchValue, setSearchValue] = useState('jumped over'); const [isHighlightAll, setHighlightAll] = useState(false); - const onSearchChange = e => { + const onSearchChange = (e) => { setSearchValue(e.target.value); }; - const changeHighlightAll = e => { + const changeHighlightAll = (e) => { setHighlightAll(e.target.checked); }; @@ -24,7 +24,7 @@ export function Highlight() { { + onChange={(e) => { onSearchChange(e); }} /> @@ -34,7 +34,7 @@ export function Highlight() { changeHighlightAll(e)} + onChange={(e) => changeHighlightAll(e)} /> diff --git a/src-docs/src/views/html_id_generator/bothPrefixSuffix.js b/src-docs/src/views/html_id_generator/bothPrefixSuffix.js index 01f77001fde..15e39f13e09 100644 --- a/src-docs/src/views/html_id_generator/bothPrefixSuffix.js +++ b/src-docs/src/views/html_id_generator/bothPrefixSuffix.js @@ -16,13 +16,13 @@ export const PrefixSufix = () => { const [suffix, setSuffix] = useState('Id'); const [customId, setCustomId] = useState(htmlIdGenerator('Some')('Id')); - const onPrefixChange = e => { + const onPrefixChange = (e) => { const prefix = e.target.value; setPrefix(prefix); setCustomId(htmlIdGenerator(prefix)(suffix)); }; - const onSuffixChange = e => { + const onSuffixChange = (e) => { const suffix = e.target.value; setSuffix(suffix); setCustomId(htmlIdGenerator(prefix)(suffix)); diff --git a/src-docs/src/views/html_id_generator/html_id_generator_prefix.js b/src-docs/src/views/html_id_generator/html_id_generator_prefix.js index aff8c9b2b2b..0476e37cfdb 100644 --- a/src-docs/src/views/html_id_generator/html_id_generator_prefix.js +++ b/src-docs/src/views/html_id_generator/html_id_generator_prefix.js @@ -15,7 +15,7 @@ export const HtmlIdGeneratorPrefix = () => { const [prefix, setPrefix] = useState('Id'); const [customId, setCustomId] = useState(htmlIdGenerator('Id')()); - const onSearchChange = e => { + const onSearchChange = (e) => { const prefix = e.target.value; setPrefix(prefix); setCustomId(htmlIdGenerator(prefix)()); diff --git a/src-docs/src/views/html_id_generator/html_id_generator_suffix.js b/src-docs/src/views/html_id_generator/html_id_generator_suffix.js index 4655c6bdd03..bc45cb7e96f 100644 --- a/src-docs/src/views/html_id_generator/html_id_generator_suffix.js +++ b/src-docs/src/views/html_id_generator/html_id_generator_suffix.js @@ -15,7 +15,7 @@ export const HtmlIdGeneratorSuffix = () => { const [suffix, setSuffix] = useState('Id'); const [customId, setCustomId] = useState(htmlIdGenerator()('Id')); - const onSuffixChange = e => { + const onSuffixChange = (e) => { const suffix = e.target.value; setSuffix(suffix); setCustomId(htmlIdGenerator()(suffix)); diff --git a/src-docs/src/views/i18n/context.js b/src-docs/src/views/i18n/context.js index c62122a6c08..d0f2931003f 100644 --- a/src-docs/src/views/i18n/context.js +++ b/src-docs/src/views/i18n/context.js @@ -62,7 +62,7 @@ export default () => { const i18n = { mapping: mappings[language], - formatNumber: value => new Intl.NumberFormat(language).format(value), + formatNumber: (value) => new Intl.NumberFormat(language).format(value), }; return ( diff --git a/src-docs/src/views/i18n/i18n_attribute.js b/src-docs/src/views/i18n/i18n_attribute.js index 0fda4c845d0..e814213668d 100644 --- a/src-docs/src/views/i18n/i18n_attribute.js +++ b/src-docs/src/views/i18n/i18n_attribute.js @@ -39,7 +39,7 @@ export default () => {

EuiI18n used as a render prop

- {placeholderName => ( + {(placeholderName) => ( diff --git a/src-docs/src/views/icon/apps.js b/src-docs/src/views/icon/apps.js index 71325744695..1d599864f2d 100644 --- a/src-docs/src/views/icon/apps.js +++ b/src-docs/src/views/icon/apps.js @@ -71,13 +71,13 @@ const iconTypes = [ export default () => ( - {iconTypes.map(iconType => ( + {iconTypes.map((iconType) => ( - {copy => ( + {(copy) => ( diff --git a/src-docs/src/views/icon/editor.js b/src-docs/src/views/icon/editor.js index 7ff493f6b8a..227d9053419 100644 --- a/src-docs/src/views/icon/editor.js +++ b/src-docs/src/views/icon/editor.js @@ -53,13 +53,13 @@ const iconTypes = [ export default () => ( - {iconTypes.map(iconType => ( + {iconTypes.map((iconType) => ( - {copy => ( + {(copy) => ( diff --git a/src-docs/src/views/icon/icon_colors.js b/src-docs/src/views/icon/icon_colors.js index 9f61598f0af..d1ab6faac30 100644 --- a/src-docs/src/views/icon/icon_colors.js +++ b/src-docs/src/views/icon/icon_colors.js @@ -41,7 +41,7 @@ const iconColors = [ export default () => (
- {iconColors.map(iconColor => ( + {iconColors.map((iconColor) => ( ( - {iconSizes.map(iconSize => ( + {iconSizes.map((iconSize) => ( ( - {iconTypes.map(iconType => ( + {iconTypes.map((iconType) => ( - {copy => ( + {(copy) => ( diff --git a/src-docs/src/views/icon/logos.js b/src-docs/src/views/icon/logos.js index 15dcbcb62a4..b433169d531 100644 --- a/src-docs/src/views/icon/logos.js +++ b/src-docs/src/views/icon/logos.js @@ -45,13 +45,13 @@ const iconTypes = [ export default () => ( - {iconTypes.map(iconType => ( + {iconTypes.map((iconType) => ( - {copy => ( + {(copy) => ( diff --git a/src-docs/src/views/icon/logos_third.js b/src-docs/src/views/icon/logos_third.js index 89074c5921c..f62d6e3142d 100644 --- a/src-docs/src/views/icon/logos_third.js +++ b/src-docs/src/views/icon/logos_third.js @@ -62,13 +62,13 @@ const iconTypes = [ export default () => ( - {iconTypes.map(iconType => ( + {iconTypes.map((iconType) => ( - {copy => ( + {(copy) => ( diff --git a/src-docs/src/views/icon/ml.js b/src-docs/src/views/icon/ml.js index d77a1a74f37..05075e623a0 100644 --- a/src-docs/src/views/icon/ml.js +++ b/src-docs/src/views/icon/ml.js @@ -33,13 +33,13 @@ const iconTypes = [ export default () => ( - {iconTypes.map(iconType => ( + {iconTypes.map((iconType) => ( - {copy => ( + {(copy) => ( diff --git a/src-docs/src/views/icon/tokens.js b/src-docs/src/views/icon/tokens.js index ca6ece5e795..08275f4d3ad 100644 --- a/src-docs/src/views/icon/tokens.js +++ b/src-docs/src/views/icon/tokens.js @@ -78,13 +78,13 @@ const tokens = [ export default () => ( - {tokens.map(token => ( + {tokens.map((token) => ( - {copy => ( + {(copy) => (
{ return ( - {DARK_COLORS.map(color => ( + {DARK_COLORS.map((color) => ( @@ -52,7 +52,7 @@ export default () => { - {LIGHT_COLORS.map(color => ( + {LIGHT_COLORS.map((color) => ( diff --git a/src-docs/src/views/key_pad_menu/playground.js b/src-docs/src/views/key_pad_menu/playground.js index aa0e8e93c55..aea54d518ea 100644 --- a/src-docs/src/views/key_pad_menu/playground.js +++ b/src-docs/src/views/key_pad_menu/playground.js @@ -62,7 +62,7 @@ export const keyPadMenuItemConfig = () => { }, customProps: { onClick: { - generate: val => { + generate: (val) => { if (!val) return null; const obj = t.arrowFunctionExpression( [], diff --git a/src-docs/src/views/link/link.js b/src-docs/src/views/link/link.js index 1372786696c..3ba7288cfc3 100644 --- a/src-docs/src/views/link/link.js +++ b/src-docs/src/views/link/link.js @@ -27,7 +27,7 @@ export default () => ( Here is an example of a{' '} { + onClick={(e) => { if (!window.confirm('Are you sure you want to see the eui repo?')) { e.preventDefault(); } diff --git a/src-docs/src/views/link/playground.js b/src-docs/src/views/link/playground.js index 8aa286ecd55..a6a8e8265c2 100644 --- a/src-docs/src/views/link/playground.js +++ b/src-docs/src/views/link/playground.js @@ -54,7 +54,7 @@ export default () => { }, customProps: { onClick: { - generate: val => { + generate: (val) => { if (!val) return null; const obj = t.arrowFunctionExpression( [], diff --git a/src-docs/src/views/list_group/pinnable_list_group.tsx b/src-docs/src/views/list_group/pinnable_list_group.tsx index 4716de39ef8..ff6c67cd762 100644 --- a/src-docs/src/views/list_group/pinnable_list_group.tsx +++ b/src-docs/src/views/list_group/pinnable_list_group.tsx @@ -13,7 +13,7 @@ const someListItems: EuiPinnableListGroupItemProps[] = [ { label: 'Pinned button with onClick', pinned: true, - onClick: e => { + onClick: (e) => { console.log('Pinned button clicked', e); }, }, @@ -44,7 +44,7 @@ export default () => ( <> { + onPinClick={(item) => { console.warn('Clicked: ', item); }} maxWidth="none" diff --git a/src-docs/src/views/markdown_editor/markdown_editor.js b/src-docs/src/views/markdown_editor/markdown_editor.js index 84ccfb263b0..6b39ab149b8 100644 --- a/src-docs/src/views/markdown_editor/markdown_editor.js +++ b/src-docs/src/views/markdown_editor/markdown_editor.js @@ -21,10 +21,10 @@ The editor also ships with some built in plugins. For example it can handle chec const dropHandlers = [ { supportedFiles: ['.jpg', '.jpeg'], - accepts: itemType => itemType === 'image/jpeg', - getFormattingForItem: item => { + accepts: (itemType) => itemType === 'image/jpeg', + getFormattingForItem: (item) => { // fake an upload - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { const url = URL.createObjectURL(item); resolve({ diff --git a/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js b/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js index 8418391dbcc..574a4d5b1d7 100644 --- a/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js +++ b/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js @@ -58,7 +58,7 @@ const paletteData = { const paletteNames = Object.keys(paletteData); const dg = new DataGenerator(); -const generateData = categories => dg.generateGroupedSeries(10, categories); +const generateData = (categories) => dg.generateGroupedSeries(10, categories); const chartDemoPlugin = { name: 'chartDemoPlugin', @@ -90,7 +90,7 @@ const chartDemoPlugin = { const [palette, setPalette] = useState((node && node.palette) || '1'); const [categories, setCategories] = useState(5); - const onChange = e => { + const onChange = (e) => { setCategories(parseInt(e.target.value)); }; diff --git a/src-docs/src/views/modal/modal.js b/src-docs/src/views/modal/modal.js index ee1803aa60c..274668f6fc3 100644 --- a/src-docs/src/views/modal/modal.js +++ b/src-docs/src/views/modal/modal.js @@ -28,7 +28,7 @@ export default () => { const [superSelectvalue, setSuperSelectValue] = useState('option_one'); const onSwitchChange = () => - setIsSwitchChecked(isSwitchChecked => !isSwitchChecked); + setIsSwitchChecked((isSwitchChecked) => !isSwitchChecked); const closeModal = () => setIsModalVisible(false); @@ -103,7 +103,7 @@ export default () => { onSuperSelectChange(value)} + onChange={(value) => onSuperSelectChange(value)} itemLayoutAlign="top" hasDividers /> @@ -117,7 +117,7 @@ export default () => { ); - const onSuperSelectChange = value => { + const onSuperSelectChange = (value) => { setSuperSelectValue(value); }; diff --git a/src-docs/src/views/mutation_observer/mutation_observer.js b/src-docs/src/views/mutation_observer/mutation_observer.js index 6ca85764143..46bf6906ef5 100644 --- a/src-docs/src/views/mutation_observer/mutation_observer.js +++ b/src-docs/src/views/mutation_observer/mutation_observer.js @@ -38,7 +38,7 @@ export const MutationObserver = () => { - {mutationRef => ( + {(mutationRef) => (
{
    - {items.map(item => ( + {items.map((item) => (
  • {item}
  • ))}
diff --git a/src-docs/src/views/nav_drawer/nav_drawer.js b/src-docs/src/views/nav_drawer/nav_drawer.js index da2d92fe6c1..158cbb2beba 100644 --- a/src-docs/src/views/nav_drawer/nav_drawer.js +++ b/src-docs/src/views/nav_drawer/nav_drawer.js @@ -43,7 +43,7 @@ export default () => { iconSize: 's', }; - const pinExtraActionFn = val => { + const pinExtraActionFn = (val) => { pinExtraAction['aria-label'] = `Pin ${val} to top`; return pinExtraAction; }; @@ -377,7 +377,8 @@ export default () => { }, ]; - const toggleFullScreen = () => setIsFullScreen(isFullScreen => !isFullScreen); + const toggleFullScreen = () => + setIsFullScreen((isFullScreen) => !isFullScreen); const renderLogo = () => ( { { text: 'Management', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); console.log('You clicked management'); }, @@ -409,7 +410,7 @@ export default () => { { text: 'Truncation test is here for a really long item', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); console.log('You clicked truncation test'); }, @@ -417,7 +418,7 @@ export default () => { { text: 'hidden', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); console.log('You clicked hidden'); }, @@ -425,7 +426,7 @@ export default () => { { text: 'Users', href: '#', - onClick: e => { + onClick: (e) => { e.preventDefault(); console.log('You clicked users'); }, diff --git a/src-docs/src/views/package/i18n_tokens.js b/src-docs/src/views/package/i18n_tokens.js index 0a519abd9aa..fe1c8528672 100644 --- a/src-docs/src/views/package/i18n_tokens.js +++ b/src-docs/src/views/package/i18n_tokens.js @@ -84,7 +84,7 @@ export const I18nTokens = { field: 'changeType', name: 'Change', width: '100px', - render: changeType => ( + render: (changeType) => ( {changeType} diff --git a/src-docs/src/views/pagination/centered_pagination.js b/src-docs/src/views/pagination/centered_pagination.js index 2b5561879c0..bbf0dbff8ef 100644 --- a/src-docs/src/views/pagination/centered_pagination.js +++ b/src-docs/src/views/pagination/centered_pagination.js @@ -6,11 +6,11 @@ import { EuiPagination, } from '../../../../src/components'; -export default function() { +export default function () { const [activePage, setActivePage] = useState(0); const PAGE_COUNT = 10; - const goToPage = pageNumber => { + const goToPage = (pageNumber) => { setActivePage(pageNumber); }; @@ -21,7 +21,7 @@ export default function() { aria-label="Centered pagination example" pageCount={PAGE_COUNT} activePage={activePage} - onPageClick={activePage => goToPage(activePage)} + onPageClick={(activePage) => goToPage(activePage)} />
diff --git a/src-docs/src/views/pagination/compressed.js b/src-docs/src/views/pagination/compressed.js index 1c65b0dbb97..9090cd9c11b 100644 --- a/src-docs/src/views/pagination/compressed.js +++ b/src-docs/src/views/pagination/compressed.js @@ -2,11 +2,11 @@ import React, { useState } from 'react'; import { EuiPagination } from '../../../../src/components'; -export default function() { +export default function () { const [activePage, setActivePage] = useState(0); const PAGE_COUNT = 4; - const goToPage = pageNumber => { + const goToPage = (pageNumber) => { setActivePage(pageNumber); }; @@ -14,7 +14,7 @@ export default function() { goToPage(activePage)} + onPageClick={(activePage) => goToPage(activePage)} compressed /> ); diff --git a/src-docs/src/views/pagination/customizable_pagination.js b/src-docs/src/views/pagination/customizable_pagination.js index 409b0943b84..e1af10eb897 100644 --- a/src-docs/src/views/pagination/customizable_pagination.js +++ b/src-docs/src/views/pagination/customizable_pagination.js @@ -16,10 +16,11 @@ export default () => { const PAGE_COUNT = 10; - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); - const goToPage = pageNumber => setActivePage(pageNumber); + const goToPage = (pageNumber) => setActivePage(pageNumber); const button = ( { + const goToPage = (pageNumber) => { setActivePage(pageNumber); }; @@ -15,7 +15,7 @@ export default function() { aria-label="Few pages example" pageCount={PAGE_COUNT} activePage={activePage} - onPageClick={activePage => goToPage(activePage)} + onPageClick={(activePage) => goToPage(activePage)} /> ); } diff --git a/src-docs/src/views/pagination/many_pages.js b/src-docs/src/views/pagination/many_pages.js index 6095b295b43..5a6f050bf83 100644 --- a/src-docs/src/views/pagination/many_pages.js +++ b/src-docs/src/views/pagination/many_pages.js @@ -2,11 +2,11 @@ import React, { useState } from 'react'; import { EuiPagination } from '../../../../src/components'; -export default function() { +export default function () { const [activePage, setActivePage] = useState(0); const PAGE_COUNT = 22; - const goToPage = pageNumber => { + const goToPage = (pageNumber) => { setActivePage(pageNumber); }; @@ -15,7 +15,7 @@ export default function() { aria-label="Many pages example" pageCount={PAGE_COUNT} activePage={activePage} - onPageClick={activePage => goToPage(activePage)} + onPageClick={(activePage) => goToPage(activePage)} /> ); } diff --git a/src-docs/src/views/panel/panel_badge.js b/src-docs/src/views/panel/panel_badge.js index 4920df9a7e3..bafb2abc5c0 100644 --- a/src-docs/src/views/panel/panel_badge.js +++ b/src-docs/src/views/panel/panel_badge.js @@ -8,7 +8,7 @@ import { const badges = [null, 'Beta', 'Lab']; -const panelNodes = badges.map(function(item, index) { +const panelNodes = badges.map(function (item, index) { return ( { }, customProps: { onClick: { - generate: val => { + generate: (val) => { if (!val) return null; const obj = t.arrowFunctionExpression( [], diff --git a/src-docs/src/views/popover/popover.js b/src-docs/src/views/popover/popover.js index 8798fedd8f7..c84819e0980 100644 --- a/src-docs/src/views/popover/popover.js +++ b/src-docs/src/views/popover/popover.js @@ -5,7 +5,8 @@ import { EuiPopover, EuiButton } from '../../../../src/components'; export default () => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); const button = ( diff --git a/src-docs/src/views/popover/popover_anchor_position.js b/src-docs/src/views/popover/popover_anchor_position.js index 6ea81d2114f..526c442016e 100644 --- a/src-docs/src/views/popover/popover_anchor_position.js +++ b/src-docs/src/views/popover/popover_anchor_position.js @@ -24,51 +24,51 @@ export default () => { const [isPopoverOpen12, setIsPopoverOpen12] = useState(false); const onButtonClick1 = () => - setIsPopoverOpen1(isPopoverOpen1 => !isPopoverOpen1); + setIsPopoverOpen1((isPopoverOpen1) => !isPopoverOpen1); const closePopover1 = () => setIsPopoverOpen1(false); const onButtonClick2 = () => - setIsPopoverOpen2(isPopoverOpen2 => !isPopoverOpen2); + setIsPopoverOpen2((isPopoverOpen2) => !isPopoverOpen2); const closePopover2 = () => setIsPopoverOpen2(false); const onButtonClick3 = () => - setIsPopoverOpen3(isPopoverOpen3 => !isPopoverOpen3); + setIsPopoverOpen3((isPopoverOpen3) => !isPopoverOpen3); const closePopover3 = () => setIsPopoverOpen3(false); const onButtonClick4 = () => - setIsPopoverOpen4(isPopoverOpen4 => !isPopoverOpen4); + setIsPopoverOpen4((isPopoverOpen4) => !isPopoverOpen4); const closePopover4 = () => setIsPopoverOpen4(false); const onButtonClick5 = () => - setIsPopoverOpen5(isPopoverOpen5 => !isPopoverOpen5); + setIsPopoverOpen5((isPopoverOpen5) => !isPopoverOpen5); const closePopover5 = () => setIsPopoverOpen5(false); const onButtonClick6 = () => - setIsPopoverOpen6(isPopoverOpen6 => !isPopoverOpen6); + setIsPopoverOpen6((isPopoverOpen6) => !isPopoverOpen6); const closePopover6 = () => setIsPopoverOpen6(false); const onButtonClick7 = () => - setIsPopoverOpen7(isPopoverOpen7 => !isPopoverOpen7); + setIsPopoverOpen7((isPopoverOpen7) => !isPopoverOpen7); const closePopover7 = () => setIsPopoverOpen7(false); const onButtonClick8 = () => - setIsPopoverOpen8(isPopoverOpen8 => !isPopoverOpen8); + setIsPopoverOpen8((isPopoverOpen8) => !isPopoverOpen8); const closePopover8 = () => setIsPopoverOpen8(false); const onButtonClick9 = () => - setIsPopoverOpen9(isPopoverOpen9 => !isPopoverOpen9); + setIsPopoverOpen9((isPopoverOpen9) => !isPopoverOpen9); const closePopover9 = () => setIsPopoverOpen9(false); const onButtonClick10 = () => - setIsPopoverOpen10(isPopoverOpen10 => !isPopoverOpen10); + setIsPopoverOpen10((isPopoverOpen10) => !isPopoverOpen10); const closePopover10 = () => setIsPopoverOpen10(false); const onButtonClick11 = () => - setIsPopoverOpen11(isPopoverOpen11 => !isPopoverOpen11); + setIsPopoverOpen11((isPopoverOpen11) => !isPopoverOpen11); const closePopover11 = () => setIsPopoverOpen11(false); const onButtonClick12 = () => - setIsPopoverOpen12(isPopoverOpen12 => !isPopoverOpen12); + setIsPopoverOpen12((isPopoverOpen12) => !isPopoverOpen12); const closePopover12 = () => setIsPopoverOpen12(false); const noteHeight = ( diff --git a/src-docs/src/views/popover/popover_block.js b/src-docs/src/views/popover/popover_block.js index 6462d4295e0..8eaa775f7d3 100644 --- a/src-docs/src/views/popover/popover_block.js +++ b/src-docs/src/views/popover/popover_block.js @@ -5,7 +5,8 @@ import { EuiButton, EuiPopover } from '../../../../src/components'; export default () => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); const button = ( diff --git a/src-docs/src/views/popover/popover_container.js b/src-docs/src/views/popover/popover_container.js index 21f14628ccb..48371f81a90 100644 --- a/src-docs/src/views/popover/popover_container.js +++ b/src-docs/src/views/popover/popover_container.js @@ -13,7 +13,7 @@ export default () => { const [panelRef, setPanelRef] = useState(null); const onButtonClick = () => - setIsPopoverOpen(isPopoverOpen1 => !isPopoverOpen1); + setIsPopoverOpen((isPopoverOpen1) => !isPopoverOpen1); const closePopover = () => setIsPopoverOpen(false); const button = ( diff --git a/src-docs/src/views/popover/popover_fixed.js b/src-docs/src/views/popover/popover_fixed.js index 6fa4e9e482a..f247467cfba 100644 --- a/src-docs/src/views/popover/popover_fixed.js +++ b/src-docs/src/views/popover/popover_fixed.js @@ -7,9 +7,10 @@ export default () => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); const toggleExample = () => - setIsExampleShown(isExampleShown => !isExampleShown); + setIsExampleShown((isExampleShown) => !isExampleShown); - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); const button = ( diff --git a/src-docs/src/views/popover/popover_htmlelement_anchor.js b/src-docs/src/views/popover/popover_htmlelement_anchor.js index be40eedb9a3..2b9359239bc 100644 --- a/src-docs/src/views/popover/popover_htmlelement_anchor.js +++ b/src-docs/src/views/popover/popover_htmlelement_anchor.js @@ -5,7 +5,7 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { EuiWrappingPopover } from '../../../../src/components'; -const PopoverApp = props => { +const PopoverApp = (props) => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); useEffect(() => { @@ -13,7 +13,8 @@ const PopoverApp = props => { return () => props.anchor.removeEventListener('click', onButtonClick); }, [props.anchor]); - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); return ( diff --git a/src-docs/src/views/popover/popover_panel_class_name.js b/src-docs/src/views/popover/popover_panel_class_name.js index da2bc73477e..ebfda57fa61 100644 --- a/src-docs/src/views/popover/popover_panel_class_name.js +++ b/src-docs/src/views/popover/popover_panel_class_name.js @@ -5,7 +5,8 @@ import { EuiPopover, EuiButton } from '../../../../src/components'; export default () => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); return ( diff --git a/src-docs/src/views/popover/popover_with_title.js b/src-docs/src/views/popover/popover_with_title.js index 8616139f45c..259611ad02d 100644 --- a/src-docs/src/views/popover/popover_with_title.js +++ b/src-docs/src/views/popover/popover_with_title.js @@ -17,15 +17,15 @@ export default () => { const [isPopoverOpen3, setIsPopoverOpen3] = useState(false); const onButtonClick1 = () => - setIsPopoverOpen1(isPopoverOpen1 => !isPopoverOpen1); + setIsPopoverOpen1((isPopoverOpen1) => !isPopoverOpen1); const closePopover1 = () => setIsPopoverOpen1(false); const onButtonClick2 = () => - setIsPopoverOpen2(isPopoverOpen2 => !isPopoverOpen2); + setIsPopoverOpen2((isPopoverOpen2) => !isPopoverOpen2); const closePopover2 = () => setIsPopoverOpen2(false); const onButtonClick3 = () => - setIsPopoverOpen3(isPopoverOpen3 => !isPopoverOpen3); + setIsPopoverOpen3((isPopoverOpen3) => !isPopoverOpen3); const closePopover3 = () => setIsPopoverOpen3(false); return ( diff --git a/src-docs/src/views/popover/popover_with_title_padding.js b/src-docs/src/views/popover/popover_with_title_padding.js index 8f0a58b6f25..2a4465e09f1 100644 --- a/src-docs/src/views/popover/popover_with_title_padding.js +++ b/src-docs/src/views/popover/popover_with_title_padding.js @@ -16,19 +16,19 @@ export default () => { const [isPopoverOpen4, setIsPopoverOpen4] = useState(false); const onButtonClick1 = () => - setIsPopoverOpen1(isPopoverOpen1 => !isPopoverOpen1); + setIsPopoverOpen1((isPopoverOpen1) => !isPopoverOpen1); const closePopover1 = () => setIsPopoverOpen1(false); const onButtonClick2 = () => - setIsPopoverOpen2(isPopoverOpen2 => !isPopoverOpen2); + setIsPopoverOpen2((isPopoverOpen2) => !isPopoverOpen2); const closePopover2 = () => setIsPopoverOpen2(false); const onButtonClick3 = () => - setIsPopoverOpen3(isPopoverOpen3 => !isPopoverOpen3); + setIsPopoverOpen3((isPopoverOpen3) => !isPopoverOpen3); const closePopover3 = () => setIsPopoverOpen3(false); const onButtonClick4 = () => - setIsPopoverOpen4(isPopoverOpen4 => !isPopoverOpen4); + setIsPopoverOpen4((isPopoverOpen4) => !isPopoverOpen4); const closePopover4 = () => setIsPopoverOpen4(false); return ( diff --git a/src-docs/src/views/popover/trap_focus.js b/src-docs/src/views/popover/trap_focus.js index 5f1a8db035f..973943043ee 100644 --- a/src-docs/src/views/popover/trap_focus.js +++ b/src-docs/src/views/popover/trap_focus.js @@ -11,7 +11,8 @@ import { export default () => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); - const onButtonClick = () => setIsPopoverOpen(isPopoverOpen => !isPopoverOpen); + const onButtonClick = () => + setIsPopoverOpen((isPopoverOpen) => !isPopoverOpen); const closePopover = () => setIsPopoverOpen(false); const button = ( diff --git a/src-docs/src/views/portal/portal_insert.js b/src-docs/src/views/portal/portal_insert.js index 0fef90cf382..a7bc7809a5f 100644 --- a/src-docs/src/views/portal/portal_insert.js +++ b/src-docs/src/views/portal/portal_insert.js @@ -8,7 +8,7 @@ let buttonRef = null; export const PortalInsert = () => { const [isPortalVisible, setIsPortalVisible] = useState(false); - const setButtonRef = node => (buttonRef = node); + const setButtonRef = (node) => (buttonRef = node); const togglePortal = () => { setIsPortalVisible(!isPortalVisible); diff --git a/src-docs/src/views/progress/progress_chart.js b/src-docs/src/views/progress/progress_chart.js index 3968a432f96..3606691d7fc 100644 --- a/src-docs/src/views/progress/progress_chart.js +++ b/src-docs/src/views/progress/progress_chart.js @@ -16,7 +16,7 @@ const data = [ export default () => (
- {data.map(item => ( + {data.map((item) => ( <> (
- {data.map(item => ( + {data.map((item) => ( <> { const [showHeader, setShowHeader] = useState(false); let timer; - const progress = value => { + const progress = (value) => { if (value > 100) { setValue(100); } else { diff --git a/src-docs/src/views/progress/progress_value.js b/src-docs/src/views/progress/progress_value.js index 99c32ac67ae..acc0a624f44 100644 --- a/src-docs/src/views/progress/progress_value.js +++ b/src-docs/src/views/progress/progress_value.js @@ -13,7 +13,7 @@ export default () => { const [showProgress, setShowProgress] = useState(false); let timer; - const progress = value => { + const progress = (value) => { if (value > 100) { setValue(100); } else { diff --git a/src-docs/src/views/range/dual_range.js b/src-docs/src/views/range/dual_range.js index 1f7fc9b4bb5..767efc86005 100644 --- a/src-docs/src/views/range/dual_range.js +++ b/src-docs/src/views/range/dual_range.js @@ -7,7 +7,7 @@ import { htmlIdGenerator } from '../../../../src/services'; export default () => { const [value, setValue] = useState(['', '']); - const onChange = value => { + const onChange = (value) => { setValue(value); }; diff --git a/src-docs/src/views/range/input.js b/src-docs/src/views/range/input.js index 0680d5e91ec..4df4cad1dd2 100644 --- a/src-docs/src/views/range/input.js +++ b/src-docs/src/views/range/input.js @@ -8,11 +8,11 @@ export default () => { const [value, setValue] = useState('20'); const [dualValue, setDualValue] = useState([20, 100]); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; - const onDualChange = value => { + const onDualChange = (value) => { setDualValue(value); }; diff --git a/src-docs/src/views/range/input_only.js b/src-docs/src/views/range/input_only.js index 861df70777d..6df4400efd7 100644 --- a/src-docs/src/views/range/input_only.js +++ b/src-docs/src/views/range/input_only.js @@ -9,11 +9,11 @@ export default () => { const [value, setValue] = useState('20'); const [dualValue, setDualValue] = useState([20, 100]); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; - const onDualChange = value => { + const onDualChange = (value) => { setDualValue(value); }; diff --git a/src-docs/src/views/range/levels.js b/src-docs/src/views/range/levels.js index 1d57253dec9..50d728a60ae 100644 --- a/src-docs/src/views/range/levels.js +++ b/src-docs/src/views/range/levels.js @@ -26,11 +26,11 @@ export default () => { }, ]; - const onChange = e => { + const onChange = (e) => { setvalue(e.target.value); }; - const onDualChange = value => { + const onDualChange = (value) => { setDualValue(value); }; @@ -39,7 +39,7 @@ export default () => { onChange(e)} + onChange={(e) => onChange(e)} showTicks tickInterval={20} levels={levels} @@ -54,7 +54,7 @@ export default () => { onDualChange(value)} + onChange={(value) => onDualChange(value)} showTicks ticks={[ { label: '20kb', value: 20 }, diff --git a/src-docs/src/views/range/range.js b/src-docs/src/views/range/range.js index 8ceb4e6c0f3..243b0c1c605 100644 --- a/src-docs/src/views/range/range.js +++ b/src-docs/src/views/range/range.js @@ -7,7 +7,7 @@ import { htmlIdGenerator } from '../../../../src/services'; export default () => { const [value, setValue] = useState('120'); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; diff --git a/src-docs/src/views/range/states.js b/src-docs/src/views/range/states.js index 0d0b11ba4b7..c23f16e3890 100644 --- a/src-docs/src/views/range/states.js +++ b/src-docs/src/views/range/states.js @@ -21,11 +21,11 @@ export default () => { }, ]; - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; - const onDualChange = value => { + const onDualChange = (value) => { setDualValue(value); }; diff --git a/src-docs/src/views/range/ticks.js b/src-docs/src/views/range/ticks.js index 5a57ccb0976..ec26e02363e 100644 --- a/src-docs/src/views/range/ticks.js +++ b/src-docs/src/views/range/ticks.js @@ -13,11 +13,11 @@ export default () => { const [value, setValue] = useState('20'); const [dualValue, setDualValue] = useState([20, 100]); - const onChange = e => { + const onChange = (e) => { setValue(e.target.value); }; - const onDualChange = value => { + const onDualChange = (value) => { setDualValue(value); }; diff --git a/src-docs/src/views/resizable_container/resizable_container_reset_values.js b/src-docs/src/views/resizable_container/resizable_container_reset_values.js index 0b77525473c..aa3ba302ee6 100644 --- a/src-docs/src/views/resizable_container/resizable_container_reset_values.js +++ b/src-docs/src/views/resizable_container/resizable_container_reset_values.js @@ -30,8 +30,8 @@ const defaultSizes = storedSizes || { export default () => { const [savedSizes, setSavedSizes] = useState(storedSizes); const [sizes, setSizes] = useState(defaultSizes); - const onPanelWidthChange = useCallback(newSizes => { - setSizes(prevSizes => ({ + const onPanelWidthChange = useCallback((newSizes) => { + setSizes((prevSizes) => ({ ...prevSizes, ...newSizes, })); diff --git a/src-docs/src/views/resize_observer/resize_observer.js b/src-docs/src/views/resize_observer/resize_observer.js index 9c085a70a74..229ef53684a 100644 --- a/src-docs/src/views/resize_observer/resize_observer.js +++ b/src-docs/src/views/resize_observer/resize_observer.js @@ -19,11 +19,11 @@ export const ResizeObserverExample = () => { const [width, setWidth] = useState(0); const togglePaddingSize = () => { - setPaddingSize(paddingSize => (paddingSize === 's' ? 'l' : 's')); + setPaddingSize((paddingSize) => (paddingSize === 's' ? 'l' : 's')); }; const addItem = () => { - setItems(items => [...items, `Item ${items.length + 1}`]); + setItems((items) => [...items, `Item ${items.length + 1}`]); }; const onResize = ({ height, width }) => { @@ -59,13 +59,13 @@ export const ResizeObserverExample = () => { - {resizeRef => ( + {(resizeRef) => (
    - {items.map(item => ( + {items.map((item) => (
  • {item}
  • ))}
diff --git a/src-docs/src/views/resize_observer/resize_observer_hook.js b/src-docs/src/views/resize_observer/resize_observer_hook.js index 4f245cbc6a1..1297d76c3d5 100644 --- a/src-docs/src/views/resize_observer/resize_observer_hook.js +++ b/src-docs/src/views/resize_observer/resize_observer_hook.js @@ -17,11 +17,11 @@ export const ResizeObserverHookExample = () => { const [items, setItems] = useState(['Item 1', 'Item 2', 'Item 3']); const togglePaddingSize = () => { - setPaddingSize(paddingSize => (paddingSize === 's' ? 'l' : 's')); + setPaddingSize((paddingSize) => (paddingSize === 's' ? 'l' : 's')); }; const addItem = () => { - setItems(items => [...items, `Item ${items.length + 1}`]); + setItems((items) => [...items, `Item ${items.length + 1}`]); }; const resizeRef = useRef(); @@ -57,7 +57,7 @@ export const ResizeObserverHookExample = () => {
    - {items.map(item => ( + {items.map((item) => (
  • {item}
  • ))}
diff --git a/src-docs/src/views/responsive/responsive_example.js b/src-docs/src/views/responsive/responsive_example.js index 2faed04c7d3..5b0885404b7 100644 --- a/src-docs/src/views/responsive/responsive_example.js +++ b/src-docs/src/views/responsive/responsive_example.js @@ -70,7 +70,7 @@ export const ResponsiveExample = {

- {BREAKPOINT_KEYS.map(function(size, index) { + {BREAKPOINT_KEYS.map(function (size, index) { return renderSizes(size, index); })} diff --git a/src-docs/src/views/search_bar/controlled_search_bar.js b/src-docs/src/views/search_bar/controlled_search_bar.js index d8ffeadfb6f..4fb05e61257 100644 --- a/src-docs/src/views/search_bar/controlled_search_bar.js +++ b/src-docs/src/views/search_bar/controlled_search_bar.js @@ -27,13 +27,13 @@ const types = ['dashboard', 'visualization', 'watch']; const users = ['dewey', 'wanda', 'carrie', 'jmack', 'gabic']; -const items = times(10, id => { +const items = times(10, (id) => { return { id, status: random.oneOf(['open', 'closed']), type: random.oneOf(types), tag: random.setOf( - tags.map(tag => tag.name), + tags.map((tag) => tag.name), { min: 0, max: 3 } ), active: random.boolean(), @@ -45,10 +45,10 @@ const items = times(10, id => { }); const loadTags = () => { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve( - tags.map(tag => ({ + tags.map((tag) => ({ value: tag.name, view: {tag.name}, })) @@ -170,11 +170,11 @@ export const ControlledSearchBar = () => { }, tag: { type: 'string', - validate: value => { - if (!tags.some(tag => tag.name === value)) { + validate: (value) => { + if (!tags.some((tag) => tag.name === value)) { throw new Error( `unknown tag (possible values: ${tags - .map(tag => tag.name) + .map((tag) => tag.name) .join(',')})` ); } @@ -222,7 +222,7 @@ export const ControlledSearchBar = () => { { name: 'Open', field: 'status', - render: status => (status === 'open' ? 'Yes' : 'No'), + render: (status) => (status === 'open' ? 'Yes' : 'No'), }, { name: 'Active', @@ -240,7 +240,7 @@ export const ControlledSearchBar = () => { { name: 'Stats', width: '150px', - render: item => { + render: (item) => { return (
{`${item.stars} Stars`}
diff --git a/src-docs/src/views/search_bar/search_bar.js b/src-docs/src/views/search_bar/search_bar.js index 0e4d1accd4e..cdecb522154 100644 --- a/src-docs/src/views/search_bar/search_bar.js +++ b/src-docs/src/views/search_bar/search_bar.js @@ -28,13 +28,13 @@ const types = ['dashboard', 'visualization', 'watch']; const users = ['dewey', 'wanda', 'carrie', 'jmack', 'gabic']; -const items = times(10, id => { +const items = times(10, (id) => { return { id, status: random.oneOf(['open', 'closed']), type: random.oneOf(types), tag: random.setOf( - tags.map(tag => tag.name), + tags.map((tag) => tag.name), { min: 0, max: 3 } ), active: random.boolean(), @@ -46,10 +46,10 @@ const items = times(10, id => { }); const loadTags = () => { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(() => { resolve( - tags.map(tag => ({ + tags.map((tag) => ({ value: tag.name, view: {tag.name}, })) @@ -153,11 +153,11 @@ export const SearchBar = () => { }, tag: { type: 'string', - validate: value => { - if (value !== '' && !tags.some(tag => tag.name === value)) { + validate: (value) => { + if (value !== '' && !tags.some((tag) => tag.name === value)) { throw new Error( `unknown tag (possible values: ${tags - .map(tag => tag.name) + .map((tag) => tag.name) .join(',')})` ); } @@ -205,7 +205,7 @@ export const SearchBar = () => { { name: 'Open', field: 'status', - render: status => (status === 'open' ? 'Yes' : 'No'), + render: (status) => (status === 'open' ? 'Yes' : 'No'), }, { name: 'Active', @@ -223,7 +223,7 @@ export const SearchBar = () => { { name: 'Stats', width: '150px', - render: item => { + render: (item) => { return (
{`${item.stars} Stars`}
diff --git a/src-docs/src/views/search_bar/search_bar_filters.js b/src-docs/src/views/search_bar/search_bar_filters.js index 4c4ef026605..d32bd020cfc 100644 --- a/src-docs/src/views/search_bar/search_bar_filters.js +++ b/src-docs/src/views/search_bar/search_bar_filters.js @@ -43,13 +43,13 @@ const types = ['dashboard', 'visualization', 'watch']; const users = ['dewey', 'wanda', 'carrie', 'jmack', 'gabic']; -const items = times(10, id => { +const items = times(10, (id) => { return { id, status: random.oneOf(['open', 'closed']), type: random.oneOf(types), tag: random.setOf( - tags.map(tag => tag.name), + tags.map((tag) => tag.name), { min: 0, max: 3 } ), active: random.boolean(), @@ -82,7 +82,7 @@ export const SearchBarFilters = () => { field: 'tag', name: 'Tag ("prefix" filter, default)', multiSelect: 'or', - options: tags.map(tag => ({ + options: tags.map((tag) => ({ value: tag.name, view: {tag.name}, })), @@ -93,7 +93,7 @@ export const SearchBarFilters = () => { name: 'Tag ("includes" filter)', filterWith: 'includes', multiSelect: 'or', - options: tags.map(tag => ({ + options: tags.map((tag) => ({ value: tag.name, view: {tag.name}, })), @@ -104,7 +104,7 @@ export const SearchBarFilters = () => { name: 'Tag (custom filter)', filterWith: () => Math.random() > 0.5, multiSelect: 'or', - options: tags.map(tag => ({ + options: tags.map((tag) => ({ value: tag.name, view: {tag.name}, })), @@ -140,11 +140,11 @@ export const SearchBarFilters = () => { }, tag: { type: 'string', - validate: value => { - if (!tags.some(tag => tag.name === value)) { + validate: (value) => { + if (!tags.some((tag) => tag.name === value)) { throw new Error( `unknown tag (possible values: ${tags - .map(tag => tag.name) + .map((tag) => tag.name) .join(',')})` ); } @@ -192,7 +192,7 @@ export const SearchBarFilters = () => { { name: 'Open', field: 'status', - render: status => (status === 'open' ? 'Yes' : 'No'), + render: (status) => (status === 'open' ? 'Yes' : 'No'), }, { name: 'Active', @@ -210,7 +210,7 @@ export const SearchBarFilters = () => { { name: 'Stats', width: '150px', - render: item => { + render: (item) => { return (
{`${item.stars} Stars`}
diff --git a/src-docs/src/views/selectable/search.tsx b/src-docs/src/views/selectable/search.tsx index dee0ea73792..d1a497a80ea 100644 --- a/src-docs/src/views/selectable/search.tsx +++ b/src-docs/src/views/selectable/search.tsx @@ -32,7 +32,7 @@ export default () => { */ const recents = searchData.slice(0, 5); const recentsWithIcon: EuiSelectableTemplateSitewideOption[] = recents.map( - recent => { + (recent) => { return { ...recent, icon: { @@ -74,7 +74,9 @@ export default () => { * Do something with the selection based on the found option with `checked: on` */ const onChange = (updatedOptions: EuiSelectableTemplateSitewideOption[]) => { - const clickedItem = updatedOptions.find(option => option.checked === 'on'); + const clickedItem = updatedOptions.find( + (option) => option.checked === 'on' + ); if (!clickedItem) return; if (clickedItem && clickedItem.url) console.log(clickedItem.url); }; diff --git a/src-docs/src/views/selectable/selectable.tsx b/src-docs/src/views/selectable/selectable.tsx index 75977051b5b..aeb9948da16 100644 --- a/src-docs/src/views/selectable/selectable.tsx +++ b/src-docs/src/views/selectable/selectable.tsx @@ -11,8 +11,8 @@ export default () => { aria-label="Basic example" options={options} listProps={{ bordered: true }} - onChange={newOptions => setOptions(newOptions)}> - {list => list} + onChange={(newOptions) => setOptions(newOptions)}> + {(list) => list} ); }; diff --git a/src-docs/src/views/selectable/selectable_custom_render.js b/src-docs/src/views/selectable/selectable_custom_render.js index 9688e3be4cd..f5f6bbf316c 100644 --- a/src-docs/src/views/selectable/selectable_custom_render.js +++ b/src-docs/src/views/selectable/selectable_custom_render.js @@ -13,7 +13,7 @@ import { createDataStore } from '../tables/data_store'; export default () => { const [useCustomContent, setUseCustomContent] = useState(false); - const countries = createDataStore().countries.map(country => { + const countries = createDataStore().countries.map((country) => { return { label: `${country.name}`, searchableLabel: `${country.name} ${'I am secondary content, I am!'}`, @@ -29,11 +29,11 @@ export default () => { const [options, setOptions] = useState(countries); - const onChange = options => { + const onChange = (options) => { setOptions(options); }; - const onCustom = e => { + const onCustom = (e) => { setUseCustomContent(e.currentTarget.checked); }; diff --git a/src-docs/src/views/selectable/selectable_exclusion.tsx b/src-docs/src/views/selectable/selectable_exclusion.tsx index 48614971c55..9b79f689881 100644 --- a/src-docs/src/views/selectable/selectable_exclusion.tsx +++ b/src-docs/src/views/selectable/selectable_exclusion.tsx @@ -11,8 +11,8 @@ export default () => { aria-label="Example of Selectable supporting exclusions" allowExclusions options={options} - onChange={newOptions => setOptions(newOptions)}> - {list => list} + onChange={(newOptions) => setOptions(newOptions)}> + {(list) => list} ); }; diff --git a/src-docs/src/views/selectable/selectable_messages.tsx b/src-docs/src/views/selectable/selectable_messages.tsx index 69fc556b3ab..8f534c96ec8 100644 --- a/src-docs/src/views/selectable/selectable_messages.tsx +++ b/src-docs/src/views/selectable/selectable_messages.tsx @@ -15,13 +15,13 @@ export default () => { setUseCustomMessage(e.target.checked)} + onChange={(e) => setUseCustomMessage(e.target.checked)} checked={useCustomMessage} />   setIsLoading(e.target.checked)} + onChange={(e) => setIsLoading(e.target.checked)} checked={isLoading} /> @@ -33,7 +33,7 @@ export default () => { isLoading={isLoading} loadingMessage={useCustomMessage ? loadingMessage : undefined} emptyMessage={useCustomMessage ? emptyMessage : undefined}> - {list => list} + {(list) => list} ); diff --git a/src-docs/src/views/selectable/selectable_popover.js b/src-docs/src/views/selectable/selectable_popover.js index dc9afc30529..ad5b1ccaa2c 100644 --- a/src-docs/src/views/selectable/selectable_popover.js +++ b/src-docs/src/views/selectable/selectable_popover.js @@ -18,7 +18,7 @@ import { Options } from './data'; import { createDataStore } from '../tables/data_store'; export default () => { - const countriesStore = createDataStore().countries.map(country => { + const countriesStore = createDataStore().countries.map((country) => { return { id: country.code, label: `${country.name}`, @@ -40,11 +40,11 @@ export default () => { setIsPopoverOpen(false); }; - const onChange = options => { + const onChange = (options) => { setOptions(options); }; - const onFlyoutChange = options => { + const onFlyoutChange = (options) => { setCountries(options); }; @@ -141,7 +141,7 @@ export default () => { onChange={() => {}} style={{ width: 300 }} listProps={{ bordered: true }}> - {list => list} + {(list) => list} ); diff --git a/src-docs/src/views/selectable/selectable_search.tsx b/src-docs/src/views/selectable/selectable_search.tsx index 6649a7ac9cd..f3bed2162e6 100644 --- a/src-docs/src/views/selectable/selectable_search.tsx +++ b/src-docs/src/views/selectable/selectable_search.tsx @@ -15,7 +15,7 @@ export default () => { 'data-test-subj': 'selectableSearchHere', }} options={options} - onChange={newOptions => setOptions(newOptions)}> + onChange={(newOptions) => setOptions(newOptions)}> {(list, search) => ( {search} diff --git a/src-docs/src/views/selectable/selectable_single.tsx b/src-docs/src/views/selectable/selectable_single.tsx index 41535529f19..4d1476db276 100644 --- a/src-docs/src/views/selectable/selectable_single.tsx +++ b/src-docs/src/views/selectable/selectable_single.tsx @@ -5,7 +5,7 @@ import { Options } from './data'; export default () => { const [options, setOptions] = useState( - Options.map(option => { + Options.map((option) => { const { checked, ...checklessOption } = option; return { ...checklessOption }; }) @@ -15,10 +15,10 @@ export default () => { setOptions(newOptions)} + onChange={(newOptions) => setOptions(newOptions)} singleSelection={true} listProps={{ bordered: true }}> - {list => list} + {(list) => list} ); }; diff --git a/src-docs/src/views/side_nav/side_nav_complex.js b/src-docs/src/views/side_nav/side_nav_complex.js index e2e93d78d8b..cadf47c35b9 100644 --- a/src-docs/src/views/side_nav/side_nav_complex.js +++ b/src-docs/src/views/side_nav/side_nav_complex.js @@ -10,7 +10,7 @@ export default () => { setIsSideNavOpenOnMobile(!isSideNavOpenOnMobile); }; - const selectItem = name => { + const selectItem = (name) => { setSelectedItem(name); }; diff --git a/src-docs/src/views/side_nav/side_nav_force_open.js b/src-docs/src/views/side_nav/side_nav_force_open.js index 12b784d6dc5..90532a862a8 100644 --- a/src-docs/src/views/side_nav/side_nav_force_open.js +++ b/src-docs/src/views/side_nav/side_nav_force_open.js @@ -10,7 +10,7 @@ export default () => { setIsSideNavOpenOnMobile(!isSideNavOpenOnMobile); }; - const selectItem = name => { + const selectItem = (name) => { setSelectedItem(name); }; diff --git a/src-docs/src/views/stat/stat_combos.js b/src-docs/src/views/stat/stat_combos.js index ca419f495cb..e0c7ab9c539 100644 --- a/src-docs/src/views/stat/stat_combos.js +++ b/src-docs/src/views/stat/stat_combos.js @@ -13,7 +13,7 @@ import { export default () => { const [isLoading, setLoading] = useState(false); - const onToggleChange = e => { + const onToggleChange = (e) => { setLoading(e.target.checked); }; diff --git a/src-docs/src/views/stat/stat_loading.js b/src-docs/src/views/stat/stat_loading.js index 33a1cb234b8..612174c206d 100644 --- a/src-docs/src/views/stat/stat_loading.js +++ b/src-docs/src/views/stat/stat_loading.js @@ -5,7 +5,7 @@ import { EuiSwitch, EuiStat, EuiSpacer } from '../../../../src/components'; export default () => { const [isLoading, setLoading] = useState(true); - const onToggleChange = e => { + const onToggleChange = (e) => { setLoading(e.target.checked); }; diff --git a/src-docs/src/views/suggest/global_filter_bar.js b/src-docs/src/views/suggest/global_filter_bar.js index aefa66cb3dd..ddb7ce4b4d8 100644 --- a/src-docs/src/views/suggest/global_filter_bar.js +++ b/src-docs/src/views/suggest/global_filter_bar.js @@ -10,14 +10,14 @@ export const GlobalFilterBar = ({ filters, className, ...rest }) => { const classes = classNames('globalFilterBar', className); const pinnedFilters = filters - .filter(filter => filter.isPinned) - .map(filter => { + .filter((filter) => filter.isPinned) + .map((filter) => { return ; }); const unpinnedFilters = filters - .filter(filter => !filter.isPinned) - .map(filter => { + .filter((filter) => !filter.isPinned) + .map((filter) => { return ; }); diff --git a/src-docs/src/views/suggest/global_filter_form.js b/src-docs/src/views/suggest/global_filter_form.js index 65e60fc524e..f0408a9a80d 100644 --- a/src-docs/src/views/suggest/global_filter_form.js +++ b/src-docs/src/views/suggest/global_filter_form.js @@ -68,7 +68,7 @@ const valueOption = [ }, ]; -const GlobalFilterForm = props => { +const GlobalFilterForm = (props) => { const [fieldOptions, setFieldOptions] = useState(fieldOption); const [operandOptions, setOperandOptions] = useState(operatorOption); const [valueOptions, setValueOptions] = useState(valueOption); @@ -84,43 +84,43 @@ const GlobalFilterForm = props => { const [useCustomLabel, setUseCoustomLabel] = useState(false); const [customLabel, setCustomLabel] = useState(''); - const onFieldChange = selectedOptions => { + const onFieldChange = (selectedOptions) => { // We should only get back either 0 or 1 options. setSelectedField(selectedOptions); }; - const onOperandChange = selectedOptions => { + const onOperandChange = (selectedOptions) => { // We should only get back either 0 or 1 options. setSelectedOperand(selectedOptions); }; - const onValuesChange = selectedOptions => { + const onValuesChange = (selectedOptions) => { setSelectedValues(selectedOptions); }; - const onCustomLabelSwitchChange = e => { + const onCustomLabelSwitchChange = (e) => { setCustomLabel(e.target.checked); }; - const onFieldSearchChange = searchValue => { + const onFieldSearchChange = (searchValue) => { setFieldOptions( - fieldOption.filter(option => + fieldOption.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) ) ); }; - const onOperandSearchChange = searchValue => { + const onOperandSearchChange = (searchValue) => { setOperandOptions( - operatorOption.filter(option => + operatorOption.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) ) ); }; - const onValuesSearchChange = searchValue => { + const onValuesSearchChange = (searchValue) => { setValueOptions( - valueOption.filter(option => + valueOption.filter((option) => option.label.toLowerCase().includes(searchValue.toLowerCase()) ) ); @@ -134,7 +134,7 @@ const GlobalFilterForm = props => { setCustomLabel(null); }; - const onCustomLabelChange = value => { + const onCustomLabelChange = (value) => { console.log(value); // setCustomLabel() }; diff --git a/src-docs/src/views/suggest/global_filter_item.js b/src-docs/src/views/suggest/global_filter_item.js index daca167d83a..91f0137a524 100644 --- a/src-docs/src/views/suggest/global_filter_item.js +++ b/src-docs/src/views/suggest/global_filter_item.js @@ -13,7 +13,7 @@ function flattenPanelTree(tree, array = []) { array.push(tree); if (tree.items) { - tree.items.forEach(item => { + tree.items.forEach((item) => { if (item.panel) { flattenPanelTree(item.panel, array); item.panel = item.panel.id; @@ -24,7 +24,7 @@ function flattenPanelTree(tree, array = []) { return array; } -export const GlobalFilterItem = props => { +export const GlobalFilterItem = (props) => { const [isPopoverOpen, setIsPopoverOpen] = useState(false); const togglePopover = () => { setIsPopoverOpen(!isPopoverOpen); @@ -34,7 +34,7 @@ export const GlobalFilterItem = props => { setIsPopoverOpen(false); }; - const deleteFilter = e => { + const deleteFilter = (e) => { window.alert('Filter would have been deleted.'); // Make sure it doesn't also trigger the onclick for the whole badge e.stopPropagation(); diff --git a/src-docs/src/views/suggest/global_filter_options.js b/src-docs/src/views/suggest/global_filter_options.js index 094f496c983..cc8d243a9f1 100644 --- a/src-docs/src/views/suggest/global_filter_options.js +++ b/src-docs/src/views/suggest/global_filter_options.js @@ -11,7 +11,7 @@ function flattenPanelTree(tree, array = []) { array.push(tree); if (tree.items) { - tree.items.forEach(item => { + tree.items.forEach((item) => { if (item.panel) { flattenPanelTree(item.panel, array); item.panel = item.panel.id; diff --git a/src-docs/src/views/suggest/hashtag_popover.js b/src-docs/src/views/suggest/hashtag_popover.js index f557aa28169..9cbc7b00600 100644 --- a/src-docs/src/views/suggest/hashtag_popover.js +++ b/src-docs/src/views/suggest/hashtag_popover.js @@ -14,7 +14,7 @@ import { EuiText, } from '../../../../src/components'; -export default props => { +export default (props) => { const [isPopoverOpen, setPopover] = useState(false); const togglePopover = () => { @@ -81,9 +81,7 @@ export default props => { - ) : ( - undefined - )} + ) : undefined}
); diff --git a/src-docs/src/views/suggest/saved_queries.js b/src-docs/src/views/suggest/saved_queries.js index c9124e598f4..f1de1025596 100644 --- a/src-docs/src/views/suggest/saved_queries.js +++ b/src-docs/src/views/suggest/saved_queries.js @@ -97,11 +97,11 @@ export default () => { setHide(false); }; - const getInputValue = val => { + const getInputValue = (val) => { setValue(val); }; - const onItemClick = item => { + const onItemClick = (item) => { alert(`Item [${item.label}] was clicked`); }; diff --git a/src-docs/src/views/suggest/suggest.js b/src-docs/src/views/suggest/suggest.js index 287a793baea..2b1966824db 100644 --- a/src-docs/src/views/suggest/suggest.js +++ b/src-docs/src/views/suggest/suggest.js @@ -53,12 +53,12 @@ export default () => { const [status, setStatus] = useState('unchanged'); const [radioIdSelected, setSelectedId] = useState(`${idPrefix}0`); - const onChange = optionId => { + const onChange = (optionId) => { setSelectedId(optionId); - setStatus(radios.find(x => x.id === optionId).value); + setStatus(radios.find((x) => x.id === optionId).value); }; - const onItemClick = item => { + const onItemClick = (item) => { alert(`Item [${item.label}] was clicked`); }; @@ -67,7 +67,7 @@ export default () => { onChange(id)} + onChange={(id) => onChange(id)} /> { const [refreshInterval, setRefreshInterval] = useState(); const onTimeChange = ({ start, end }) => { - const recentlyUsedRange = recentlyUsedRanges.filter(recentlyUsedRange => { + const recentlyUsedRange = recentlyUsedRanges.filter((recentlyUsedRange) => { const isDuplicate = recentlyUsedRange.start === start && recentlyUsedRange.end === end; return !isDuplicate; @@ -36,18 +36,18 @@ export default () => { }; const onRefresh = ({ start, end, refreshInterval }) => { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(resolve, 100); }).then(() => { console.log(start, end, refreshInterval); }); }; - const onStartInputChange = e => { + const onStartInputChange = (e) => { setStart(e.target.value); }; - const onEndInputChange = e => { + const onEndInputChange = (e) => { setEnd(e.target.value); }; diff --git a/src-docs/src/views/super_date_picker/super_date_picker_config.js b/src-docs/src/views/super_date_picker/super_date_picker_config.js index 0fc8fb38e6c..10c6915bfd4 100644 --- a/src-docs/src/views/super_date_picker/super_date_picker_config.js +++ b/src-docs/src/views/super_date_picker/super_date_picker_config.js @@ -18,7 +18,7 @@ export default () => { const [refreshInterval, setRefreshInterval] = useState(); const onTimeChange = ({ start, end }) => { - const recentlyUsedRange = recentlyUsedRanges.filter(recentlyUsedRange => { + const recentlyUsedRange = recentlyUsedRanges.filter((recentlyUsedRange) => { const isDuplicate = recentlyUsedRange.start === start && recentlyUsedRange.end === end; return !isDuplicate; @@ -36,7 +36,7 @@ export default () => { }; const onRefresh = ({ start, end, refreshInterval }) => { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(resolve, 100); }).then(() => { console.log(start, end, refreshInterval); diff --git a/src-docs/src/views/super_date_picker/super_date_picker_custom_quick_select.js b/src-docs/src/views/super_date_picker/super_date_picker_custom_quick_select.js index acf363123b1..580f151cc1c 100644 --- a/src-docs/src/views/super_date_picker/super_date_picker_custom_quick_select.js +++ b/src-docs/src/views/super_date_picker/super_date_picker_custom_quick_select.js @@ -29,7 +29,7 @@ export default () => { const [refreshInterval, setRefreshInterval] = useState(); const onTimeChange = ({ start, end }) => { - const recentlyUsedRange = recentlyUsedRanges.filter(recentlyUsedRange => { + const recentlyUsedRange = recentlyUsedRanges.filter((recentlyUsedRange) => { const isDuplicate = recentlyUsedRange.start === start && recentlyUsedRange.end === end; return !isDuplicate; @@ -47,7 +47,7 @@ export default () => { }; const onRefresh = ({ start, end, refreshInterval }) => { - return new Promise(resolve => { + return new Promise((resolve) => { setTimeout(resolve, 100); }).then(() => { console.log(start, end, refreshInterval); diff --git a/src-docs/src/views/super_select/super_select_basic.js b/src-docs/src/views/super_select/super_select_basic.js index 7f72ef2af73..cd388843b25 100644 --- a/src-docs/src/views/super_select/super_select_basic.js +++ b/src-docs/src/views/super_select/super_select_basic.js @@ -35,7 +35,7 @@ export default () => { ]; const [value, setValue] = useState(options[1].value); - const onChange = value => { + const onChange = (value) => { setValue(value); }; @@ -43,7 +43,7 @@ export default () => { onChange(value)} + onChange={(value) => onChange(value)} /> ); }; diff --git a/src-docs/src/views/super_select/super_select_complex.js b/src-docs/src/views/super_select/super_select_complex.js index 1166a86bc07..5f78c3a2e48 100644 --- a/src-docs/src/views/super_select/super_select_complex.js +++ b/src-docs/src/views/super_select/super_select_complex.js @@ -50,7 +50,7 @@ export default () => { const [value, setValue] = useState('option_one'); - const onChange = value => { + const onChange = (value) => { setValue(value); }; @@ -58,7 +58,7 @@ export default () => { onChange(value)} + onChange={(value) => onChange(value)} itemLayoutAlign="top" hasDividers /> diff --git a/src-docs/src/views/super_select/super_select_states.js b/src-docs/src/views/super_select/super_select_states.js index 9f08624cdf0..7d9523ebeeb 100644 --- a/src-docs/src/views/super_select/super_select_states.js +++ b/src-docs/src/views/super_select/super_select_states.js @@ -26,7 +26,7 @@ export default () => { ]; const [value, setValue] = useState(options[1].value); - const onChange = value => { + const onChange = (value) => { setValue(value); }; @@ -36,7 +36,7 @@ export default () => { onChange(value)} + onChange={(value) => onChange(value)} /> ); diff --git a/src-docs/src/views/tables/actions/actions.js b/src-docs/src/views/tables/actions/actions.js index 6545e5cc5b5..d380d6f2425 100644 --- a/src-docs/src/views/tables/actions/actions.js +++ b/src-docs/src/views/tables/actions/actions.js @@ -58,12 +58,12 @@ export const Table = () => { }; const onClickDelete = () => { - store.deleteUsers(...selectedItems.map(user => user.id)); + store.deleteUsers(...selectedItems.map((user) => user.id)); setSelectedItems([]); }; - const onSelectionChange = selectedItems => { + const onSelectionChange = (selectedItems) => { setSelectedItems(selectedItems); }; @@ -89,12 +89,12 @@ export const Table = () => { setCustomAction(!customAction); }; - const deleteUser = user => { + const deleteUser = (user) => { store.deleteUsers(user.id); setSelectedItems([]); }; - const cloneUser = user => { + const cloneUser = (user) => { store.cloneUser(user.id); setSelectedItems([]); }; @@ -114,7 +114,7 @@ export const Table = () => { actions = customAction ? [ { - render: item => { + render: (item) => { return ( cloneUser(item)}> Clone @@ -123,7 +123,7 @@ export const Table = () => { }, }, { - render: item => { + render: (item) => { return ( deleteUser(item)}> Delete @@ -141,7 +141,7 @@ export const Table = () => { 'data-test-subj': 'action-clone', }, { - name: item => (item.id ? 'Delete' : 'Remove'), + name: (item) => (item.id ? 'Delete' : 'Remove'), description: 'Delete this user', icon: 'trash', color: 'danger', @@ -183,7 +183,7 @@ export const Table = () => { actions = customAction ? [ { - render: item => { + render: (item) => { return ( deleteUser(item)} color="danger"> Delete @@ -213,7 +213,7 @@ export const Table = () => { truncateText: true, sortable: true, mobileOptions: { - render: item => ( + render: (item) => ( {item.firstName} {item.lastName} @@ -235,7 +235,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -245,13 +245,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -260,7 +260,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -288,8 +288,8 @@ export const Table = () => { }; const selection = { - selectable: user => user.online, - selectableMessage: selectable => + selectable: (user) => user.online, + selectableMessage: (selectable) => !selectable ? 'User is currently offline' : undefined, onSelectionChange: onSelectionChange, }; diff --git a/src-docs/src/views/tables/auto/auto.js b/src-docs/src/views/tables/auto/auto.js index da1949722d1..334c5cc0eb0 100644 --- a/src-docs/src/views/tables/auto/auto.js +++ b/src-docs/src/views/tables/auto/auto.js @@ -44,7 +44,7 @@ const columns = [ truncateText: true, 'data-test-subj': 'firstNameCell', mobileOptions: { - render: item => ( + render: (item) => ( {item.firstName}{' '} @@ -61,7 +61,7 @@ const columns = [ { field: 'lastName', name: 'Last Name', - render: name => ( + render: (name) => ( {name} @@ -85,7 +85,7 @@ const customColumns = [ 'data-test-subj': 'firstNameCell', width: '20%', mobileOptions: { - render: item => ( + render: (item) => ( {item.firstName}{' '} @@ -102,7 +102,7 @@ const customColumns = [ { field: 'lastName', name: 'Last Name', - render: name => ( + render: (name) => ( {name} @@ -119,7 +119,7 @@ const customColumns = [ const items = store.users.filter((user, index) => index < 10); -const getRowProps = item => { +const getRowProps = (item) => { const { id } = item; return { 'data-test-subj': `row-${id}`, @@ -162,9 +162,9 @@ export const Table = () => { const [layout, setLayout] = useState('fixed'); const [toggleIdSelected, setToggleIdSelected] = useState(`${idPrefix}0`); - const onChange = optionId => { + const onChange = (optionId) => { setToggleIdSelected(optionId); - setLayout(toggleButtons.find(x => x.id === optionId).value); + setLayout(toggleButtons.find((x) => x.id === optionId).value); }; let callOutText; diff --git a/src-docs/src/views/tables/basic/basic.js b/src-docs/src/views/tables/basic/basic.js index 746500eb0ca..53ead7e1faa 100644 --- a/src-docs/src/views/tables/basic/basic.js +++ b/src-docs/src/views/tables/basic/basic.js @@ -40,7 +40,7 @@ export const Table = () => { sortable: true, 'data-test-subj': 'firstNameCell', mobileOptions: { - render: item => ( + render: (item) => ( {item.firstName}{' '} @@ -58,7 +58,7 @@ export const Table = () => { field: 'lastName', name: 'Last Name', truncateText: true, - render: name => ( + render: (name) => ( {name} @@ -75,12 +75,12 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -89,7 +89,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -99,7 +99,7 @@ export const Table = () => { const items = store.users.filter((user, index) => index < 10); - const getRowProps = item => { + const getRowProps = (item) => { const { id } = item; return { 'data-test-subj': `row-${id}`, diff --git a/src-docs/src/views/tables/custom/custom.js b/src-docs/src/views/tables/custom/custom.js index b0be59d1fc9..e96b1012289 100644 --- a/src-docs/src/views/tables/custom/custom.js +++ b/src-docs/src/views/tables/custom/custom.js @@ -222,17 +222,17 @@ export default class extends Component { [ { name: 'title', - getValue: item => item.title.toLowerCase(), + getValue: (item) => item.title.toLowerCase(), isAscending: true, }, { name: 'dateCreated', - getValue: item => item.dateCreated.toLowerCase(), + getValue: (item) => item.dateCreated.toLowerCase(), isAscending: true, }, { name: 'magnitude', - getValue: item => item.magnitude.toLowerCase(), + getValue: (item) => item.magnitude.toLowerCase(), isAscending: true, }, ], @@ -251,7 +251,7 @@ export default class extends Component { label: '', alignment: LEFT_ALIGNMENT, width: '24px', - cellProvider: cell => , + cellProvider: (cell) => , mobileOptions: { show: false, }, @@ -332,7 +332,7 @@ export default class extends Component { this.state.lastItemIndex = this.pager.getLastItemIndex(); } - onChangeItemsPerPage = itemsPerPage => { + onChangeItemsPerPage = (itemsPerPage) => { this.pager.setItemsPerPage(itemsPerPage); this.setState({ itemsPerPage, @@ -341,7 +341,7 @@ export default class extends Component { }); }; - onChangePage = pageIndex => { + onChangePage = (pageIndex) => { this.pager.goToPageIndex(pageIndex); this.setState({ firstItemIndex: this.pager.getFirstItemIndex(), @@ -349,7 +349,7 @@ export default class extends Component { }); }; - onSort = prop => { + onSort = (prop) => { this.sortableProperties.sortOn(prop); this.setState({ @@ -357,8 +357,8 @@ export default class extends Component { }); }; - toggleItem = itemId => { - this.setState(previousState => { + toggleItem = (itemId) => { + this.setState((previousState) => { const newItemIdToSelectedMap = { ...previousState.itemIdToSelectedMap, [itemId]: !previousState.itemIdToSelectedMap[itemId], @@ -374,7 +374,7 @@ export default class extends Component { const allSelected = this.areAllItemsSelected(); const newItemIdToSelectedMap = {}; this.items.forEach( - item => (newItemIdToSelectedMap[item.id] = !allSelected) + (item) => (newItemIdToSelectedMap[item.id] = !allSelected) ); this.setState({ @@ -382,27 +382,27 @@ export default class extends Component { }); }; - isItemSelected = itemId => { + isItemSelected = (itemId) => { return this.state.itemIdToSelectedMap[itemId]; }; areAllItemsSelected = () => { const indexOfUnselectedItem = this.items.findIndex( - item => !this.isItemSelected(item.id) + (item) => !this.isItemSelected(item.id) ); return indexOfUnselectedItem === -1; }; areAnyRowsSelected = () => { return ( - Object.keys(this.state.itemIdToSelectedMap).findIndex(id => { + Object.keys(this.state.itemIdToSelectedMap).findIndex((id) => { return this.state.itemIdToSelectedMap[id]; }) !== -1 ); }; - togglePopover = itemId => { - this.setState(previousState => { + togglePopover = (itemId) => { + this.setState((previousState) => { const newItemIdToOpenActionsPopoverMap = { ...previousState.itemIdToOpenActionsPopoverMap, [itemId]: !previousState.itemIdToOpenActionsPopoverMap[itemId], @@ -414,10 +414,10 @@ export default class extends Component { }); }; - closePopover = itemId => { + closePopover = (itemId) => { // only update the state if this item's popover is open if (this.isPopoverOpen(itemId)) { - this.setState(previousState => { + this.setState((previousState) => { const newItemIdToOpenActionsPopoverMap = { ...previousState.itemIdToOpenActionsPopoverMap, [itemId]: false, @@ -430,11 +430,11 @@ export default class extends Component { } }; - isPopoverOpen = itemId => { + isPopoverOpen = (itemId) => { return this.state.itemIdToOpenActionsPopoverMap[itemId]; }; - renderSelectAll = mobile => { + renderSelectAll = (mobile) => { return ( { + this.columns.forEach((column) => { if (column.isCheckbox || !column.isSortable) { return; } @@ -496,8 +496,8 @@ export default class extends Component { } renderRows() { - const renderRow = item => { - const cells = this.columns.map(column => { + const renderRow = (item) => { + const cells = this.columns.map((column) => { const cell = item[column.id]; let child; @@ -641,7 +641,7 @@ export default class extends Component { totalItemCount: this.pager.getTotalPages(), }; - this.columns.forEach(column => { + this.columns.forEach((column) => { const footer = this.getColumnFooter(column, { items, pagination }); if (column.mobileOptions && column.mobileOptions.only) { return; // exclude columns that only exist for mobile headers diff --git a/src-docs/src/views/tables/data_store.js b/src-docs/src/views/tables/data_store.js index ece0bdf5f7f..a9d1b73082a 100644 --- a/src-docs/src/views/tables/data_store.js +++ b/src-docs/src/views/tables/data_store.js @@ -72,8 +72,8 @@ const github = [ const dob = new Date(1980, 1, 1); -const createUsers = countries => { - return times(20, index => { +const createUsers = (countries) => { + return times(20, (index) => { return { id: index, firstName: index < 10 ? firstNames[index] : firstNames[index - 10], @@ -81,7 +81,7 @@ const createUsers = countries => { github: index < 10 ? github[index] : github[index - 10], dateOfBirth: dob, nationality: random.oneToOne( - countries.map(country => country.code), + countries.map((country) => country.code), index ), online: index % 2 === 0, @@ -129,22 +129,22 @@ export const createDataStore = () => { }, deleteUsers: (...ids) => { - ids.forEach(id => { - const index = users.findIndex(user => user.id === id); + ids.forEach((id) => { + const index = users.findIndex((user) => user.id === id); if (index >= 0) { users.splice(index, 1); } }); }, - cloneUser: id => { - const index = users.findIndex(user => user.id === id); + cloneUser: (id) => { + const index = users.findIndex((user) => user.id === id); if (index >= 0) { const user = users[index]; users.splice(index, 0, { ...user, id: users.length }); } }, - getCountry: code => countries.find(country => country.code === code), + getCountry: (code) => countries.find((country) => country.code === code), }; }; diff --git a/src-docs/src/views/tables/expanding_rows/expanding_rows.js b/src-docs/src/views/tables/expanding_rows/expanding_rows.js index ffada4b1cdb..620a0e0acd1 100644 --- a/src-docs/src/views/tables/expanding_rows/expanding_rows.js +++ b/src-docs/src/views/tables/expanding_rows/expanding_rows.js @@ -55,12 +55,12 @@ export const Table = () => { setSortDirection(sortDirection); }; - const onSelectionChange = selectedItems => { + const onSelectionChange = (selectedItems) => { setSelectedItems(selectedItems); }; const onClickDelete = () => { - store.deleteUsers(...selectedItems.map(user => user.id)); + store.deleteUsers(...selectedItems.map((user) => user.id)); setSelectedItems([]); }; @@ -76,7 +76,7 @@ export const Table = () => { ); }; - const toggleDetails = item => { + const toggleDetails = (item) => { const itemIdToExpandedRowMapValues = { ...itemIdToExpandedRowMap }; if (itemIdToExpandedRowMapValues[item.id]) { delete itemIdToExpandedRowMapValues[item.id]; @@ -118,7 +118,7 @@ export const Table = () => { sortable: true, truncateText: true, mobileOptions: { - render: item => ( + render: (item) => ( {item.firstName} {item.lastName} @@ -141,7 +141,7 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', schema: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { @@ -160,7 +160,7 @@ export const Table = () => { align: RIGHT_ALIGNMENT, width: '40px', isExpander: true, - render: item => ( + render: (item) => ( toggleDetails(item)} aria-label={itemIdToExpandedRowMap[item.id] ? 'Collapse' : 'Expand'} @@ -185,8 +185,8 @@ export const Table = () => { }; const selection = { - selectable: user => user.online, - selectableMessage: selectable => + selectable: (user) => user.online, + selectableMessage: (selectable) => !selectable ? 'User is currently offline' : undefined, onSelectionChange: onSelectionChange, }; diff --git a/src-docs/src/views/tables/footer/footer.js b/src-docs/src/views/tables/footer/footer.js index 0c7723143da..0d7eb672782 100644 --- a/src-docs/src/views/tables/footer/footer.js +++ b/src-docs/src/views/tables/footer/footer.js @@ -55,12 +55,12 @@ export const Table = () => { setSortDirection(sortDirection); }; - const onSelectionChange = selectedItems => { + const onSelectionChange = (selectedItems) => { setSelectedItems(selectedItems); }; const onClickDelete = () => { - store.deleteUsers(...selectedItems.map(user => user.id)); + store.deleteUsers(...selectedItems.map((user) => user.id)); setSelectedItems([]); }; @@ -77,7 +77,7 @@ export const Table = () => { ); }; - const renderStatus = online => { + const renderStatus = (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -133,7 +133,7 @@ export const Table = () => { footer: ({ items }) => ( {uniqBy(items, 'github').length} users ), - render: username => ( + render: (username) => ( {username} @@ -143,7 +143,7 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { @@ -152,7 +152,7 @@ export const Table = () => { footer: ({ items }) => ( {uniqBy(items, 'nationality').length} countries ), - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -161,10 +161,10 @@ export const Table = () => { field: 'online', name: 'Online', footer: ({ items }) => ( - {items.filter(i => !!i.online).length} online + {items.filter((i) => !!i.online).length} online ), dataType: 'boolean', - render: online => renderStatus(online), + render: (online) => renderStatus(online), sortable: true, hideForMobile: true, }, @@ -185,8 +185,8 @@ export const Table = () => { }; const selection = { - selectable: user => user.online, - selectableMessage: selectable => + selectable: (user) => user.online, + selectableMessage: (selectable) => !selectable ? 'User is currently offline' : undefined, onSelectionChange: onSelectionChange, }; diff --git a/src-docs/src/views/tables/in_memory/in_memory.js b/src-docs/src/views/tables/in_memory/in_memory.js index b6120e86165..e680fd0f064 100644 --- a/src-docs/src/views/tables/in_memory/in_memory.js +++ b/src-docs/src/views/tables/in_memory/in_memory.js @@ -47,7 +47,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -57,13 +57,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -72,7 +72,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; diff --git a/src-docs/src/views/tables/in_memory/in_memory_controlled_pagination.js b/src-docs/src/views/tables/in_memory/in_memory_controlled_pagination.js index b230097aaea..b5faba9ce9b 100644 --- a/src-docs/src/views/tables/in_memory/in_memory_controlled_pagination.js +++ b/src-docs/src/views/tables/in_memory/in_memory_controlled_pagination.js @@ -47,7 +47,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -57,13 +57,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -72,7 +72,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -92,7 +92,7 @@ export const Table = () => { useEffect(() => { const updateInterval = setInterval(() => { - setUsers(users => + setUsers((users) => // randomly toggle some of the online statuses users.map(({ online, ...user }) => ({ ...user, diff --git a/src-docs/src/views/tables/in_memory/in_memory_search.js b/src-docs/src/views/tables/in_memory/in_memory_search.js index f00590a281f..be7766a79c6 100644 --- a/src-docs/src/views/tables/in_memory/in_memory_search.js +++ b/src-docs/src/views/tables/in_memory/in_memory_search.js @@ -57,7 +57,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -67,13 +67,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -82,7 +82,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -109,7 +109,7 @@ export const Table = () => { field: 'nationality', name: 'Nationality', multiSelect: false, - options: store.countries.map(country => ({ + options: store.countries.map((country) => ({ value: country.code, name: country.name, view: `${country.flag} ${country.name}`, diff --git a/src-docs/src/views/tables/in_memory/in_memory_search_callback.js b/src-docs/src/views/tables/in_memory/in_memory_search_callback.js index dd58f9921b1..3954721e326 100644 --- a/src-docs/src/views/tables/in_memory/in_memory_search_callback.js +++ b/src-docs/src/views/tables/in_memory/in_memory_search_callback.js @@ -45,7 +45,7 @@ export const Table = () => { setIsLoading(true); requestTimeoutId = setTimeout(() => { - const items = store.users.filter(user => { + const items = store.users.filter((user) => { const normalizedName = `${user.firstName} ${user.lastName}`.toLowerCase(); const normalizedQuery = query.text.toLowerCase(); return normalizedName.indexOf(normalizedQuery) !== -1; @@ -83,7 +83,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -93,13 +93,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -108,7 +108,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; diff --git a/src-docs/src/views/tables/in_memory/in_memory_search_external.js b/src-docs/src/views/tables/in_memory/in_memory_search_external.js index 3cee956bc59..0994b841bfe 100644 --- a/src-docs/src/views/tables/in_memory/in_memory_search_external.js +++ b/src-docs/src/views/tables/in_memory/in_memory_search_external.js @@ -63,7 +63,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -73,13 +73,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -88,7 +88,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -96,13 +96,13 @@ export const Table = () => { }, ]; - const handleOnChange = search => { + const handleOnChange = (search) => { setState(initialState); setQuery(search.queryText); return true; }; - const handleCheckbox = e => { + const handleCheckbox = (e) => { switch (e.target.id) { case 'eu': { const isChecked = !state.eu; @@ -182,7 +182,7 @@ export const Table = () => { field: 'nationality', name: 'Nationality', multiSelect: 'or', - options: store.countries.map(country => ({ + options: store.countries.map((country) => ({ value: country.code, name: country.name, view: `${country.flag} ${country.name}`, diff --git a/src-docs/src/views/tables/in_memory/in_memory_selection.js b/src-docs/src/views/tables/in_memory/in_memory_selection.js index 6a149cb65f5..7f05b489991 100644 --- a/src-docs/src/views/tables/in_memory/in_memory_selection.js +++ b/src-docs/src/views/tables/in_memory/in_memory_selection.js @@ -99,7 +99,7 @@ export const Table = () => { } const onClick = () => { - store.deleteUsers(...selection.map(user => user.id)); + store.deleteUsers(...selection.map((user) => user.id)); setSelection([]); }; @@ -146,7 +146,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -156,13 +156,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -171,7 +171,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -198,7 +198,7 @@ export const Table = () => { field: 'nationality', name: 'Nationality', multiSelect: false, - options: store.countries.map(country => ({ + options: store.countries.map((country) => ({ value: country.code, name: country.name, view: `${country.flag} ${country.name}`, @@ -212,13 +212,13 @@ export const Table = () => { pageSizeOptions: [3, 5, 8], }; - const onlineUsers = store.users.filter(user => user.online); + const onlineUsers = store.users.filter((user) => user.online); const selectionValue = { - selectable: user => user.online, - selectableMessage: selectable => + selectable: (user) => user.online, + selectableMessage: (selectable) => !selectable ? 'User is currently offline' : undefined, - onSelectionChange: selection => setSelection(selection), + onSelectionChange: (selection) => setSelection(selection), initialSelected: onlineUsers, }; diff --git a/src-docs/src/views/tables/mobile/mobile.js b/src-docs/src/views/tables/mobile/mobile.js index 244d56e5bd3..70a20d539a3 100644 --- a/src-docs/src/views/tables/mobile/mobile.js +++ b/src-docs/src/views/tables/mobile/mobile.js @@ -56,7 +56,7 @@ export const Table = () => { setSortDirection(sortDirection); }; - const onSelectionChange = selectedItems => { + const onSelectionChange = (selectedItems) => { setSelectedItems(selectedItems); }; @@ -68,12 +68,12 @@ export const Table = () => { setIsResponsive(!isResponsive); }; - const deleteUser = user => { + const deleteUser = (user) => { store.deleteUsers(user.id); setSelectedItems([]); }; - const cloneUser = user => { + const cloneUser = (user) => { store.cloneUser(user.id); setSelectedItems([]); }; @@ -111,7 +111,7 @@ export const Table = () => { sortable: true, mobileOptions: { render: customHeader - ? item => ( + ? (item) => ( {item.firstName} {item.lastName} @@ -134,7 +134,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -144,13 +144,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -159,7 +159,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -187,8 +187,8 @@ export const Table = () => { }; const selection = { - selectable: user => user.online, - selectableMessage: selectable => + selectable: (user) => user.online, + selectableMessage: (selectable) => !selectable ? 'User is currently offline' : undefined, onSelectionChange: onSelectionChange, }; diff --git a/src-docs/src/views/tables/paginated/paginated.js b/src-docs/src/views/tables/paginated/paginated.js index ddf12379890..aaccb37a24f 100644 --- a/src-docs/src/views/tables/paginated/paginated.js +++ b/src-docs/src/views/tables/paginated/paginated.js @@ -49,7 +49,7 @@ export const Table = () => { setPageSize(pageSize); }; - const renderStatus = online => { + const renderStatus = (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -98,7 +98,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -108,12 +108,12 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -122,7 +122,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => renderStatus(online), + render: (online) => renderStatus(online), }, ]; diff --git a/src-docs/src/views/tables/selection/selection.js b/src-docs/src/views/tables/selection/selection.js index 592553093de..e20f8254cad 100644 --- a/src-docs/src/views/tables/selection/selection.js +++ b/src-docs/src/views/tables/selection/selection.js @@ -55,12 +55,12 @@ export const Table = () => { setSortDirection(sortDirection); }; - const onSelectionChange = selectedItems => { + const onSelectionChange = (selectedItems) => { setSelectedItems(selectedItems); }; const onClickDelete = () => { - store.deleteUsers(...selectedItems.map(user => user.id)); + store.deleteUsers(...selectedItems.map((user) => user.id)); setSelectedItems([]); }; @@ -77,7 +77,7 @@ export const Table = () => { ); }; - const renderStatus = online => { + const renderStatus = (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; @@ -131,7 +131,7 @@ export const Table = () => { { field: 'github', name: 'Github', - render: username => ( + render: (username) => ( {username} @@ -141,13 +141,13 @@ export const Table = () => { field: 'dateOfBirth', name: 'Date of Birth', dataType: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { field: 'nationality', name: 'Nationality', - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -156,7 +156,7 @@ export const Table = () => { field: 'online', name: 'Online', dataType: 'boolean', - render: online => renderStatus(online), + render: (online) => renderStatus(online), sortable: true, mobileOptions: { show: false, @@ -178,11 +178,11 @@ export const Table = () => { }, }; - const onlineUsers = store.users.filter(user => user.online); + const onlineUsers = store.users.filter((user) => user.online); const selection = { - selectable: user => user.online, - selectableMessage: selectable => + selectable: (user) => user.online, + selectableMessage: (selectable) => !selectable ? 'User is currently offline' : undefined, onSelectionChange: onSelectionChange, initialSelected: onlineUsers, diff --git a/src-docs/src/views/tables/sorting/sorting.js b/src-docs/src/views/tables/sorting/sorting.js index de579625b39..b2c5c299353 100644 --- a/src-docs/src/views/tables/sorting/sorting.js +++ b/src-docs/src/views/tables/sorting/sorting.js @@ -65,7 +65,7 @@ export const Table = () => { sortable: true, truncateText: true, mobileOptions: { - render: item => ( + render: (item) => ( {item.firstName} {item.lastName} @@ -101,7 +101,7 @@ export const Table = () => { ), sortable: true, - render: username => ( + render: (username) => ( {username} @@ -123,7 +123,7 @@ export const Table = () => { ), schema: 'date', - render: date => formatDate(date, 'dobLong'), + render: (date) => formatDate(date, 'dobLong'), sortable: true, }, { @@ -142,7 +142,7 @@ export const Table = () => { ), sortable: true, - render: countryCode => { + render: (countryCode) => { const country = store.getCountry(countryCode); return `${country.flag} ${country.name}`; }, @@ -164,7 +164,7 @@ export const Table = () => { ), schema: 'boolean', sortable: true, - render: online => { + render: (online) => { const color = online ? 'success' : 'danger'; const label = online ? 'Online' : 'Offline'; return {label}; diff --git a/src-docs/src/views/tabs/controlled.js b/src-docs/src/views/tabs/controlled.js index 1d42588415d..d3e8b254f32 100644 --- a/src-docs/src/views/tabs/controlled.js +++ b/src-docs/src/views/tabs/controlled.js @@ -91,7 +91,7 @@ const tabs = [ export default () => { const [selectedTab, setSelectedTab] = useState(tabs[1]); - const onTabClick = selectedTab => { + const onTabClick = (selectedTab) => { setSelectedTab(selectedTab); }; diff --git a/src-docs/src/views/tabs/tabbed_content.js b/src-docs/src/views/tabs/tabbed_content.js index a7a47a0e015..22e7af71bd2 100644 --- a/src-docs/src/views/tabs/tabbed_content.js +++ b/src-docs/src/views/tabs/tabbed_content.js @@ -93,7 +93,7 @@ export default () => { tabs={tabs} initialSelectedTab={tabs[1]} autoFocus="selected" - onTabClick={tab => { + onTabClick={(tab) => { console.log('clicked tab', tab); }} /> diff --git a/src-docs/src/views/tabs/tabs.js b/src-docs/src/views/tabs/tabs.js index a997b4eeeac..686114aa980 100644 --- a/src-docs/src/views/tabs/tabs.js +++ b/src-docs/src/views/tabs/tabs.js @@ -44,7 +44,7 @@ const tabs = [ export default () => { const [selectedTabId, setSelectedTabId] = useState('cobalt'); - const onSelectedTabChanged = id => { + const onSelectedTabChanged = (id) => { setSelectedTabId(id); }; diff --git a/src-docs/src/views/tabs/tabs_condensed.js b/src-docs/src/views/tabs/tabs_condensed.js index 9c08925de44..6040dac232a 100644 --- a/src-docs/src/views/tabs/tabs_condensed.js +++ b/src-docs/src/views/tabs/tabs_condensed.js @@ -33,7 +33,7 @@ const tabs = [ export default () => { const [selectedTabId, setSelectedTabId] = useState('cobalt'); - const onSelectedTabChanged = id => { + const onSelectedTabChanged = (id) => { setSelectedTabId(id); }; diff --git a/src-docs/src/views/text_diff/text_diff.js b/src-docs/src/views/text_diff/text_diff.js index 297638dad2b..8e11c834740 100644 --- a/src-docs/src/views/text_diff/text_diff.js +++ b/src-docs/src/views/text_diff/text_diff.js @@ -23,11 +23,11 @@ export default () => { }); useEffect(() => { - textDiffObject.forEach(el => { + textDiffObject.forEach((el) => { if (el[0] === 1) { - setIns(add => add + 1); + setIns((add) => add + 1); } else if (el[0] === -1) { - setDel(sub => sub + 1); + setDel((sub) => sub + 1); } }); // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src-docs/src/views/toast/toast_list.js b/src-docs/src/views/toast/toast_list.js index 62c2494c01a..630f44d76d7 100644 --- a/src-docs/src/views/toast/toast_list.js +++ b/src-docs/src/views/toast/toast_list.js @@ -29,8 +29,8 @@ export default () => { setToasts(toasts.concat(toast)); }; - const removeToast = removedToast => { - setToasts(toasts.filter(toast => toast.id !== removedToast.id)); + const removeToast = (removedToast) => { + setToasts(toasts.filter((toast) => toast.id !== removedToast.id)); }; removeAllToastsHandler = () => { diff --git a/src-docs/src/views/toggle/toggle.js b/src-docs/src/views/toggle/toggle.js index a33738fc50a..04375eac8db 100644 --- a/src-docs/src/views/toggle/toggle.js +++ b/src-docs/src/views/toggle/toggle.js @@ -2,16 +2,16 @@ import React, { useState } from 'react'; import { EuiToggle } from '../../../../src/components'; -export default function() { +export default function () { const [toggleOn, setToggleValue] = useState(false); - const onToggleChange = e => { + const onToggleChange = (e) => { setToggleValue(e.target.checked); }; return (
- onToggleChange(e)} label="Is toggle on?"> + onToggleChange(e)} label="Is toggle on?"> {toggleOn ? 'On' : 'Off'}
diff --git a/src-docs/src/views/tour/fullscreen.js b/src-docs/src/views/tour/fullscreen.js index 2dd6594619f..b79159e15d4 100644 --- a/src-docs/src/views/tour/fullscreen.js +++ b/src-docs/src/views/tour/fullscreen.js @@ -67,14 +67,14 @@ export default () => { reducerState, ] = useEuiTour(demoTourSteps, tourConfig); - const onSelectColor = color => { + const onSelectColor = (color) => { setColor(color); if (reducerState.currentTourStep === 2) { actions.goToStep(3); } }; - const onTabClick = id => { + const onTabClick = (id) => { if (id === 'stat' && reducerState.currentTourStep === 3) { actions.goToStep(4); } @@ -174,7 +174,7 @@ export default () => { return ( - {setIsFullScreen => ( + {(setIsFullScreen) => ( diff --git a/src-docs/src/views/tour/managed.js b/src-docs/src/views/tour/managed.js index d3d07a2c6f5..b744e8831a2 100644 --- a/src-docs/src/views/tour/managed.js +++ b/src-docs/src/views/tour/managed.js @@ -71,7 +71,7 @@ export default () => { setQueryValue(''); }; - const onChange = e => { + const onChange = (e) => { setQueryValue(e.target.value); if (reducerState.currentTourStep < 2) { diff --git a/src-docs/src/views/tour/managed_hook.js b/src-docs/src/views/tour/managed_hook.js index 9577dbe21ef..5e6590b66fe 100644 --- a/src-docs/src/views/tour/managed_hook.js +++ b/src-docs/src/views/tour/managed_hook.js @@ -72,7 +72,7 @@ export default () => { setQueryValue(''); }; - const onChange = e => { + const onChange = (e) => { setQueryValue(e.target.value); if (reducerState.currentTourStep < 2) { diff --git a/src-docs/src/views/tour/tour.js b/src-docs/src/views/tour/tour.js index 529e323ee6a..a6e0f04b304 100644 --- a/src-docs/src/views/tour/tour.js +++ b/src-docs/src/views/tour/tour.js @@ -87,7 +87,7 @@ export default () => { }); }; - const onChange = e => { + const onChange = (e) => { setQueryValue(e.target.value); if (state.currentTourStep < 2) { diff --git a/src-docs/src/views/window_event/modal_example_container.js b/src-docs/src/views/window_event/modal_example_container.js index 7c16c163800..4247f42e8d1 100644 --- a/src-docs/src/views/window_event/modal_example_container.js +++ b/src-docs/src/views/window_event/modal_example_container.js @@ -3,7 +3,7 @@ import { EuiButton } from '../../../../src/components'; import { EuiWindowEvent } from '../../../../src/services'; -export const ModalExample = props => { +export const ModalExample = (props) => { const [open, setOpen] = useState(false); const openModal = () => { diff --git a/src-docs/src/views/window_event/window_event_conflict.js b/src-docs/src/views/window_event/window_event_conflict.js index 0975dc996f7..c9c7eb6d099 100644 --- a/src-docs/src/views/window_event/window_event_conflict.js +++ b/src-docs/src/views/window_event/window_event_conflict.js @@ -13,13 +13,13 @@ import { keys } from '../../../../src/services'; import { ModalExample } from './modal_example_container'; -const ConflictModal = props => { +const ConflictModal = (props) => { const [inputValue, setInputValue] = useState(''); - const updateInputValue = e => { + const updateInputValue = (e) => { setInputValue(e.target.value); }; - const clearInputValueOnEscape = event => { + const clearInputValueOnEscape = (event) => { if (event.key === keys.ESCAPE) { setInputValue(''); event.stopPropagation(); diff --git a/src-docs/webpack.config.js b/src-docs/webpack.config.js index d42383d8d56..a183d629d9a 100644 --- a/src-docs/webpack.config.js +++ b/src-docs/webpack.config.js @@ -136,11 +136,11 @@ function getPortSync(options) { let error = null; getPort(options) - .then(port => { + .then((port) => { isDone = true; freeport = port; }) - .catch(err => { + .catch((err) => { isDone = true; error = err; }); diff --git a/src/components/accessibility/skip_link.test.tsx b/src/components/accessibility/skip_link.test.tsx index 7aee614cf3d..b834f04fcab 100644 --- a/src/components/accessibility/skip_link.test.tsx +++ b/src/components/accessibility/skip_link.test.tsx @@ -52,7 +52,7 @@ describe('EuiSkipLink', () => { }); describe('position', () => { - POSITIONS.forEach(position => { + POSITIONS.forEach((position) => { test(`${position} is rendered`, () => { const component = render( diff --git a/src/components/accordion/accordion.tsx b/src/components/accordion/accordion.tsx index 35b854df4f4..6d3ec3c84ef 100644 --- a/src/components/accordion/accordion.tsx +++ b/src/components/accordion/accordion.tsx @@ -138,7 +138,7 @@ export class EuiAccordion extends Component< this.props.onToggle(forceState === 'open' ? false : true); } else { this.setState( - prevState => ({ + (prevState) => ({ isOpen: !prevState.isOpen, }), () => { @@ -285,14 +285,14 @@ export class EuiAccordion extends Component<
{ + ref={(node) => { this.childWrapper = node; }} id={id}> - {resizeRef => ( + {(resizeRef) => (
{ + ref={(ref) => { this.setChildContentRef(ref); resizeRef(ref); }}> diff --git a/src/components/avatar/avatar.test.tsx b/src/components/avatar/avatar.test.tsx index 8a540d51860..b7f5f4e527a 100644 --- a/src/components/avatar/avatar.test.tsx +++ b/src/components/avatar/avatar.test.tsx @@ -48,7 +48,7 @@ describe('EuiAvatar', () => { }); describe('size', () => { - SIZES.forEach(size => { + SIZES.forEach((size) => { it(`${size} is rendered`, () => { const component = render(); diff --git a/src/components/badge/badge.test.tsx b/src/components/badge/badge.test.tsx index d54e6ed84f3..818560f534e 100644 --- a/src/components/badge/badge.test.tsx +++ b/src/components/badge/badge.test.tsx @@ -130,7 +130,7 @@ describe('EuiBadge', () => { }); describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { it(`${color} is rendered`, () => { const component = render(Content); @@ -154,7 +154,7 @@ describe('EuiBadge', () => { }); describe('iconSide', () => { - ICON_SIDES.forEach(iconSide => { + ICON_SIDES.forEach((iconSide) => { it(`${iconSide} is rendered`, () => { const component = render( @@ -176,7 +176,7 @@ describe('EuiBadge', () => { expect(component).toMatchSnapshot(); }); - COLORS.forEach(color => { + COLORS.forEach((color) => { it(`is rendered with ${color}`, () => { const component = render( diff --git a/src/components/badge/badge_group/badge_group.test.tsx b/src/components/badge/badge_group/badge_group.test.tsx index 7e1cc6318d7..b44ec30fd1a 100644 --- a/src/components/badge/badge_group/badge_group.test.tsx +++ b/src/components/badge/badge_group/badge_group.test.tsx @@ -36,7 +36,7 @@ describe('EuiBadgeGroup', () => { }); describe('gutterSize', () => { - GUTTER_SIZES.forEach(size => { + GUTTER_SIZES.forEach((size) => { it(`${size} is rendered`, () => { const component = render(); diff --git a/src/components/badge/notification_badge/badge_notification.test.tsx b/src/components/badge/notification_badge/badge_notification.test.tsx index d3a2f5af9a0..ef67e58484c 100644 --- a/src/components/badge/notification_badge/badge_notification.test.tsx +++ b/src/components/badge/notification_badge/badge_notification.test.tsx @@ -34,7 +34,7 @@ describe('EuiNotificationBadge', () => { describe('props', () => { describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render( 5 @@ -46,7 +46,7 @@ describe('EuiNotificationBadge', () => { }); describe('size', () => { - SIZES.forEach(size => { + SIZES.forEach((size) => { test(`${size} is rendered`, () => { const component = render( 5 diff --git a/src/components/basic_table/basic_table.test.tsx b/src/components/basic_table/basic_table.test.tsx index 37bfa9e0bce..b6aed3048b2 100644 --- a/src/components/basic_table/basic_table.test.tsx +++ b/src/components/basic_table/basic_table.test.tsx @@ -151,7 +151,7 @@ describe('EuiBasicTable', () => { description: 'description', }, ], - rowProps: item => { + rowProps: (item) => { const { id } = item; return { 'data-test-subj': `row-${id}`, diff --git a/src/components/basic_table/basic_table.tsx b/src/components/basic_table/basic_table.tsx index 92908e24f41..3ada08a1b25 100644 --- a/src/components/basic_table/basic_table.tsx +++ b/src/components/basic_table/basic_table.tsx @@ -366,7 +366,7 @@ export class EuiBasicTable extends Component< 'keydown', 'keyup', 'keypress', - ].forEach(event => { + ].forEach((event) => { tbody.addEventListener(event, listener, true); this.cleanups.push(() => { tbody.removeEventListener(event, listener, true); @@ -375,7 +375,7 @@ export class EuiBasicTable extends Component< }; private removeLoadingListeners = () => { - this.cleanups.forEach(cleanup => cleanup()); + this.cleanups.forEach((cleanup) => cleanup()); this.cleanups.length = 0; }; @@ -532,9 +532,7 @@ export class EuiBasicTable extends Component< {this.renderTableMobileSort()} - ) : ( - undefined - ); + ) : undefined; const caption = this.renderTableCaption(); const head = this.renderTableHead(); const body = this.renderTableBody(); @@ -1040,9 +1038,7 @@ export class EuiBasicTable extends Component< {itemIdToExpandedRowMap[itemId]} - ) : ( - undefined - ); + ) : undefined; const { rowProps: rowPropsCallback } = this.props; const rowProps = getRowProps(item, rowPropsCallback as RowPropsCallback); @@ -1130,7 +1126,7 @@ export class EuiBasicTable extends Component< ); if (actualActions.length > 2) { // if any of the actions `isPrimary`, add them inline as well, but only the first 2 - const primaryActions = actualActions.filter(o => o.isPrimary); + const primaryActions = actualActions.filter((o) => o.isPrimary); actualActions = primaryActions.slice(0, 2); // if we have more than 1 action, we don't show them all in the cell, instead we diff --git a/src/components/basic_table/collapsed_item_actions.tsx b/src/components/basic_table/collapsed_item_actions.tsx index d33c9cb919f..fe31b82cede 100644 --- a/src/components/basic_table/collapsed_item_actions.tsx +++ b/src/components/basic_table/collapsed_item_actions.tsx @@ -56,7 +56,7 @@ export class CollapsedItemActions extends Component< state = { popoverOpen: false }; togglePopover = () => { - this.setState(prevState => ({ popoverOpen: !prevState.popoverOpen })); + this.setState((prevState) => ({ popoverOpen: !prevState.popoverOpen })); }; closePopover = () => { diff --git a/src/components/basic_table/default_item_action.test.tsx b/src/components/basic_table/default_item_action.test.tsx index 6cce1dae8fd..399f7002ba3 100644 --- a/src/components/basic_table/default_item_action.test.tsx +++ b/src/components/basic_table/default_item_action.test.tsx @@ -74,7 +74,7 @@ describe('DefaultItemAction', () => { test('render - name', () => { const action: EmptyButtonAction = { - name: item => {item.id}, + name: (item) => {item.id}, description: 'action 1', type: 'button', onClick: () => {}, diff --git a/src/components/basic_table/expanded_item_actions.test.tsx b/src/components/basic_table/expanded_item_actions.test.tsx index abdfa253e89..355832bf648 100644 --- a/src/components/basic_table/expanded_item_actions.test.tsx +++ b/src/components/basic_table/expanded_item_actions.test.tsx @@ -36,7 +36,7 @@ describe('ExpandedItemActions', () => { { name: 'custom1', description: 'custom 1', - render: _item => <>, + render: (_item) => <>, }, ], itemId: 'xyz', diff --git a/src/components/basic_table/in_memory_table.test.tsx b/src/components/basic_table/in_memory_table.test.tsx index 8622f5501a0..0c2512c5ae8 100644 --- a/src/components/basic_table/in_memory_table.test.tsx +++ b/src/components/basic_table/in_memory_table.test.tsx @@ -309,7 +309,7 @@ describe('EuiInMemoryTable', () => { expect( component .find('tbody .euiTableCellContent__text') - .map(cell => cell.text()) + .map((cell) => cell.text()) ).toEqual(['name3', 'name1', 'name2']); }); @@ -341,7 +341,7 @@ describe('EuiInMemoryTable', () => { expect( component .find('tbody .euiTableCellContent__text') - .map(cell => cell.text()) + .map((cell) => cell.text()) ).toEqual(['name1', 'name2', 'name3']); }); @@ -373,7 +373,7 @@ describe('EuiInMemoryTable', () => { expect( component .find('tbody .euiTableCellContent__text') - .map(cell => cell.text()) + .map((cell) => cell.text()) ).toEqual(['name3', 'name2', 'name1']); }); @@ -412,7 +412,7 @@ describe('EuiInMemoryTable', () => { expect( component .find('tbody .euiTableCellContent__text') - .map(cell => cell.text()) + .map((cell) => cell.text()) ).toEqual(['name3', '1', 'name2', '2', 'name1', '3']); }); @@ -1073,18 +1073,8 @@ describe('EuiInMemoryTable', () => { component.find('button[data-test-subj="pagination-button-1"][disabled]') .length ).toBe(1); - expect( - component - .find('td') - .at(0) - .text() - ).toBe('Index2'); - expect( - component - .find('td') - .at(1) - .text() - ).toBe('Index3'); + expect(component.find('td').at(0).text()).toBe('Index2'); + expect(component.find('td').at(1).text()).toBe('Index3'); // click the first pagination button component @@ -1104,18 +1094,8 @@ describe('EuiInMemoryTable', () => { component.find('button[data-test-subj="pagination-button-1"][disabled]') .length ).toBe(1); - expect( - component - .find('td') - .at(0) - .text() - ).toBe('Index2'); - expect( - component - .find('td') - .at(1) - .text() - ).toBe('Index3'); + expect(component.find('td').at(0).text()).toBe('Index2'); + expect(component.find('td').at(1).text()).toBe('Index3'); // re-render with an updated `pageIndex` value pagination.pageIndex = 2; @@ -1126,18 +1106,8 @@ describe('EuiInMemoryTable', () => { component.find('button[data-test-subj="pagination-button-2"][disabled]') .length ).toBe(1); - expect( - component - .find('td') - .at(0) - .text() - ).toBe('Index4'); - expect( - component - .find('td') - .at(1) - .text() - ).toBe('Index5'); + expect(component.find('td').at(0).text()).toBe('Index4'); + expect(component.find('td').at(1).text()).toBe('Index5'); }); it('respects pageSize', () => { @@ -1172,18 +1142,8 @@ describe('EuiInMemoryTable', () => { // check that the first 2 items rendered expect(component.find('td').length).toBe(2); - expect( - component - .find('td') - .at(0) - .text() - ).toBe('Index0'); - expect( - component - .find('td') - .at(1) - .text() - ).toBe('Index1'); + expect(component.find('td').at(0).text()).toBe('Index0'); + expect(component.find('td').at(1).text()).toBe('Index1'); // change the page size component @@ -1206,18 +1166,8 @@ describe('EuiInMemoryTable', () => { // verify still only rendering the first 2 rows expect(component.find('td').length).toBe(2); - expect( - component - .find('td') - .at(0) - .text() - ).toBe('Index0'); - expect( - component - .find('td') - .at(1) - .text() - ).toBe('Index1'); + expect(component.find('td').at(0).text()).toBe('Index0'); + expect(component.find('td').at(1).text()).toBe('Index1'); // update the controlled page size pagination.pageSize = 4; @@ -1225,30 +1175,10 @@ describe('EuiInMemoryTable', () => { // verify it now renders 4 rows expect(component.find('td').length).toBe(4); - expect( - component - .find('td') - .at(0) - .text() - ).toBe('Index0'); - expect( - component - .find('td') - .at(1) - .text() - ).toBe('Index1'); - expect( - component - .find('td') - .at(2) - .text() - ).toBe('Index2'); - expect( - component - .find('td') - .at(3) - .text() - ).toBe('Index3'); + expect(component.find('td').at(0).text()).toBe('Index0'); + expect(component.find('td').at(1).text()).toBe('Index1'); + expect(component.find('td').at(2).text()).toBe('Index2'); + expect(component.find('td').at(3).text()).toBe('Index3'); }); }); }); diff --git a/src/components/basic_table/in_memory_table.tsx b/src/components/basic_table/in_memory_table.tsx index 37874efe6df..4f21e6ac37e 100644 --- a/src/components/basic_table/in_memory_table.tsx +++ b/src/components/basic_table/in_memory_table.tsx @@ -470,7 +470,7 @@ export class EuiInMemoryTable extends Component< } // Reset pagination state. - this.setState(state => ({ + this.setState((state) => ({ prevProps: { ...state.prevProps, search, diff --git a/src/components/bottom_bar/bottom_bar.test.tsx b/src/components/bottom_bar/bottom_bar.test.tsx index 9f1f04af41f..f63d9dd82ae 100644 --- a/src/components/bottom_bar/bottom_bar.test.tsx +++ b/src/components/bottom_bar/bottom_bar.test.tsx @@ -27,7 +27,7 @@ import { EuiBottomBar, paddingSizeToClassNameMap } from './bottom_bar'; // @ts-ignore TODO: Temporary hack which we can remove once react-test-renderer supports portals. // More info at https://github.com/facebook/react/issues/11565. -ReactDOM.createPortal = node => node; +ReactDOM.createPortal = (node) => node; describe('EuiBottomBar', () => { test('is rendered', () => { @@ -40,7 +40,7 @@ describe('EuiBottomBar', () => { describe('props', () => { describe('paddingSize', () => { - keysOf(paddingSizeToClassNameMap).forEach(paddingSize => { + keysOf(paddingSizeToClassNameMap).forEach((paddingSize) => { test(`${paddingSize} is rendered`, () => { const component = render(); diff --git a/src/components/bottom_bar/bottom_bar.tsx b/src/components/bottom_bar/bottom_bar.tsx index 12d33b352bb..bca87790cb1 100644 --- a/src/components/bottom_bar/bottom_bar.tsx +++ b/src/components/bottom_bar/bottom_bar.tsx @@ -100,7 +100,7 @@ export class EuiBottomBar extends Component { landmarkHeading ? landmarkHeading : screenReaderHeading } className={classes} - ref={node => { + ref={(node) => { this.bar = node; }} {...rest}> diff --git a/src/components/button/button.test.tsx b/src/components/button/button.test.tsx index bcc7c3cd655..63b856e8196 100644 --- a/src/components/button/button.test.tsx +++ b/src/components/button/button.test.tsx @@ -85,7 +85,7 @@ describe('EuiButton', () => { }); describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render(); @@ -95,7 +95,7 @@ describe('EuiButton', () => { }); describe('size', () => { - SIZES.forEach(size => { + SIZES.forEach((size) => { test(`${size} is rendered`, () => { const component = render(); @@ -105,7 +105,7 @@ describe('EuiButton', () => { }); describe('iconSide', () => { - ICON_SIDES.forEach(iconSide => { + ICON_SIDES.forEach((iconSide) => { test(`${iconSide} is rendered`, () => { const component = render( diff --git a/src/components/button/button_content.tsx b/src/components/button/button_content.tsx index c27ff045f3b..9df9aa6d3a5 100644 --- a/src/components/button/button_content.tsx +++ b/src/components/button/button_content.tsx @@ -50,8 +50,9 @@ export interface EuiButtonContentProps extends CommonProps { textProps?: HTMLAttributes & CommonProps; } -export const EuiButtonContent: FunctionComponent = ({ +export const EuiButtonContent: FunctionComponent< + EuiButtonContentType & EuiButtonContentProps +> = ({ children, textProps, isLoading = false, diff --git a/src/components/button/button_empty/button_empty.test.tsx b/src/components/button/button_empty/button_empty.test.tsx index b885fadc683..23e01d1b8bb 100644 --- a/src/components/button/button_empty/button_empty.test.tsx +++ b/src/components/button/button_empty/button_empty.test.tsx @@ -71,7 +71,7 @@ describe('EuiButtonEmpty', () => { }); describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render(); @@ -81,7 +81,7 @@ describe('EuiButtonEmpty', () => { }); describe('size', () => { - SIZES.forEach(size => { + SIZES.forEach((size) => { test(`${size} is rendered`, () => { const component = render(); @@ -91,7 +91,7 @@ describe('EuiButtonEmpty', () => { }); describe('iconSide', () => { - ICON_SIDES.forEach(iconSide => { + ICON_SIDES.forEach((iconSide) => { test(`${iconSide} is rendered`, () => { const component = render( @@ -105,7 +105,7 @@ describe('EuiButtonEmpty', () => { }); describe('flush', () => { - FLUSH_TYPES.forEach(flushType => { + FLUSH_TYPES.forEach((flushType) => { test(`${flushType} is rendered`, () => { const component = render(); diff --git a/src/components/button/button_group/button_group.test.tsx b/src/components/button/button_group/button_group.test.tsx index d1fb2c57e31..46ffcba1a43 100644 --- a/src/components/button/button_group/button_group.test.tsx +++ b/src/components/button/button_group/button_group.test.tsx @@ -78,7 +78,7 @@ describe('EuiButtonGroup', () => { }); describe('buttonSize', () => { - SIZES.forEach(size => { + SIZES.forEach((size) => { test(`${size} is rendered`, () => { const component = render( { }); describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render( { }); describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render( diff --git a/src/components/call_out/call_out.test.tsx b/src/components/call_out/call_out.test.tsx index 0c366abefac..64415856332 100644 --- a/src/components/call_out/call_out.test.tsx +++ b/src/components/call_out/call_out.test.tsx @@ -52,7 +52,7 @@ describe('EuiCallOut', () => { }); describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render(); @@ -62,7 +62,7 @@ describe('EuiCallOut', () => { }); describe('heading', () => { - HEADINGS.forEach(heading => { + HEADINGS.forEach((heading) => { test(`${heading} is rendered`, () => { const component = render(); diff --git a/src/components/card/card.test.tsx b/src/components/card/card.test.tsx index 1618a591042..6b38d81f879 100644 --- a/src/components/card/card.test.tsx +++ b/src/components/card/card.test.tsx @@ -194,7 +194,7 @@ describe('EuiCard', () => { }); describe('paddingSize', () => { - SIZES.forEach(size => { + SIZES.forEach((size) => { test(`${size} is applied`, () => { const component = render( = ({ { + buttonRef={(node) => { link = node; }} /> @@ -338,7 +338,7 @@ export const EuiCard: FunctionComponent = ({ target={target} aria-describedby={`${ariaId}Description`} rel={getSecureRelForTarget({ href, target, rel })} - ref={node => { + ref={(node) => { link = node; }}> {title} @@ -351,7 +351,7 @@ export const EuiCard: FunctionComponent = ({ onClick={onClick as React.MouseEventHandler} disabled={isDisabled} aria-describedby={`${optionalBetaBadgeID} ${ariaId}Description`} - ref={node => { + ref={(node) => { link = node; }}> {title} diff --git a/src/components/code/_code_block.tsx b/src/components/code/_code_block.tsx index 24dd9dc1c52..dd9d1a9ddb4 100644 --- a/src/components/code/_code_block.tsx +++ b/src/components/code/_code_block.tsx @@ -216,7 +216,7 @@ export const EuiCodeBlockImpl: FunctionComponent = ({ {(copyButton: string) => ( - {copy => ( + {(copy) => ( { }); describe('fontSize', () => { - FONT_SIZES.forEach(fontSize => { + FONT_SIZES.forEach((fontSize) => { test(`${fontSize} is rendered`, () => { const component = mount( {code} @@ -99,7 +99,7 @@ describe('EuiCodeBlock', () => { }); describe('paddingSize', () => { - PADDING_SIZES.forEach(paddingSize => { + PADDING_SIZES.forEach((paddingSize) => { test(`${paddingSize} is rendered`, () => { const component = mount( {code} @@ -112,7 +112,7 @@ describe('EuiCodeBlock', () => { }); describe('dynamic content', () => { - it('updates DOM when input changes', done => { + it('updates DOM when input changes', (done) => { expect.assertions(2); function takeSnapshot() { diff --git a/src/components/code_editor/code_editor.tsx b/src/components/code_editor/code_editor.tsx index fb6c7d50aab..00eec161b57 100644 --- a/src/components/code_editor/code_editor.tsx +++ b/src/components/code_editor/code_editor.tsx @@ -154,7 +154,7 @@ export class EuiCodeEditor extends Component< } }; - onKeyDownHint: KeyboardEventHandler = event => { + onKeyDownHint: KeyboardEventHandler = (event) => { if (event.key === keys.ENTER) { event.preventDefault(); this.startEditing(); @@ -202,7 +202,7 @@ export class EuiCodeEditor extends Component< if (el) { const textarea = el.querySelector('textarea'); if (textarea) - keysOf(textareaProps).forEach(key => { + keysOf(textareaProps).forEach((key) => { if (textareaProps[key]) textarea.setAttribute(`${key}`, textareaProps[key]!.toString()); }); @@ -261,7 +261,7 @@ export class EuiCodeEditor extends Component<
{ + ref={(hint) => { this.editorHint = hint; }} tabIndex={0} diff --git a/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.test.tsx b/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.test.tsx index 0475ad8f020..0ac3cdc93de 100644 --- a/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.test.tsx +++ b/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.test.tsx @@ -82,7 +82,7 @@ describe('EuiCollapsibleNavGroup', () => { }); describe('background', () => { - BACKGROUNDS.forEach(color => { + BACKGROUNDS.forEach((color) => { test(`${color} is rendered`, () => { const component = render( diff --git a/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.tsx b/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.tsx index f04b054ef8c..d6aa1e531b6 100644 --- a/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.tsx +++ b/src/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.tsx @@ -169,9 +169,7 @@ export const EuiCollapsibleNavGroup: FunctionComponent - ) : ( - undefined - ); + ) : undefined; if (isCollapsible && title) { return ( diff --git a/src/components/color_picker/color_stops/color_stops.tsx b/src/components/color_picker/color_stops/color_stops.tsx index 1580743044c..25b1c7f7cf9 100644 --- a/src/components/color_picker/color_stops/color_stops.tsx +++ b/src/components/color_picker/color_stops/color_stops.tsx @@ -90,7 +90,7 @@ function sortStops(colorStops: ColorStop[]) { } function getValidStops(colorStops: ColorStop[]) { - return colorStops.map(el => el.stop).filter(stop => !isNaN(stop)); + return colorStops.map((el) => el.stop).filter((stop) => !isNaN(stop)); } function getRangeMin(colorStops: ColorStop[], min?: number) { @@ -217,7 +217,7 @@ export const EuiColorStops: FunctionComponent = ({ useEffect(() => { if (focusStopOnUpdate !== null) { const toFocusIndex = sortedStops - .map(el => el.stop) + .map((el) => el.stop) .indexOf(focusStopOnUpdate); const toFocusId = toFocusIndex > -1 ? sortedStops[toFocusIndex].id : null; onFocusStop(toFocusIndex); @@ -378,7 +378,7 @@ export const EuiColorStops: FunctionComponent = ({ onRemove={ sortedStops.length > 1 ? () => onRemove(colorStop.id) : undefined } - onChange={stop => handleStopChange(stop, colorStop.id)} + onChange={(stop) => handleStopChange(stop, colorStop.id)} onFocus={() => setFocusedStopIndex(index)} parentRef={wrapperRef} colorPickerMode={mode} @@ -386,9 +386,9 @@ export const EuiColorStops: FunctionComponent = ({ colorPickerSwatches={swatches} disabled={disabled} readOnly={readOnly} - aria-valuetext={`Stop: ${colorStop.stop}, Color: ${ - colorStop.color - } (${index + 1} of ${colorStops.length})`} + aria-valuetext={`Stop: ${colorStop.stop}, Color: ${colorStop.color} (${ + index + 1 + } of ${colorStops.length})`} isPopoverOpen={colorStop.id === openedStopId} openPopover={() => { setOpenedStopId(colorStop.id); diff --git a/src/components/color_picker/color_stops/utils.ts b/src/components/color_picker/color_stops/utils.ts index 087dfbecb7a..3e0eb5d832d 100644 --- a/src/components/color_picker/color_stops/utils.ts +++ b/src/components/color_picker/color_stops/utils.ts @@ -49,7 +49,7 @@ export const addStop = ( max: number ) => { const index = colorStops.length ? colorStops.length - 1 : 0; - const stops = colorStops.map(el => el.stop); + const stops = colorStops.map((el) => el.stop); const currentStop = stops[index] != null ? stops[index] : max; let delta = 1; if (index !== 0) { @@ -91,7 +91,7 @@ export const isInvalid = ( colorStops: ColorStop[], showAlpha: boolean = false ) => { - return colorStops.some(colorStop => { + return colorStops.some((colorStop) => { return ( isColorInvalid(colorStop.color, showAlpha) || isStopInvalid(colorStop.stop) diff --git a/src/components/color_picker/utils.ts b/src/components/color_picker/utils.ts index 065e6397c20..e214ee619e0 100644 --- a/src/components/color_picker/utils.ts +++ b/src/components/color_picker/utils.ts @@ -118,7 +118,7 @@ export const parseColor = (input?: string | null) => { const rgb = input .trim() .split(',') - .filter(n => n !== '') + .filter((n) => n !== '') .map(Number); parsed = rgb.length > 2 && rgb.length < 5 ? rgb : HEX_FALLBACK; } else { diff --git a/src/components/combo_box/combo_box.tsx b/src/components/combo_box/combo_box.tsx index 22ffeb4fa9a..ebe581b1ce7 100644 --- a/src/components/combo_box/combo_box.tsx +++ b/src/components/combo_box/combo_box.tsx @@ -227,7 +227,7 @@ export class EuiComboBox extends Component< // Refs comboBoxRefInstance: RefInstance = null; - comboBoxRefCallback: RefCallback = ref => { + comboBoxRefCallback: RefCallback = (ref) => { // IE11 doesn't support the `relatedTarget` event property for blur events // but does add it for focusout. React doesn't support `onFocusOut` so here we are. if (this.comboBoxRefInstance) { @@ -251,20 +251,20 @@ export class EuiComboBox extends Component< } }; autoSizeInputRefInstance: RefInstance = null; - autoSizeInputRefCallback: RefCallback< - AutosizeInput & HTMLDivElement - > = ref => { + autoSizeInputRefCallback: RefCallback = ( + ref + ) => { this.autoSizeInputRefInstance = ref; }; searchInputRefInstance: RefInstance = null; - searchInputRefCallback: RefCallback = ref => { + searchInputRefCallback: RefCallback = (ref) => { this.searchInputRefInstance = ref; if (this.props.inputRef) this.props.inputRef(ref); }; listRefInstance: RefInstance = null; - listRefCallback: RefCallback = ref => { + listRefCallback: RefCallback = (ref) => { if (this.comboBoxRefInstance) { // find the zIndex of the combobox relative to the page body // and use that to depth-position the list box @@ -279,9 +279,9 @@ export class EuiComboBox extends Component< toggleButtonRefInstance: RefInstance< HTMLButtonElement | HTMLSpanElement > = null; - toggleButtonRefCallback: RefCallback< - HTMLButtonElement | HTMLSpanElement - > = ref => { + toggleButtonRefCallback: RefCallback = ( + ref + ) => { this.toggleButtonRefInstance = ref; }; @@ -352,8 +352,9 @@ export class EuiComboBox extends Component< // listElement doesn't have its width set until after updating the position // which means the popover service won't know about the correct width // however, we already know where to position the element - this.listRefInstance.style.left = `${comboBoxBounds.left + - window.pageXOffset}px`; + this.listRefInstance.style.left = `${ + comboBoxBounds.left + window.pageXOffset + }px`; this.listRefInstance.style.width = `${comboBoxBounds.width}px`; } @@ -508,7 +509,7 @@ export class EuiComboBox extends Component< return false; } - const flattenOptions = flattenOptionGroups(options).map(option => { + const flattenOptions = flattenOptionGroups(options).map((option) => { return { ...option, label: option.label.trim().toLowerCase() }; }); @@ -516,7 +517,8 @@ export class EuiComboBox extends Component< selectedOptions.forEach(({ label }) => { const trimmedLabel = label.trim().toLowerCase(); if ( - flattenOptions.findIndex(option => option.label === trimmedLabel) !== -1 + flattenOptions.findIndex((option) => option.label === trimmedLabel) !== + -1 ) numberOfSelectedOptions += 1; }); @@ -524,7 +526,7 @@ export class EuiComboBox extends Component< return flattenOptions.length === numberOfSelectedOptions; }; - onComboBoxFocus: FocusEventHandler = event => { + onComboBoxFocus: FocusEventHandler = (event) => { if (this.props.onFocus) { this.props.onFocus(event); } @@ -546,7 +548,7 @@ export class EuiComboBox extends Component< } }; - onContainerBlur: EventListener = event => { + onContainerBlur: EventListener = (event) => { // close the options list, unless the use clicked on an option /** @@ -586,7 +588,7 @@ export class EuiComboBox extends Component< } }; - onKeyDown: KeyboardEventHandler = event => { + onKeyDown: KeyboardEventHandler = (event) => { switch (event.key) { case keys.ARROW_UP: event.preventDefault(); @@ -645,11 +647,11 @@ export class EuiComboBox extends Component< } }; - onOptionEnterKey: OptionHandler = option => { + onOptionEnterKey: OptionHandler = (option) => { this.onAddOption(option); }; - onOptionClick: OptionHandler = option => { + onOptionClick: OptionHandler = (option) => { this.onAddOption(option); }; @@ -693,10 +695,10 @@ export class EuiComboBox extends Component< } }; - onRemoveOption: OptionHandler = removedOption => { + onRemoveOption: OptionHandler = (removedOption) => { const { onChange, selectedOptions } = this.props; if (onChange) { - onChange(selectedOptions.filter(option => option !== removedOption)); + onChange(selectedOptions.filter((option) => option !== removedOption)); } this.clearActiveOption(); @@ -731,7 +733,7 @@ export class EuiComboBox extends Component< this.props.selectedOptions.length === 1 ) { const selectedOptionIndex = this.state.matchingOptions.findIndex( - option => + (option) => option.label === this.props.selectedOptions[0].label && option.key === this.props.selectedOptions[0].key ); @@ -762,9 +764,9 @@ export class EuiComboBox extends Component< this.closeList(); }; - onSearchChange: NonNullable< - EuiComboBoxInputProps['onChange'] - > = searchValue => { + onSearchChange: NonNullable['onChange']> = ( + searchValue + ) => { const { onSearchChange, delimiter } = this.props; if (onSearchChange) { @@ -953,7 +955,7 @@ export class EuiComboBox extends Component< }); const value = selectedOptions - .map(selectedOption => selectedOption.label) + .map((selectedOption) => selectedOption.label) .join(', '); let optionsList; diff --git a/src/components/combo_box/combo_box_input/combo_box_input.tsx b/src/components/combo_box/combo_box_input/combo_box_input.tsx index 8f77b8e203e..01d1c14d55f 100644 --- a/src/components/combo_box/combo_box_input/combo_box_input.tsx +++ b/src/components/combo_box/combo_box_input/combo_box_input.tsx @@ -93,14 +93,14 @@ export class EuiComboBoxInput extends Component< }); }; - onFocus: FocusEventHandler = event => { + onFocus: FocusEventHandler = (event) => { this.props.onFocus(event); this.setState({ hasFocus: true, }); }; - onBlur: FocusEventHandler = event => { + onBlur: FocusEventHandler = (event) => { if (this.props.onBlur) { this.props.onBlur(event); } @@ -119,7 +119,7 @@ export class EuiComboBoxInput extends Component< } } - inputOnChange: ChangeEventHandler = event => { + inputOnChange: ChangeEventHandler = (event) => { const { onChange, searchValue } = this.props; if (onChange) { onChange(event.target.value as typeof searchValue); @@ -169,7 +169,7 @@ export class EuiComboBoxInput extends Component< false; const pills = selectedOptions - ? selectedOptions.map(option => { + ? selectedOptions.map((option) => { const { key, label, color, onClick, ...rest } = option; const pillOnClose = isDisabled || singleSelection || onClick diff --git a/src/components/combo_box/combo_box_options_list/combo_box_option.tsx b/src/components/combo_box/combo_box_options_list/combo_box_option.tsx index 8f09a87ee08..097e9353b8d 100644 --- a/src/components/combo_box/combo_box_options_list/combo_box_option.tsx +++ b/src/components/combo_box/combo_box_options_list/combo_box_option.tsx @@ -54,7 +54,7 @@ export class EuiComboBoxOption extends Component> { onClick(option); }; - onKeyDown: KeyboardEventHandler = event => { + onKeyDown: KeyboardEventHandler = (event) => { if (event.key === keys.ENTER || event.key === keys.SPACE) { event.preventDefault(); event.stopPropagation(); diff --git a/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx b/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx index 7f0efa491df..ed287d8e8ea 100644 --- a/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx +++ b/src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx @@ -192,7 +192,7 @@ export class EuiComboBoxOptionsList extends Component< } }; - listRefCallback: RefCallback = ref => { + listRefCallback: RefCallback = (ref) => { this.props.listRef(ref); this.listRefInstance = ref; }; @@ -442,9 +442,7 @@ export class EuiComboBoxOptionsList extends Component< {emptyStateContent} - ) : ( - undefined - ); + ) : undefined; const numVisibleOptions = matchingOptions.length < 7 ? matchingOptions.length : 7; diff --git a/src/components/combo_box/matching_options.ts b/src/components/combo_box/matching_options.ts index d2f6340916f..35550c86f61 100644 --- a/src/components/combo_box/matching_options.ts +++ b/src/components/combo_box/matching_options.ts @@ -45,7 +45,7 @@ export const getSelectedOptionForSearchValue = ( ) => { const normalizedSearchValue = searchValue.toLowerCase(); return selectedOptions.find( - option => + (option) => option.label.toLowerCase() === normalizedSearchValue && (!optionKey || option.key === optionKey) ); @@ -97,7 +97,7 @@ export const getMatchingOptions = ( const normalizedSearchValue = searchValue.trim().toLowerCase(); const matchingOptions: Array> = []; - options.forEach(option => { + options.forEach((option) => { if (option.options) { const matchingOptionsForGroup: Array> = []; option.options.forEach((groupOption: EuiComboBoxOptionOption) => { @@ -138,7 +138,7 @@ export const getMatchingOptions = ( others: Array>; } = { startWith: [], others: [] }; - matchingOptions.forEach(object => { + matchingOptions.forEach((object) => { if (object.label.toLowerCase().startsWith(normalizedSearchValue)) { refObj.startWith.push(object); } else { diff --git a/src/components/comment_list/comment_event.tsx b/src/components/comment_list/comment_event.tsx index a257f511595..1826ea1d4b7 100644 --- a/src/components/comment_list/comment_event.tsx +++ b/src/components/comment_list/comment_event.tsx @@ -84,21 +84,15 @@ export const EuiCommentEvent: FunctionComponent = ({
- ) : ( - undefined - )} + ) : undefined}
{actions ? (
{actions}
- ) : ( - undefined - )} + ) : undefined} {children ? (
{children}
- ) : ( - undefined - )} + ) : undefined} ); }; diff --git a/src/components/context_menu/context_menu.test.tsx b/src/components/context_menu/context_menu.test.tsx index bade66c35d7..8eaad16417f 100644 --- a/src/components/context_menu/context_menu.test.tsx +++ b/src/components/context_menu/context_menu.test.tsx @@ -75,7 +75,7 @@ const panel0 = { const panels = [panel0, panel1, panel2, panel3]; export const tick = (ms = 0) => - new Promise(resolve => { + new Promise((resolve) => { setTimeout(resolve, ms); }); diff --git a/src/components/context_menu/context_menu.tsx b/src/components/context_menu/context_menu.tsx index fa87b807ce2..cb19ad796c2 100644 --- a/src/components/context_menu/context_menu.tsx +++ b/src/components/context_menu/context_menu.tsx @@ -81,7 +81,7 @@ const isItemSeparator = ( function mapIdsToPanels(panels: EuiContextMenuPanelDescriptor[]) { const map: { [id: string]: EuiContextMenuPanelDescriptor } = {}; - panels.forEach(panel => { + panels.forEach((panel) => { map[panel.id] = panel; }); @@ -91,9 +91,9 @@ function mapIdsToPanels(panels: EuiContextMenuPanelDescriptor[]) { function mapIdsToPreviousPanels(panels: EuiContextMenuPanelDescriptor[]) { const idToPreviousPanelIdMap: { [panel: string]: EuiContextMenuPanelId } = {}; - panels.forEach(panel => { + panels.forEach((panel) => { if (Array.isArray(panel.items)) { - panel.items.forEach(item => { + panel.items.forEach((item) => { if (isItemSeparator(item)) return; const isCloseable = item.panel !== undefined; if (isCloseable) { @@ -111,7 +111,7 @@ function mapPanelItemsToPanels(panels: EuiContextMenuPanelDescriptor[]) { [id: string]: { [index: string]: EuiContextMenuPanelId }; } = {}; - panels.forEach(panel => { + panels.forEach((panel) => { idAndItemIndexToPanelIdMap[panel.id] = {}; if (panel.items) { @@ -246,7 +246,7 @@ export class EuiContextMenu extends Component { // Set focus on the item which shows the panel we're leaving. const previousPanel = this.state.idToPanelMap[previousPanelId]; const focusedItemIndex = previousPanel.items!.findIndex( - item => + (item) => !isItemSeparator(item) && item.panel === this.state.incomingPanelId ); @@ -288,7 +288,7 @@ export class EuiContextMenu extends Component { const idToRenderedItemsMap: { [id: string]: ReactElement[] } = {}; // Pre-rendering the items lets us check reference equality inside of EuiContextMenuPanel. - panels.forEach(panel => { + panels.forEach((panel) => { idToRenderedItemsMap[panel.id] = this.renderItems(panel.items); }); diff --git a/src/components/context_menu/context_menu_panel.tsx b/src/components/context_menu/context_menu_panel.tsx index 6961aec546b..e6c261c4201 100644 --- a/src/components/context_menu/context_menu_panel.tsx +++ b/src/components/context_menu/context_menu_panel.tsx @@ -302,7 +302,7 @@ export class EuiContextMenuPanel extends Component { // Create fingerprint of all item's watched properties if (items.length && watchedItemProps && watchedItemProps.length) { return JSON.stringify( - items.map(item => { + items.map((item) => { // Create object of item properties and values const props: any = { key: item.key, @@ -433,7 +433,7 @@ export class EuiContextMenuPanel extends Component { className="euiContextMenuPanelTitle" type="button" onClick={onClose} - ref={node => { + ref={(node) => { this.backButton = node; }} data-test-subj="contextMenuPanelTitleButton"> @@ -492,7 +492,7 @@ export class EuiContextMenuPanel extends Component {
this.updateHeight()}> - {resizeRef =>
{content}
} + {(resizeRef) =>
{content}
}
diff --git a/src/components/control_bar/control_bar.tsx b/src/components/control_bar/control_bar.tsx index 17595544dec..4db7960696a 100644 --- a/src/components/control_bar/control_bar.tsx +++ b/src/components/control_bar/control_bar.tsx @@ -412,7 +412,7 @@ export class EuiControlBar extends Component< @@ -448,7 +448,7 @@ export class EuiControlBar extends Component<
{ + ref={(node) => { this.bar = node; }}> {controls.map((control, index) => controlItem(control, index))} diff --git a/src/components/copy/copy.test.tsx b/src/components/copy/copy.test.tsx index 24b14f18319..2015f6523ba 100644 --- a/src/components/copy/copy.test.tsx +++ b/src/components/copy/copy.test.tsx @@ -26,7 +26,7 @@ describe('EuiCopy', () => { test('is rendered', () => { const component = shallow( - {copy => } + {(copy) => } ); expect(component).toMatchSnapshot(); @@ -36,7 +36,7 @@ describe('EuiCopy', () => { test('beforeMessage', () => { const component = shallow( - {copy => } + {(copy) => } ); expect(component.state('tooltipText')).toBe('copy this'); @@ -45,7 +45,7 @@ describe('EuiCopy', () => { test('afterMessage', () => { const component = shallow( - {copy => } + {(copy) => } ); const instance = component.instance(); diff --git a/src/components/datagrid/column_actions.tsx b/src/components/datagrid/column_actions.tsx index fe942b30a5c..996ebc7cfbc 100644 --- a/src/components/datagrid/column_actions.tsx +++ b/src/components/datagrid/column_actions.tsx @@ -32,10 +32,10 @@ export function getColumnActions( if (column.actions === false) { return []; } - const colIdx = columns.findIndex(col => col.id === column.id); + const colIdx = columns.findIndex((col) => col.id === column.id); const sortingIdx = sorting - ? sorting.columns.findIndex(col => col.id === column.id) + ? sorting.columns.findIndex((col) => col.id === column.id) : -1; const sortBy = (direction: 'asc' | 'desc' = 'asc') => { if (!sorting) { @@ -75,7 +75,7 @@ export function getColumnActions( }; const onClickHideColumn = () => setVisibleColumns( - columns.filter(col => col.id !== column.id).map(col => col.id) + columns.filter((col) => col.id !== column.id).map((col) => col.id) ); const onClickSortAsc = () => { @@ -201,7 +201,7 @@ export function getColumnActions( //wrap EuiListGroupItem onClick function to close the popover and prevet bubbling up - return allActions.map(action => { + return allActions.map((action) => { return { ...action, ...{ diff --git a/src/components/datagrid/column_selector.tsx b/src/components/datagrid/column_selector.tsx index b282e31169c..1c8b61223ac 100644 --- a/src/components/datagrid/column_selector.tsx +++ b/src/components/datagrid/column_selector.tsx @@ -89,7 +89,7 @@ export const useColumnSelector = ( function setColumns(nextColumns: string[]) { setSortedColumns(nextColumns); - const nextVisibleColumns = nextColumns.filter(id => + const nextVisibleColumns = nextColumns.filter((id) => visibleColumnIds.has(id) ); setVisibleColumns(nextVisibleColumns); @@ -117,7 +117,7 @@ export const useColumnSelector = ( }); const filteredColumns = sortedColumns.filter( - id => id.toLowerCase().indexOf(columnSearchText.toLowerCase()) !== -1 + (id) => id.toLowerCase().indexOf(columnSearchText.toLowerCase()) !== -1 ); const isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns @@ -201,8 +201,10 @@ export const useColumnSelector = ( isDragDisabled={!isDragEnabled}> {(provided, state) => (
+ className={`euiDataGridColumnSelector__item ${ + state.isDragging && + 'euiDataGridColumnSelector__item-isDragging' + }`}> {allowColumnHiding ? ( @@ -212,12 +214,12 @@ export const useColumnSelector = ( checked={visibleColumnIds.has(id)} compressed className="euiSwitch--mini" - onChange={event => { + onChange={(event) => { const { target: { checked }, } = event; const nextVisibleColumns = sortedColumns.filter( - columnId => + (columnId) => checked ? visibleColumnIds.has(columnId) || id === columnId @@ -280,12 +282,12 @@ export const useColumnSelector = ( () => visibleColumns .map( - columnId => + (columnId) => availableColumns.find( ({ id }) => id === columnId ) as EuiDataGridColumn // cast to avoid `undefined`, it filters those out next ) - .filter(column => column != null), + .filter((column) => column != null), [availableColumns, visibleColumns] ); /** diff --git a/src/components/datagrid/column_sorting_draggable.tsx b/src/components/datagrid/column_sorting_draggable.tsx index 92631a62396..de9517d69c3 100644 --- a/src/components/datagrid/column_sorting_draggable.tsx +++ b/src/components/datagrid/column_sorting_draggable.tsx @@ -97,8 +97,9 @@ export const EuiDataGridColumnSortingDraggable: FunctionComponent {(provided, state) => (
+ className={`euiDataGridColumnSorting__item ${ + state.isDragging && 'euiDataGridColumnSorting__item-isDragging' + }`}>

{ ); expect( - component.find('.euiDataGridRowCell').map(cell => { + component.find('.euiDataGridRowCell').map((cell) => { const props = cell.props(); delete props.children; return props; @@ -790,7 +790,7 @@ Array [ const gridCellClassNames = component .find('[className*="euiDataGridRowCell--"]') - .map(x => x.props().className); + .map((x) => x.props().className); expect(gridCellClassNames).toMatchInlineSnapshot(` Array [ "euiDataGridRowCell euiDataGridRowCell--numeric", @@ -828,7 +828,7 @@ Array [ const gridCellClassNames = component .find('[className~="euiDataGridRowCell"]') - .map(x => x.props().className); + .map((x) => x.props().className); expect(gridCellClassNames).toMatchInlineSnapshot(` Array [ "euiDataGridRowCell euiDataGridRowCell--numeric", @@ -860,7 +860,7 @@ Array [ const gridCellClassNames = component .find('[className~="euiDataGridRowCell"]') - .map(x => x.props().className); + .map((x) => x.props().className); expect(gridCellClassNames).toMatchInlineSnapshot(` Array [ "euiDataGridRowCell euiDataGridRowCell--numeric", @@ -884,7 +884,7 @@ Array [ const component = mount( ({ id }))} + columns={Object.keys(values).map((id) => ({ id }))} columnVisibility={{ visibleColumns: Object.keys(values), setVisibleColumns: () => {}, @@ -897,7 +897,7 @@ Array [ const gridCellClassNames = component .find('[className~="euiDataGridRowCell"]') - .map(x => x.props().className); + .map((x) => x.props().className); expect(gridCellClassNames).toMatchInlineSnapshot(` Array [ "euiDataGridRowCell euiDataGridRowCell--numeric", @@ -919,7 +919,7 @@ Array [ const component = mount( ({ id }))} + columns={Object.keys(values).map((id) => ({ id }))} columnVisibility={{ visibleColumns: Object.keys(values), setVisibleColumns: () => {}, @@ -946,7 +946,7 @@ Array [ const gridCellClassNames = component .find('[className~="euiDataGridRowCell"]') - .map(x => x.props().className); + .map((x) => x.props().className); expect(gridCellClassNames).toMatchInlineSnapshot(` Array [ "euiDataGridRowCell euiDataGridRowCell--numeric", @@ -1036,7 +1036,7 @@ Array [ pageIndex: 0, pageSize: 3, pageSizeOptions: [3, 6, 10], - onChangePage: jest.fn(pageIndex => { + onChangePage: jest.fn((pageIndex) => { const pagination = component.props().pagination; component.setProps({ pagination: { ...pagination, pageIndex }, @@ -1097,7 +1097,7 @@ Array [ pageIndex: 0, pageSize: 3, pageSizeOptions: [3, 6, 10], - onChangePage: jest.fn(pageIndex => { + onChangePage: jest.fn((pageIndex) => { const pagination = component.props().pagination; component.setProps({ pagination: { ...pagination, pageIndex }, @@ -1162,7 +1162,7 @@ Array [ pageSize: 3, pageSizeOptions: [3, 6, 10], onChangePage: jest.fn(), - onChangeItemsPerPage: jest.fn(pageSize => { + onChangeItemsPerPage: jest.fn((pageSize) => { const pagination = component.props().pagination; component.setProps({ pagination: { ...pagination, pageSize }, @@ -1276,7 +1276,7 @@ Array [ }} rowCount={3} renderCellValue={() => 'value'} - onColumnResize={args => onColumnResizeCallback(args)} + onColumnResize={(args) => onColumnResizeCallback(args)} /> ); @@ -1435,7 +1435,7 @@ Array [ describe('column sorting', () => { it('calls the onSort callback', () => { - const onSort = jest.fn(columns => { + const onSort = jest.fn((columns) => { component.setProps({ sorting: { columns, onSort } }); component.update(); }); @@ -1540,7 +1540,7 @@ Array [ }); it('sorts in response to user interaction', () => { - const onSort = jest.fn(columns => { + const onSort = jest.fn((columns) => { component.setProps({ sorting: { columns, onSort } }); component.update(); }); @@ -1597,7 +1597,7 @@ Array [ }); it('sorts with all digit groups in numerical-like', () => { - const onSort = jest.fn(columns => { + const onSort = jest.fn((columns) => { component.setProps({ sorting: { columns, onSort } }); component.update(); }); @@ -1737,7 +1737,7 @@ Array [ expect( popover .find('.euiDataGridColumnSelector__item') - .map(item => item.text()) + .map((item) => item.text()) ).toEqual(['A', 'B']); closeColumnSelector(component); @@ -1755,7 +1755,7 @@ Array [ expect( popover .find('.euiDataGridColumnSelector__item') - .map(item => item.text()) + .map((item) => item.text()) ).toEqual(['A', 'C']); closeColumnSelector(component); }); @@ -1786,7 +1786,7 @@ Array [ expect( popover .find('.euiDataGridColumnSorting__field') - .map(item => item.text()) + .map((item) => item.text()) ).toEqual(['A', 'B']); closeColumnSorterSelection(component); closeColumnSorter(component); @@ -1806,7 +1806,7 @@ Array [ expect( popover .find('.euiDataGridColumnSorting__field') - .map(item => item.text()) + .map((item) => item.text()) ).toEqual(['A', 'C']); closeColumnSorterSelection(component); closeColumnSorter(component); @@ -2140,9 +2140,7 @@ Array [ focusableCell.find('[data-test-subj="cell-content"]').text() ).toEqual('0, A'); - findTestSubject(component, 'dataGridRowCell') - .at(3) - .simulate('focus'); + findTestSubject(component, 'dataGridRowCell').at(3).simulate('focus'); focusableCell = getFocusableCell(component); expect(focusableCell.length).toEqual(1); diff --git a/src/components/datagrid/data_grid.tsx b/src/components/datagrid/data_grid.tsx index d51b72c6fba..505bd4070df 100644 --- a/src/components/datagrid/data_grid.tsx +++ b/src/components/datagrid/data_grid.tsx @@ -431,7 +431,7 @@ function useInMemoryValues( const nextInMemoryValues = _inMemoryValues.current; nextInMemoryValues[rowIndex] = nextInMemoryValues[rowIndex] || {}; nextInMemoryValues[rowIndex][columnId] = value; - setInMemoryValuesVersion(version => version + 1); + setInMemoryValuesVersion((version) => version + 1); }, []); // if `inMemory.level` or `rowCount` changes reset the values @@ -446,7 +446,7 @@ function useInMemoryValues( for (let i = rowCount; i < existingRowKeyCount; i++) { delete _inMemoryValues.current[i]; } - setInMemoryValuesVersion(version => version + 1); + setInMemoryValuesVersion((version) => version + 1); } }, [inMemoryLevel, rowCount]); @@ -584,7 +584,7 @@ const useFocus = ( } : { tabIndex: 0, - onFocus: e => { + onFocus: (e) => { // if e.target (the source element of the `focus event` // matches e.currentTarget (always the div with this onFocus listener) // then the user has focused directly on the data grid wrapper (almost definitely by tabbing) @@ -626,7 +626,7 @@ function checkOrDefaultToolBarDiplayOptions< } const emptyArrayDefault: EuiDataGridControlColumn[] = []; -export const EuiDataGrid: FunctionComponent = props => { +export const EuiDataGrid: FunctionComponent = (props) => { const [isFullScreen, setIsFullScreen] = useState(false); const [hasRoomForGridControls, setHasRoomForGridControls] = useState(true); const [containerRef, _setContainerRef] = useState( @@ -635,14 +635,14 @@ export const EuiDataGrid: FunctionComponent = props => { const [interactiveCellId] = useState(htmlIdGenerator()()); const [headerIsInteractive, setHeaderIsInteractive] = useState(false); - const setContainerRef = useCallback(ref => _setContainerRef(ref), []); + const setContainerRef = useCallback((ref) => _setContainerRef(ref), []); const [wrappingDivFocusProps, focusedCell, setFocusedCell] = useFocus( headerIsInteractive ); const handleHeaderChange = useCallback<(headerRow: HTMLElement) => void>( - headerRow => { + (headerRow) => { const tabbables = tabbable(headerRow); const managed = headerRow.querySelectorAll('[data-euigrid-tab-managed]'); const hasInteractives = tabbables.length > 0 || managed.length > 0; @@ -659,7 +659,7 @@ export const EuiDataGrid: FunctionComponent = props => { [headerIsInteractive, setHeaderIsInteractive, focusedCell, setFocusedCell] ); const handleHeaderMutation = useCallback( - records => { + (records) => { const [{ target }] = records; // find the wrapping header div @@ -712,7 +712,7 @@ export const EuiDataGrid: FunctionComponent = props => { // enables/disables grid controls based on available width const onResize = useOnResize( - nextHasRoomForGridControls => { + (nextHasRoomForGridControls) => { if (nextHasRoomForGridControls !== hasRoomForGridControls) { setHasRoomForGridControls(nextHasRoomForGridControls); } @@ -1013,7 +1013,7 @@ export const EuiDataGrid: FunctionComponent = props => {

) : null} - {resizeRef => ( + {(resizeRef) => (
= props => { childList: true, }} onMutation={handleHeaderMutation}> - {ref => ( + {(ref) => ( = ( - a, - b, - direction -) => { +const defaultComparator: NonNullable< + EuiDataGridSchemaDetector['comparator'] +> = (a, b, direction) => { if (a < b) return direction === 'asc' ? -1 : 1; if (a > b) return direction === 'asc' ? 1 : -1; return 0; @@ -93,7 +91,9 @@ const providedPopoverContents: EuiDataGridPopoverContents = { }, }; -export const EuiDataGridBody: FunctionComponent = props => { +export const EuiDataGridBody: FunctionComponent = ( + props +) => { const { columnWidths, defaultColumnWidth, diff --git a/src/components/datagrid/data_grid_cell.tsx b/src/components/datagrid/data_grid_cell.tsx index 0467bf46d63..bc168ecb23c 100644 --- a/src/components/datagrid/data_grid_cell.tsx +++ b/src/components/datagrid/data_grid_cell.tsx @@ -103,10 +103,12 @@ export type EuiDataGridCellValueProps = Omit< 'width' | 'isFocused' | 'interactiveCellId' | 'onCellFocus' | 'popoverContent' >; -const EuiDataGridCellContent: FunctionComponent = memo(props => { +const EuiDataGridCellContent: FunctionComponent< + EuiDataGridCellValueProps & { + setCellProps: EuiDataGridCellValueElementProps['setCellProps']; + isExpanded: boolean; + } +> = memo((props) => { const { renderCellValue, ...rest } = props; // React is more permissible than the TS types indicate @@ -440,7 +442,7 @@ export class EuiDataGridCell extends Component< - {mutationRef => { + {(mutationRef) => { return (
- {mutationRef => { + {(mutationRef) => { return (
(this.popoverPanelRef.current = ref)} + panelRef={(ref) => (this.popoverPanelRef.current = ref)} ownFocus panelClassName="euiDataGridRowCell__popover" zIndex={8001} display="block" closePopover={() => this.setState({ popoverIsOpen: false })} - onKeyDown={event => { + onKeyDown={(event) => { if (event.key === keys.F2 || event.key === keys.ESCAPE) { event.preventDefault(); event.stopPropagation(); diff --git a/src/components/datagrid/data_grid_control_header_cell.tsx b/src/components/datagrid/data_grid_control_header_cell.tsx index 3c4288b3704..d8af548fda8 100644 --- a/src/components/datagrid/data_grid_control_header_cell.tsx +++ b/src/components/datagrid/data_grid_control_header_cell.tsx @@ -36,7 +36,9 @@ export interface EuiDataGridControlHeaderRowProps { className?: string; } -export const EuiDataGridControlHeaderCell: FunctionComponent = props => { +export const EuiDataGridControlHeaderCell: FunctionComponent = ( + props +) => { const { controlColumn, index, diff --git a/src/components/datagrid/data_grid_data_row.tsx b/src/components/datagrid/data_grid_data_row.tsx index 2c102526dc7..3baaa4a1ffe 100644 --- a/src/components/datagrid/data_grid_data_row.tsx +++ b/src/components/datagrid/data_grid_data_row.tsx @@ -54,7 +54,7 @@ const DefaultColumnFormatter: EuiDataGridPopoverContent = ({ children }) => { }; const EuiDataGridDataRow: FunctionComponent = memo( - props => { + (props) => { const { leadingControlColumns, trailingControlColumns, diff --git a/src/components/datagrid/data_grid_header_cell.tsx b/src/components/datagrid/data_grid_header_cell.tsx index 5087c666df9..4eb6a2fe561 100644 --- a/src/components/datagrid/data_grid_header_cell.tsx +++ b/src/components/datagrid/data_grid_header_cell.tsx @@ -50,7 +50,9 @@ export interface EuiDataGridHeaderCellProps className?: string; } -export const EuiDataGridHeaderCell: FunctionComponent = props => { +export const EuiDataGridHeaderCell: FunctionComponent = ( + props +) => { const { column, index, @@ -99,7 +101,7 @@ export const EuiDataGridHeaderCell: FunctionComponent= 2 && sortedColumnIds.has(id)) { sortString = sorting.columns - .map(col => `Sorted by ${col.id} ${col.direction}`) + .map((col) => `Sorted by ${col.id} ${col.direction}`) .join(' then '); ariaProps['aria-describedby'] = screenReaderId; } diff --git a/src/components/datagrid/data_grid_inmemory_renderer.tsx b/src/components/datagrid/data_grid_inmemory_renderer.tsx index e28658a7a4c..2a792db82af 100644 --- a/src/components/datagrid/data_grid_inmemory_renderer.tsx +++ b/src/components/datagrid/data_grid_inmemory_renderer.tsx @@ -71,7 +71,7 @@ export const EuiDataGridInMemoryRenderer: FunctionComponent { + .map((column) => { const skipThisColumn = inMemory.skipColumns && inMemory.skipColumns.indexOf(column.id) !== -1; @@ -99,7 +99,7 @@ export const EuiDataGridInMemoryRenderer: FunctionComponent ); }) - .filter(cell => cell != null) + .filter((cell) => cell != null) ); } @@ -107,7 +107,7 @@ export const EuiDataGridInMemoryRenderer: FunctionComponent( - records => { + (records) => { recordLoop: for (let i = 0; i < records.length; i++) { const record = records[i]; let target: Node | null = record.target; @@ -156,7 +156,7 @@ export const EuiDataGridInMemoryRenderer: FunctionComponent - {ref =>
{cells}
} + {(ref) =>
{cells}
} , (documentFragment as unknown) as Element ); diff --git a/src/components/datagrid/data_grid_schema.tsx b/src/components/datagrid/data_grid_schema.tsx index af02f089433..beec874e110 100644 --- a/src/components/datagrid/data_grid_schema.tsx +++ b/src/components/datagrid/data_grid_schema.tsx @@ -127,10 +127,10 @@ export const schemaDetectors: EuiDataGridSchemaDetector[] = [ return (matchLength / value.length) * confidenceAdjustment || 0; }, comparator: (a, b, direction) => { - const aChars = a.split('').filter(char => numericChars.has(char)); + const aChars = a.split('').filter((char) => numericChars.has(char)); const aValue = parseFloat(aChars.join('')); - const bChars = b.split('').filter(char => numericChars.has(char)); + const bChars = b.split('').filter((char) => numericChars.has(char)); const bValue = parseFloat(bChars.join('')); if (aValue < bValue) return direction === 'asc' ? -1 : 1; @@ -439,7 +439,7 @@ export function getDetailsForSchema( detectors: EuiDataGridSchemaDetector[], providedSchema: string | null ) { - const results = detectors.filter(matches => { + const results = detectors.filter((matches) => { return matches.type === providedSchema; }); diff --git a/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx b/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx index 320557bdd4a..63c5b104307 100644 --- a/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx +++ b/src/components/date_picker/super_date_picker/date_popover/absolute_tab.tsx @@ -88,7 +88,7 @@ export class EuiAbsoluteTab extends Component< }); }; - handleTextChange: ChangeEventHandler = event => { + handleTextChange: ChangeEventHandler = (event) => { const { onChange } = this.props; const valueAsMoment = moment( event.target.value, diff --git a/src/components/date_picker/super_date_picker/date_popover/date_popover_button.tsx b/src/components/date_picker/super_date_picker/date_popover/date_popover_button.tsx index d42a1ce391e..918775d6a23 100644 --- a/src/components/date_picker/super_date_picker/date_popover/date_popover_button.tsx +++ b/src/components/date_picker/super_date_picker/date_popover/date_popover_button.tsx @@ -52,7 +52,9 @@ export interface EuiDatePopoverButtonProps { utcOffset?: number; } -export const EuiDatePopoverButton: FunctionComponent = props => { +export const EuiDatePopoverButton: FunctionComponent = ( + props +) => { const { position, isDisabled, diff --git a/src/components/date_picker/super_date_picker/date_popover/date_popover_content.tsx b/src/components/date_picker/super_date_picker/date_popover/date_popover_content.tsx index d6743e9308a..b73ced799c3 100644 --- a/src/components/date_picker/super_date_picker/date_popover/date_popover_content.tsx +++ b/src/components/date_picker/super_date_picker/date_popover/date_popover_content.tsx @@ -55,7 +55,7 @@ export const EuiDatePopoverContent: FunctionComponent { - const onTabClick: EuiTabbedContentProps['onTabClick'] = selectedTab => { + const onTabClick: EuiTabbedContentProps['onTabClick'] = (selectedTab) => { switch (selectedTab.id) { case DATE_MODES.ABSOLUTE: onChange(toAbsoluteString(value, roundUp)); @@ -133,7 +133,7 @@ export const EuiDatePopoverContent: FunctionComponent tab.id === getDateMode(value) + (tab) => tab.id === getDateMode(value) ); return ( diff --git a/src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx b/src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx index f6521e5548f..502111a2546 100644 --- a/src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx +++ b/src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx @@ -72,7 +72,7 @@ export class EuiRelativeTab extends Component< generateId = htmlIdGenerator(); - onCountChange: ChangeEventHandler = event => { + onCountChange: ChangeEventHandler = (event) => { const sanitizedValue = parseInt(event.target.value, 10); this.setState( { @@ -82,7 +82,7 @@ export class EuiRelativeTab extends Component< ); }; - onUnitChange: ChangeEventHandler = event => { + onUnitChange: ChangeEventHandler = (event) => { this.setState( { unit: event.target.value, diff --git a/src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx b/src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx index a2cff006fc4..e4784b98f44 100644 --- a/src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx +++ b/src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx @@ -45,7 +45,7 @@ const timeTenseOptions = [ { value: LAST, text: 'Last' }, { value: NEXT, text: 'Next' }, ]; -const timeUnitsOptions = keysOf(timeUnits).map(key => { +const timeUnitsOptions = keysOf(timeUnits).map((key) => { return { value: key, text: `${timeUnits[key]}s` }; }); @@ -89,20 +89,20 @@ export class EuiQuickSelect extends Component< generateId = htmlIdGenerator(); - onTimeTenseChange: ChangeEventHandler = event => { + onTimeTenseChange: ChangeEventHandler = (event) => { this.setState({ timeTense: event.target.value, }); }; - onTimeValueChange: ChangeEventHandler = event => { + onTimeValueChange: ChangeEventHandler = (event) => { const sanitizedValue = parseInt(event.target.value, 10); this.setState({ timeValue: isNaN(sanitizedValue) ? 0 : sanitizedValue, }); }; - onTimeUnitsChange: ChangeEventHandler = event => { + onTimeUnitsChange: ChangeEventHandler = (event) => { this.setState({ timeUnits: event.target.value as TimeUnitId, }); @@ -149,9 +149,7 @@ export class EuiQuickSelect extends Component< const { min, max } = this.getBounds(); const diff = max.diff(min); this.props.applyTime({ - start: moment(max) - .add(1, 'ms') - .toISOString(), + start: moment(max).add(1, 'ms').toISOString(), end: moment(max) .add(diff + 1, 'ms') .toISOString(), @@ -166,9 +164,7 @@ export class EuiQuickSelect extends Component< start: moment(min) .subtract(diff + 1, 'ms') .toISOString(), - end: moment(min) - .subtract(1, 'ms') - .toISOString(), + end: moment(min).subtract(1, 'ms').toISOString(), keepPopoverOpen: true, }); }; diff --git a/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx b/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx index 508c0c36f3d..09ba63afd5a 100644 --- a/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx +++ b/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.tsx @@ -72,7 +72,7 @@ export class EuiQuickSelectPopover extends Component< }; togglePopover = () => { - this.setState(prevState => ({ + this.setState((prevState) => ({ isOpen: !prevState.isOpen, })); }; diff --git a/src/components/date_picker/super_date_picker/quick_select_popover/refresh_interval.tsx b/src/components/date_picker/super_date_picker/quick_select_popover/refresh_interval.tsx index 1d181929e6b..49653450fcf 100644 --- a/src/components/date_picker/super_date_picker/quick_select_popover/refresh_interval.tsx +++ b/src/components/date_picker/super_date_picker/quick_select_popover/refresh_interval.tsx @@ -40,8 +40,10 @@ import { import { keysOf } from '../../../common'; const refreshUnitsOptions: RelativeOption[] = keysOf(timeUnits) - .filter(timeUnit => timeUnit === 'h' || timeUnit === 'm' || timeUnit === 's') - .map(timeUnit => ({ value: timeUnit, text: timeUnitsPlural[timeUnit] })); + .filter( + (timeUnit) => timeUnit === 'h' || timeUnit === 'm' || timeUnit === 's' + ) + .map((timeUnit) => ({ value: timeUnit, text: timeUnitsPlural[timeUnit] })); const MILLISECONDS_IN_SECOND = 1000; const MILLISECONDS_IN_MINUTE = MILLISECONDS_IN_SECOND * 60; @@ -100,7 +102,7 @@ export class EuiRefreshInterval extends Component< generateId = htmlIdGenerator(); - onValueChange: ChangeEventHandler = event => { + onValueChange: ChangeEventHandler = (event) => { const sanitizedValue = parseFloat(event.target.value); this.setState( { @@ -110,7 +112,7 @@ export class EuiRefreshInterval extends Component< ); }; - onUnitsChange: ChangeEventHandler = event => { + onUnitsChange: ChangeEventHandler = (event) => { this.setState( { units: event.target.value as TimeUnitId, diff --git a/src/components/date_picker/super_date_picker/relative_options.ts b/src/components/date_picker/super_date_picker/relative_options.ts index cd35770a350..85e0342519c 100644 --- a/src/components/date_picker/super_date_picker/relative_options.ts +++ b/src/components/date_picker/super_date_picker/relative_options.ts @@ -39,6 +39,6 @@ export const relativeOptions: RelativeOption[] = [ const timeUnitIds = relativeOptions .map(({ value }) => value) - .filter(value => !value.includes('+')) as TimeUnitId[]; + .filter((value) => !value.includes('+')) as TimeUnitId[]; export const relativeUnitsFromLargestToSmallest = timeUnitIds.reverse(); diff --git a/src/components/date_picker/super_date_picker/relative_utils.test.ts b/src/components/date_picker/super_date_picker/relative_utils.test.ts index 30021fa8dbc..d5c292065ce 100644 --- a/src/components/date_picker/super_date_picker/relative_utils.test.ts +++ b/src/components/date_picker/super_date_picker/relative_utils.test.ts @@ -66,11 +66,7 @@ describe('parseRelativeParts', () => { describe('absolute', () => { it('should parse now', () => { - const out = parseRelativeParts( - moment() - .toDate() - .toISOString() - ); + const out = parseRelativeParts(moment().toDate().toISOString()); expect(out).toEqual({ count: 0, unit: 's', @@ -80,10 +76,7 @@ describe('parseRelativeParts', () => { it('should parse 3 months ago', () => { const out = parseRelativeParts( - moment() - .subtract(3, 'M') - .toDate() - .toISOString() + moment().subtract(3, 'M').toDate().toISOString() ); expect(out).toEqual({ count: 3, @@ -94,10 +87,7 @@ describe('parseRelativeParts', () => { it('should parse 15 minutes ago', () => { const out = parseRelativeParts( - moment() - .subtract(15, 'm') - .toDate() - .toISOString() + moment().subtract(15, 'm').toDate().toISOString() ); expect(out).toEqual({ count: 15, @@ -108,10 +98,7 @@ describe('parseRelativeParts', () => { it('should parse 2 hours from now', () => { const out = parseRelativeParts( - moment() - .add(2, 'h') - .toDate() - .toISOString() + moment().add(2, 'h').toDate().toISOString() ); expect(out).toEqual({ count: 2, diff --git a/src/components/date_picker/super_date_picker/super_date_picker.tsx b/src/components/date_picker/super_date_picker/super_date_picker.tsx index a22f47a55a5..7a1f08c4cd3 100644 --- a/src/components/date_picker/super_date_picker/super_date_picker.tsx +++ b/src/components/date_picker/super_date_picker/super_date_picker.tsx @@ -297,7 +297,7 @@ export class EuiSuperDatePicker extends Component< }; onStartDatePopoverToggle = () => { - this.setState(prevState => { + this.setState((prevState) => { return { isStartDatePopoverOpen: !prevState.isStartDatePopoverOpen }; }); }; @@ -307,7 +307,7 @@ export class EuiSuperDatePicker extends Component< }; onEndDatePopoverToggle = () => { - this.setState(prevState => { + this.setState((prevState) => { return { isEndDatePopoverOpen: !prevState.isEndDatePopoverOpen }; }); }; diff --git a/src/components/date_picker/super_date_picker/super_update_button.tsx b/src/components/date_picker/super_date_picker/super_update_button.tsx index 4564b8346bf..15cdc20f430 100644 --- a/src/components/date_picker/super_date_picker/super_update_button.tsx +++ b/src/components/date_picker/super_date_picker/super_update_button.tsx @@ -76,7 +76,7 @@ export class EuiSuperUpdateButton extends Component { } } - setTootipRef: Ref = node => { + setTootipRef: Ref = (node) => { this.tooltip = node; }; diff --git a/src/components/description_list/description_list.test.tsx b/src/components/description_list/description_list.test.tsx index f664380f4d3..c3e797520e8 100644 --- a/src/components/description_list/description_list.test.tsx +++ b/src/components/description_list/description_list.test.tsx @@ -69,7 +69,7 @@ describe('EuiDescriptionList', () => { }); describe('type', () => { - TYPES.forEach(type => { + TYPES.forEach((type) => { test(`${type} is rendered`, () => { const component = render(); @@ -79,7 +79,7 @@ describe('EuiDescriptionList', () => { }); describe('align', () => { - ALIGNMENTS.forEach(alignment => { + ALIGNMENTS.forEach((alignment) => { test(`${alignment} is rendered`, () => { const component = render(); diff --git a/src/components/description_list/description_list.tsx b/src/components/description_list/description_list.tsx index 09b6784e4e8..9d3a536781c 100644 --- a/src/components/description_list/description_list.tsx +++ b/src/components/description_list/description_list.tsx @@ -84,9 +84,9 @@ const textStylesToClassNameMap = { export const TEXT_STYLES = keysOf(textStylesToClassNameMap); -export const EuiDescriptionList: FunctionComponent & - EuiDescriptionListProps> = ({ +export const EuiDescriptionList: FunctionComponent< + CommonProps & HTMLAttributes & EuiDescriptionListProps +> = ({ align = 'left', children, className, diff --git a/src/components/description_list/description_list_description.tsx b/src/components/description_list/description_list_description.tsx index a85a1b8a0b5..1638d6662ce 100644 --- a/src/components/description_list/description_list_description.tsx +++ b/src/components/description_list/description_list_description.tsx @@ -21,8 +21,9 @@ import React, { HTMLAttributes, FunctionComponent } from 'react'; import classNames from 'classnames'; import { CommonProps } from '../common'; -export const EuiDescriptionListDescription: FunctionComponent> = ({ children, className, ...rest }) => { +export const EuiDescriptionListDescription: FunctionComponent< + CommonProps & HTMLAttributes +> = ({ children, className, ...rest }) => { const classes = classNames('euiDescriptionList__description', className); return ( diff --git a/src/components/description_list/description_list_title.tsx b/src/components/description_list/description_list_title.tsx index 12b2af3238a..21aa935610b 100644 --- a/src/components/description_list/description_list_title.tsx +++ b/src/components/description_list/description_list_title.tsx @@ -21,8 +21,9 @@ import React, { HTMLAttributes, FunctionComponent } from 'react'; import classNames from 'classnames'; import { CommonProps } from '../common'; -export const EuiDescriptionListTitle: FunctionComponent> = ({ children, className, ...rest }) => { +export const EuiDescriptionListTitle: FunctionComponent< + CommonProps & HTMLAttributes +> = ({ children, className, ...rest }) => { const classes = classNames('euiDescriptionList__title', className); return ( diff --git a/src/components/drag_and_drop/drag_drop_context.test.tsx b/src/components/drag_and_drop/drag_drop_context.test.tsx index 2390f03164b..0bd8bf1e861 100644 --- a/src/components/drag_and_drop/drag_drop_context.test.tsx +++ b/src/components/drag_and_drop/drag_drop_context.test.tsx @@ -60,7 +60,7 @@ describe('EuiDragDropContext', () => { const component = mount( - {value => ( + {(value) => (
{value.hasOwnProperty('isDraggingType') ? 'true' : 'false'}
diff --git a/src/components/expression/expression.test.tsx b/src/components/expression/expression.test.tsx index 1f0317f6741..b6866f648d9 100644 --- a/src/components/expression/expression.test.tsx +++ b/src/components/expression/expression.test.tsx @@ -52,7 +52,7 @@ describe('EuiExpression', () => { describe('props', () => { describe('color', () => { - COLORS.forEach(color => { + COLORS.forEach((color) => { test(`${color} is rendered`, () => { const component = render( - ) : ( - undefined - ); + ) : undefined; return ( diff --git a/src/components/facet/facet_group.test.tsx b/src/components/facet/facet_group.test.tsx index c67fe0483b7..e10b8ee2171 100644 --- a/src/components/facet/facet_group.test.tsx +++ b/src/components/facet/facet_group.test.tsx @@ -32,7 +32,7 @@ describe('EuiFacetGroup', () => { describe('props', () => { describe('layout', () => { - LAYOUTS.forEach(layout => { + LAYOUTS.forEach((layout) => { test(`${layout} is rendered`, () => { const component = render(); @@ -42,7 +42,7 @@ describe('EuiFacetGroup', () => { }); describe('gutterSize', () => { - GUTTER_SIZES.forEach(size => { + GUTTER_SIZES.forEach((size) => { test(`${size} is rendered`, () => { const component = render(); diff --git a/src/components/filter_group/filter_select_item.tsx b/src/components/filter_group/filter_select_item.tsx index 6f6cb7fe264..6b857ebd883 100644 --- a/src/components/filter_group/filter_select_item.tsx +++ b/src/components/filter_group/filter_select_item.tsx @@ -101,7 +101,7 @@ export class EuiFilterSelectItem extends Component { return (