diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 7bd591e7bce..00000000000 --- a/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -package.json -packages/**/dist/**/*.js -packages/**/.cache/**/*.js -scripts/generators/**/templates/**/*.js \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 02654395168..00000000000 --- a/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "none", - "useTabs": false, - "printWidth": 120 -} diff --git a/babel.config.js b/babel.config.js index 429a1720c05..f5e5dfd25c9 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,4 +1,4 @@ module.exports = { extends: './packages/patternfly-4/.babelrc', presets: [['@babel/env', {'modules': 'commonjs'}], '@babel/react'], -} \ No newline at end of file +}; diff --git a/package.json b/package.json index 7c0e207ee89..5ecf0eefc04 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,6 @@ "surge": "^0.20.1", "ts-jest": "23.10.5", "tslint": "^5.12.0", - "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0" }, "scripts": { @@ -91,9 +90,8 @@ "commit": "git-cz", "generate": "yarn plop", "lint:style": "stylelint \"**/sass/**/*.scss\" \"!**/dist/**/*.scss\"", - "lint:ts": "tslint --project ./tslint.config.json --config tslint.json", + "lint:ts": "node --max-old-space-size=4096 node_modules/.bin/tslint --project ./tslint.config.json --config tslint.json", "lint:versions": "node ./packages/patternfly-4/verifyCoreVersions.js", - "prettier": "prettier --write \"storybook/**/*.js\" \"packages/**/*.js\" \"scripts/**/*.js\"", "start": "yarn start:pf3", "start:cypress": "lerna run cypress:open", "start:demo-app": "lerna run start:demo-app --stream", @@ -120,4 +118,4 @@ "packages/**" ] } -} +} \ No newline at end of file diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTile/CatalogTile.js b/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTile/CatalogTile.js index b432c60edfd..dd9c49f90f5 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTile/CatalogTile.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTile/CatalogTile.js @@ -42,7 +42,7 @@ class CatalogTile extends React.Component { } this.descFullHeight = ref.clientHeight; - }; + } handleDescriptionSpanRef = ref => { if (!ref) { @@ -50,7 +50,7 @@ class CatalogTile extends React.Component { } this.descLineHeight = parseInt(window.getComputedStyle(ref).getPropertyValue('line-height'), 10); - }; + } handleClick = e => { const { onClick, href } = this.props; @@ -61,7 +61,7 @@ class CatalogTile extends React.Component { if (onClick) { onClick(e); } - }; + } renderBadges = badges => { if (!badges || !badges.length) { @@ -75,7 +75,7 @@ class CatalogTile extends React.Component { ))} ); - }; + } render() { const { diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/CatalogTileViewCategory.js b/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/CatalogTileViewCategory.js index d47f4536712..4fdc4776a43 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/CatalogTileViewCategory.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/CatalogTileViewCategory.js @@ -55,14 +55,14 @@ class CatalogTileViewCategory extends React.Component { const rightSpacerWidth = this.categoryContainer.clientWidth % 235; this.setState({ numShown, rightSpacerWidth }); } - }; + } handleRef = ref => { if (!ref) { return; } this.categoryContainer = ref; - }; + } render() { const { children, className, title, totalItems, viewAllText, viewAll, onViewAll, ...props } = this.props; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/__mocks__/mockCatalogTileViewExample.js b/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/__mocks__/mockCatalogTileViewExample.js index bfae10ba65f..b6302002d32 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/__mocks__/mockCatalogTileViewExample.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/CatalogTileView/__mocks__/mockCatalogTileViewExample.js @@ -17,7 +17,7 @@ class MockCatalogTileViewExample extends React.Component { onViewAll = id => { this.setState({ showAll: id }); - }; + } getBadges = item => { const badges = []; @@ -39,13 +39,13 @@ class MockCatalogTileViewExample extends React.Component { } return badges; - }; + } renderEmptyState = category => ( There are no items in this category. - ); + ) renderCategory = category => { const { showAll } = this.state; @@ -80,7 +80,7 @@ class MockCatalogTileViewExample extends React.Component { } return null; - }; + } render() { const { showAll } = this.state; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/DiffView/DiffView.js b/packages/patternfly-3/patternfly-react-extensions/src/components/DiffView/DiffView.js index 469f0f6622f..22c63712200 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/DiffView/DiffView.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/DiffView/DiffView.js @@ -34,7 +34,7 @@ const DiffView = ({ const files = parseDiff(gitDiff); const hunk = files[0].hunks; - if (hunk.length === 0) return emptyState; + if (hunk.length === 0) { return emptyState; } return hunk && ; } @@ -53,7 +53,7 @@ const DiffView = ({ /> ); - if (patch === '') return emptyState; + if (patch === '') { return emptyState; } return
{files.map(renderFile)}
; }; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/FilterSidePanel/_mocks_/mockFilterSidePanelExample.js b/packages/patternfly-3/patternfly-react-extensions/src/components/FilterSidePanel/_mocks_/mockFilterSidePanelExample.js index dbac3f5e67c..e5bf5830f3a 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/FilterSidePanel/_mocks_/mockFilterSidePanelExample.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/FilterSidePanel/_mocks_/mockFilterSidePanelExample.js @@ -52,13 +52,13 @@ class MockFilterSidePanelExample extends React.Component { const showAllCategories = { ...this.state.showAllCategories }; showAllCategories[id] = !showAllCategories[id]; this.setState({ showAllCategories }); - }; + } onFilterChange = (id, value) => { const activeFilters = { ...this.state.activeFilters }; activeFilters[id] = value; this.setState({ activeFilters }); - }; + } getStars = count => { const stars = []; @@ -73,7 +73,7 @@ class MockFilterSidePanelExample extends React.Component { {stars} ); - }; + } render() { const { activeFilters, showAllCategories } = this.state; @@ -259,7 +259,7 @@ class MockFilterSidePanelExample extends React.Component { checked={activeFilters.paymentDinersClub} onChange={e => this.onFilterChange('paymentDinersClub', e.target.checked)} > - {`Diner's Club`} + {'Diner\'s Club'} this.onFilterChange('mileage10', e.target.checked)} - >{`< 20`} + >{'< 20'} { active: selectedItem.id === item.id }; - if (item.disabled) return { ...itemProps, disabled: true }; + if (item.disabled) { return { ...itemProps, disabled: true }; } return { ...itemProps, onClick: e => onItemClick({ e, id: item.id, name: item.name }) }; }; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/Select/SelectInput.js b/packages/patternfly-3/patternfly-react-extensions/src/components/Select/SelectInput.js index ad7c3b96e73..31583d79100 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/Select/SelectInput.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/Select/SelectInput.js @@ -11,7 +11,7 @@ class SelectInput extends React.Component { } componentDidMount() { - if (this.props.focus) this.searchInput.current.focus(); + if (this.props.focus) { this.searchInput.current.focus(); } } render() { diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/Select/StatefulWrapperSelect.js b/packages/patternfly-3/patternfly-react-extensions/src/components/Select/StatefulWrapperSelect.js index 19a26eb0eec..c805da85a36 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/Select/StatefulWrapperSelect.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/Select/StatefulWrapperSelect.js @@ -20,10 +20,10 @@ class StatefulWrapperSelect extends Component { const { options } = this.state; const results = []; options.forEach(opt => { - if (opt.name.includes(search)) results.push(opt); + if (opt.name.includes(search)) { results.push(opt); } }); return results; - }; + } onSearch = e => { e.persist(); @@ -43,17 +43,17 @@ class StatefulWrapperSelect extends Component { }, 700); } ); - } else this.setState({ isSearching: false, searchValue: '' }); - }; + } else { this.setState({ isSearching: false, searchValue: '' }); } + } onClear = () => this.setState({ searchValue: '', isSearching: false }); onItemClick = host => - this.setState({ selected: { id: host.id, name: host.name }, open: false, isSearching: false, searchValue: '' }); + this.setState({ selected: { id: host.id, name: host.name }, open: false, isSearching: false, searchValue: '' }) handleClickOutside = () => { - if (this.state.open === true) this.onToggle(); - }; + if (this.state.open === true) { this.onToggle(); } + } render() { const { open, isSearching, searchValue, selected, isLoading, options, matched } = this.state; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockTableGridExample.js b/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockTableGridExample.js index 4ebe2ff94d0..9def985b028 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockTableGridExample.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockTableGridExample.js @@ -56,11 +56,11 @@ class MockTableGridExample extends React.Component { }); this.setState({ items, sortField: id, isAscending: updateAscending }); - }; + } onSelect = (item, field) => { this.setState({ selectedItem: item, selectedField: field }); - }; + } toggleSelection = item => { const { selectedItems } = this.state; @@ -73,12 +73,12 @@ class MockTableGridExample extends React.Component { newSelections = [...selectedItems, item]; } this.setState({ selectedItems: newSelections }); - }; + } toggleAllSelections = () => { const { items, selectedItems } = this.state; this.setState({ selectedItems: selectedItems.length > 0 ? [] : [...items] }); - }; + } renderItemRow = (item, index) => { const { selectType } = this.props; @@ -121,7 +121,7 @@ class MockTableGridExample extends React.Component { ); - }; + } render() { const { items, selectedItems, sortField, isAscending } = this.state; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockVirtualTableGridExample.js b/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockVirtualTableGridExample.js index 260bdaca77c..00356b34547 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockVirtualTableGridExample.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/TableGrid/_mocks_/mockVirtualTableGridExample.js @@ -56,11 +56,11 @@ class MockVirtualTableGridExample extends React.Component { }); this.setState({ items, sortField: id, isAscending: updateAscending }); - }; + } onSelect = (item, field) => { this.setState({ selectedItem: item, selectedField: field }); - }; + } toggleSelection = item => { const { selectedItems } = this.state; @@ -73,12 +73,12 @@ class MockVirtualTableGridExample extends React.Component { newSelections = [...selectedItems, item]; } this.setState({ selectedItems: newSelections }); - }; + } toggleAllSelections = () => { const { items, selectedItems } = this.state; this.setState({ selectedItems: selectedItems.length > 0 ? [] : [...items] }); - }; + } ItemHeader = tableData => { const { numItems, selectType, selectedItems, sortField, isAscending } = tableData; @@ -134,7 +134,7 @@ class MockVirtualTableGridExample extends React.Component { ); - }; + } ItemRow = rowProps => { const { obj, tableData, index } = rowProps; @@ -177,7 +177,7 @@ class MockVirtualTableGridExample extends React.Component { ); - }; + } render() { const { items, selectedItem, selectedItems, selectedField, sortField, isAscending } = this.state; diff --git a/packages/patternfly-3/patternfly-react-extensions/src/components/VerticalTabs/_mocks_/mockVerticalTabsExample.js b/packages/patternfly-3/patternfly-react-extensions/src/components/VerticalTabs/_mocks_/mockVerticalTabsExample.js index 83caaaec106..48793ef91ba 100644 --- a/packages/patternfly-3/patternfly-react-extensions/src/components/VerticalTabs/_mocks_/mockVerticalTabsExample.js +++ b/packages/patternfly-3/patternfly-react-extensions/src/components/VerticalTabs/_mocks_/mockVerticalTabsExample.js @@ -9,7 +9,7 @@ class MockVerticalTabsExample extends React.Component { onActivateTab = id => { this.setState({ activeTabId: id }); - }; + } render() { const { restrictTabs, wrapStyle } = this.props; diff --git a/packages/patternfly-3/patternfly-react-wooden-tree/src/components/TreeView/TreeViewExample.js b/packages/patternfly-3/patternfly-react-wooden-tree/src/components/TreeView/TreeViewExample.js index e0c1a82d041..a14b7ef46ca 100644 --- a/packages/patternfly-3/patternfly-react-wooden-tree/src/components/TreeView/TreeViewExample.js +++ b/packages/patternfly-3/patternfly-react-wooden-tree/src/components/TreeView/TreeViewExample.js @@ -69,7 +69,7 @@ class TreeViewExample extends React.Component { } } this.setState({ tree }); - }; + } render() { return ( diff --git a/packages/patternfly-3/patternfly-react/src/common/Timer.js b/packages/patternfly-3/patternfly-react/src/common/Timer.js index b52d22cfd51..5deb14093de 100644 --- a/packages/patternfly-3/patternfly-react/src/common/Timer.js +++ b/packages/patternfly-3/patternfly-react/src/common/Timer.js @@ -11,8 +11,8 @@ class Timer { // startTimer optionally takes a new func and delay so the timer instance can be reused. startTimer(func, delay = -1) { this.clearTimer(); - if (func) this.execute = func; - if (delay >= 0) this.delay = delay; + if (func) { this.execute = func; } + if (delay >= 0) { this.delay = delay; } this.timer = setTimeout(this.execute, this.delay); } clearTimer() { diff --git a/packages/patternfly-3/patternfly-react/src/common/closestPolyfill.js b/packages/patternfly-3/patternfly-react/src/common/closestPolyfill.js index dfe4d1ea96a..b9ed199757f 100644 --- a/packages/patternfly-3/patternfly-react/src/common/closestPolyfill.js +++ b/packages/patternfly-3/patternfly-react/src/common/closestPolyfill.js @@ -9,7 +9,7 @@ export function closest(selector) { let el = this; if (document.documentElement.contains(el)) { while (el && el.nodeType === 1) { - if (el.matches(selector)) return el; + if (el.matches(selector)) { return el; } el = el.parentElement || el.parentNode; } } diff --git a/packages/patternfly-3/patternfly-react/src/common/controlled.js b/packages/patternfly-3/patternfly-react/src/common/controlled.js index 4e8cd7dea1b..cd860573c02 100644 --- a/packages/patternfly-3/patternfly-react/src/common/controlled.js +++ b/packages/patternfly-3/patternfly-react/src/common/controlled.js @@ -18,17 +18,17 @@ import { nullValues, selectKeys, filterKeys } from './helpers'; * types - an object of PropTypes for the state that will be contained here * defaults - an optional object with default values for stateTypes * persist - an optional array of names from stateTypes which will be persisted to sessionStorage - + The WrappedComponent will be rendered with special props: * setControlledState - a reference to this state wrapper's this.setState. * Props for all the stateTypes, from this.props if present or from this.state otherwise. * All other props passed to the controlled component HoC. - + The idea is that the values in stateTypes could be stored in state, or passed in via props. The WrappedComponent doesn't have to care which is being used, and can manage the state contained here. When present, props are used instead. If you provide these special props, be sure to also provide corresponding callbacks/handlers to keep them updated. - + If you are using the persist option, you can optionally pass a sessionKey prop to the component to ensure multiple instances of the component store their data separately. If you don't pass a sessionKey, a stringified list of the persisted keys will be used (not unique to the instance). @@ -49,21 +49,21 @@ const controlled = ({ types, defaults = {}, persist }) => WrappedComponent => { setControlledState = updater => { this.setState(updater); - }; + } loadPersistent = () => { if (persist && persist.length > 0) { const fromPersisted = window && window.sessionStorage && window.sessionStorage.getItem(this.sessionKey()); fromPersisted && this.setState(JSON.parse(fromPersisted)); } - }; + } savePersistent = () => { if (persist && persist.length > 0) { const toPersist = selectKeys(this.state, persist); window && window.sessionStorage && window.sessionStorage.setItem(this.sessionKey(), JSON.stringify(toPersist)); } - }; + } sessionKey = () => this.props.sessionKey || JSON.stringify(persist); diff --git a/packages/patternfly-3/patternfly-react/src/components/Alert/Alert.stories.js b/packages/patternfly-3/patternfly-react/src/components/Alert/Alert.stories.js index 99e17d0b84f..d79baf7f5cc 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Alert/Alert.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/Alert/Alert.stories.js @@ -33,7 +33,7 @@ stories.add( stories.add( 'Alert without dismiss', - withInfo(`This is the Alert without a dismiss icon.`)(() => ( + withInfo('This is the Alert without a dismiss icon.')(() => ( {text('Label', 'Well done! You successfully read this important alert message.')} diff --git a/packages/patternfly-3/patternfly-react/src/components/ApplicationLauncher/ApplicationLauncherToggle.js b/packages/patternfly-3/patternfly-react/src/components/ApplicationLauncher/ApplicationLauncherToggle.js index c1a82d103bb..96c3cde9ce8 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ApplicationLauncher/ApplicationLauncherToggle.js +++ b/packages/patternfly-3/patternfly-react/src/components/ApplicationLauncher/ApplicationLauncherToggle.js @@ -6,7 +6,7 @@ import { Icon } from '../Icon'; import { Button } from '../Button'; const ApplicationLauncherToggle = ({ open, tooltip, onClick, tooltipPlacement }) => { - if (tooltip) + if (tooltip) { return ( ); + } return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualList.js b/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualList.js index a8573833701..20837676392 100644 --- a/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualList.js +++ b/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualList.js @@ -67,7 +67,7 @@ class DualList extends React.Component { selectCount, isMainChecked }); - }; + } onMainCheckboxChange = ({ target: { @@ -94,7 +94,7 @@ class DualList extends React.Component { items, selectCount }); - }; + } onSortClick = ({ target: { @@ -110,13 +110,13 @@ class DualList extends React.Component { items: itemsReversed, isSortAsc: !isSortAsc }); - }; + } onFilterChange = event => { /** https://reactjs.org/docs/events.html#event-pooling */ event.persist(); this.onFilterChangeDebounced(event); - }; + } emitFilterChange = ({ target: { @@ -138,7 +138,7 @@ class DualList extends React.Component { const filteredItemsLength = getFilterredItemsLength(items); const isMainChecked = filteredItemsLength > 0 && getSelectedFilterredItemsLength(items) === filteredItemsLength; this.props.onFilterChange({ side, filterTerm, items, isMainChecked }); - }; + } moveTo = otherSide => { const side = otherSide === 'right' ? 'left' : 'right'; @@ -211,7 +211,7 @@ class DualList extends React.Component { items: otherSideItems } }); - }; + } leftArrowClick = () => { const { @@ -219,7 +219,7 @@ class DualList extends React.Component { } = this.props; left.onClick(); this.moveTo('left'); - }; + } rightArrowClick = () => { const { @@ -227,7 +227,7 @@ class DualList extends React.Component { } = this.props; right.onClick(); this.moveTo('right'); - }; + } render() { const { left, right, arrows, allowHiddenInputs } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualListControlled.js b/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualListControlled.js index 7057f26dd77..13749ac2fcb 100644 --- a/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualListControlled.js +++ b/packages/patternfly-3/patternfly-react/src/components/DualListSelector/DualListControlled.js @@ -41,7 +41,7 @@ class DualListControlled extends React.Component { }, () => onItemChange(this.state) ); - }; + } onMainCheckboxChange = ({ side, checked, items, selectCount }) => { const { onMainCheckboxChange } = this.props; @@ -56,7 +56,7 @@ class DualListControlled extends React.Component { }, () => onMainCheckboxChange(this.state) ); - }; + } onSortClick = ({ side, items, isSortAsc }) => { const { onSortClick } = this.props; @@ -70,7 +70,7 @@ class DualListControlled extends React.Component { }, () => onSortClick(this.state) ); - }; + } onFilterChange = ({ side, filterTerm, items, isMainChecked }) => { const { onFilterChange } = this.props; @@ -85,12 +85,12 @@ class DualListControlled extends React.Component { }, () => onFilterChange(this.state) ); - }; + } onChange = ({ left, right }) => { const { onChange } = this.props; this.setState({ left, right }, () => onChange(this.state)); - }; + } render() { const { left, right, allowHiddenInputs } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.js b/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.js index ad684f442dd..509a27a3de0 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.js +++ b/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.js @@ -29,7 +29,7 @@ class ExpandCollapse extends React.Component { } else { this.setState(prevState => ({ expanded: !prevState.expanded })); } - }; + } render() { const { children, textCollapsed, textExpanded, align, className, bordered } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.stories.js b/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.stories.js index c85b03c8a52..ed980c4e705 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/ExpandCollapse/ExpandCollapse.stories.js @@ -22,7 +22,7 @@ stories.addDecorator( stories.add( 'ExpandCollapse', - withInfo(`This is the ExpandCollapse component.`)(() => ( + withInfo('This is the ExpandCollapse component.')(() => (
{ const { currentValue, currentFilterType, filterCategory } = this.state; @@ -102,11 +102,11 @@ export class MockFilterExample extends React.Component { this.filterAdded(currentFilterType, filterValue); } } - }; + } clearFilters = () => { this.setState({ activeFilters: [] }); - }; + } filterAdded = (field, value) => { let filterText = ''; @@ -132,14 +132,14 @@ export class MockFilterExample extends React.Component { const activeFilters = [...this.state.activeFilters, { label: filterText }]; this.setState({ activeFilters }); - }; + } filterCategorySelected = category => { const { filterCategory } = this.state; if (filterCategory !== category) { this.setState({ filterCategory: category, currentValue: '' }); } - }; + } filterValueSelected = filterValue => { const { currentFilterType, currentValue } = this.state; @@ -150,24 +150,24 @@ export class MockFilterExample extends React.Component { this.filterAdded(currentFilterType, filterValue); } } - }; + } filterExists = fieldTitle => { const { activeFilters } = this.state; const index = findIndex(activeFilters, filter => filter.label.startsWith(fieldTitle)); return index !== -1; - }; + } getFilterValue = fieldTitle => { const { activeFilters } = this.state; const existingFilter = find(activeFilters, filter => filter.label.startsWith(fieldTitle)); return existingFilter.label.substring(existingFilter.label.indexOf(': ') + 2); - }; + } enforceSingleSelect = fieldTitle => { const { activeFilters } = this.state; remove(activeFilters, filter => filter.label.startsWith(fieldTitle)); - }; + } removeFilter = filter => { const { activeFilters } = this.state; @@ -177,7 +177,7 @@ export class MockFilterExample extends React.Component { const updated = [...activeFilters.slice(0, index), ...activeFilters.slice(index + 1)]; this.setState({ activeFilters: updated }); } - }; + } selectFilterType = filterType => { const { currentFilterType } = this.state; @@ -203,11 +203,11 @@ export class MockFilterExample extends React.Component { filterCategory: newFilterCategory }); } - }; + } updateCurrentValue = event => { this.setState({ currentValue: event.target.value }); - }; + } renderInput() { const { currentFilterType, currentValue, filterCategory } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js b/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js index 1a94acb5425..9e150938a4b 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js @@ -84,8 +84,8 @@ exampleStories.add( const { bsSize, disabled } = formFieldsKnobs; const buttonsProps = {}; - if (bsSize) buttonsProps.bsSize = bsSize; - if (disabled) buttonsProps.disabled = disabled; + if (bsSize) { buttonsProps.bsSize = bsSize; } + if (disabled) { buttonsProps.disabled = disabled; } const formFields = InlineFormFields.map(formField => InlineFormField({ ...formField, ...formFieldsKnobs })).reduce( (result = [], element) => [...result, element, ' '], // create spacing betwwen elements @@ -120,8 +120,8 @@ exampleStories.add( const { bsSize, disabled } = formFieldsKnobs; const buttonsProps = {}; - if (bsSize) buttonsProps.bsSize = bsSize; - if (disabled) buttonsProps.disabled = disabled; + if (bsSize) { buttonsProps.bsSize = bsSize; } + if (disabled) { buttonsProps.disabled = disabled; } const showLoading = boolean('Show Loading', false); const formFields = BasicFormFields.map(formField => HorizontalFormField({ ...formField, ...formFieldsKnobs })); @@ -168,8 +168,8 @@ exampleStories.add( const { bsSize, disabled } = formFieldsKnobs; const buttonsProps = {}; - if (bsSize) buttonsProps.bsSize = bsSize; - if (disabled) buttonsProps.disabled = disabled; + if (bsSize) { buttonsProps.bsSize = bsSize; } + if (disabled) { buttonsProps.disabled = disabled; } const showLoading = boolean('Show Loading', false); const formFields = BasicFormFields.map(formField => VerticalFormField({ ...formField, ...formFieldsKnobs })); @@ -214,8 +214,8 @@ exampleStories.add( const { bsSize, disabled } = formFieldsKnobs; const buttonsProps = {}; - if (bsSize) buttonsProps.bsSize = bsSize; - if (disabled) buttonsProps.disabled = disabled; + if (bsSize) { buttonsProps.bsSize = bsSize; } + if (disabled) { buttonsProps.disabled = disabled; } const showLoading = boolean('Show Loading', false); const formFields = BasicFormFields.map(formField => HorizontalFormField({ ...formField, ...formFieldsKnobs })); diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/BasicForm.js b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/BasicForm.js index 56e9081e40f..9b7d5dac347 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/BasicForm.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/BasicForm.js @@ -37,7 +37,7 @@ export const BasicFormFields = [ label: 'Phone', useFieldLevelHelp: true, content: - "Please specify Country code
Click here for a list of Country codes", + 'Please specify Country code
Click here for a list of Country codes', close: 'true', help: 'Enter a valid phone number', formControl: ({ validationState, ...props }) => @@ -88,7 +88,7 @@ export const getBasicFormKnobs = () => ({ disabled: boolean('Disabled', false), content: text( 'Field Level Help Content', - "Please specify Country code
Click here for a list of Country codes" + 'Please specify Country code
Click here for a list of Country codes' ), close: select('Close Popover', ['true', 'false'], 'true') }); diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/FormExample.js b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/FormExample.js index 329ee186c04..2b8d7a13312 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/FormExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/FormExample.js @@ -15,9 +15,9 @@ export class FormExample extends React.Component { getValidationState() { const { length } = this.state.value; - if (length > 10) return 'success'; - else if (length > 5) return 'warning'; - else if (length > 0) return 'error'; + if (length > 10) { return 'success'; } + else if (length > 5) { return 'warning'; } + else if (length > 0) { return 'error'; } return null; } diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/HorizontalFormField.js b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/HorizontalFormField.js index 55fcbae136f..299c7403e72 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/HorizontalFormField.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/HorizontalFormField.js @@ -20,8 +20,8 @@ export const HorizontalFormField = ({ }) => { const controlProps = { ...props }; - if (bsSize) controlProps.bsSize = bsSize; - if (validationState) controlProps.validationState = validationState; + if (bsSize) { controlProps.bsSize = bsSize; } + if (validationState) { controlProps.validationState = validationState; } const formGroupProps = { key: controlId, controlId, ...controlProps }; diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/InlineFormField.js b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/InlineFormField.js index 45ccf5a7b46..968b5512916 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/InlineFormField.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/InlineFormField.js @@ -6,8 +6,8 @@ import { Form } from '../index'; export const InlineFormField = ({ controlId, label, formControl, validationState, bsSize, showLabel, ...props }) => { const controlProps = { ...props }; - if (bsSize) controlProps.bsSize = bsSize; - if (validationState) controlProps.validationState = validationState; + if (bsSize) { controlProps.bsSize = bsSize; } + if (validationState) { controlProps.validationState = validationState; } const formGroupProps = { key: controlId, controlId, ...controlProps }; diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/VerticalFormField.js b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/VerticalFormField.js index 42896f347ad..63625b02af7 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/VerticalFormField.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/VerticalFormField.js @@ -19,8 +19,8 @@ export const VerticalFormField = ({ }) => { const controlProps = { ...props }; - if (bsSize) controlProps.bsSize = bsSize; - if (validationState) controlProps.validationState = validationState; + if (bsSize) { controlProps.bsSize = bsSize; } + if (validationState) { controlProps.validationState = validationState; } const formGroupProps = { key: controlId, controlId, ...controlProps }; diff --git a/packages/patternfly-3/patternfly-react/src/components/Icon/Icon.stories.js b/packages/patternfly-3/patternfly-react/src/components/Icon/Icon.stories.js index e7355ad6211..b5b3148a649 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Icon/Icon.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/Icon/Icon.stories.js @@ -95,7 +95,7 @@ IconStories.add( spinner - {`${`spin | size="lg"`}`} + {`${'spin | size="lg"'}`} fa @@ -103,7 +103,7 @@ IconStories.add( check-square - {`${`size="2x"`}`} + {`${'size="2x"'}`} fa @@ -111,7 +111,7 @@ IconStories.add( edit - {`${`size="3x"`}`} + {`${'size="3x"'}`} fa @@ -119,7 +119,7 @@ IconStories.add( star - {`${`size="lg" | pulse`}`} + {`${'size="lg" | pulse'}`} fa diff --git a/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.js b/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.js index d1d0084348c..391c4a66b74 100644 --- a/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.js +++ b/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.js @@ -13,7 +13,7 @@ class InfoTip extends React.Component { handleEnterKeyDown = event => { this.setState({ open: !this.state.open }); event.preventDefault(); - }; + } handleTabKeyDown = event => { if (this.state.footerFocused) { @@ -23,7 +23,7 @@ class InfoTip extends React.Component { } event.stopPropagation(); event.nativeEvent.stopImmediatePropagation(); - }; + } handleKeyDown = event => { if (event.shiftKey && event.keyCode) { @@ -39,24 +39,24 @@ class InfoTip extends React.Component { default: return null; } - }; + } handleBackFocus = () => { if (this.state.open) { this.setState({ open: false }); } - }; + } handleClick = event => { event.preventDefault(); this.setState({ open: !this.state.open }); - }; + } handleBlur = event => { if (event && event.relatedTarget) { event.relatedTarget.click(); } this.setState({ open: false }); - }; + } render() { const { children, onToggle, ...props } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.test.js b/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.test.js index 81c8dcedbe6..773637e9049 100644 --- a/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.test.js +++ b/packages/patternfly-3/patternfly-react/src/components/InfoTip/InfoTip.test.js @@ -93,7 +93,7 @@ test('onBlur closes Dropdown', () => { expect(getDropdown(view).props().open).toBe(false); }); -test(`onBlur clicks related target`, () => { +test('onBlur clicks related target', () => { const relatedTargetClick = jest.fn(); const view = shallow(); getDropdown(view).simulate('blur', { diff --git a/packages/patternfly-3/patternfly-react/src/components/Label/CompoundLabel.js b/packages/patternfly-3/patternfly-react/src/components/Label/CompoundLabel.js index fa68266e107..617752e88d5 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Label/CompoundLabel.js +++ b/packages/patternfly-3/patternfly-react/src/components/Label/CompoundLabel.js @@ -16,11 +16,11 @@ class CompoundLabel extends React.Component { className={this.props.innerClassName} overlayPlacement={this.props.overlayPlacement} /> - ); + ) render() { const values = [...this.props.values]; - if (values.length === 0) return null; + if (values.length === 0) { return null; } const categoryTooltip = {this.props.category.label}; return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockCompoundLabel.js b/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockCompoundLabel.js index bff957cb70c..d729c4dae41 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockCompoundLabel.js +++ b/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockCompoundLabel.js @@ -22,7 +22,7 @@ export class MockCompoundLabel extends React.Component { const values = this.state.tag.values.filter(val => val.id !== value.id); const state = { tag: { ...this.state.tag, values } }; this.setState(state); - }; + } render() { return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockLabelExamples.js b/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockLabelExamples.js index 6252deb9397..d924fd3b9f2 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockLabelExamples.js +++ b/packages/patternfly-3/patternfly-react/src/components/Label/__mocks__/mockLabelExamples.js @@ -16,7 +16,7 @@ export class MockLabelRemove extends React.Component { } removeMe = index => { this.setState(this.state.types.splice(index, 1)); - }; + } render() { return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/ListView/ListView.stories.js b/packages/patternfly-3/patternfly-react/src/components/ListView/ListView.stories.js index 49235593ee3..24eb82f5471 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ListView/ListView.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/ListView/ListView.stories.js @@ -49,7 +49,7 @@ const renderAdditionalInfoItems = itemProperties => stories.add( 'List of expandable items', - withInfo(`ListView usage example.`)(() => ( + withInfo('ListView usage example.')(() => ( {mockListItems.map(({ actions, properties, title, description, expandedContentText, hideCloseIcon }, index) => ( ( + withInfo('ListView usage example.')(() => ( ({ expanded: !prevState.expanded })); - }; + } render() { const { diff --git a/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockCompoundExpansionExample.js b/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockCompoundExpansionExample.js index 1feab51eaa0..2c5102846a6 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockCompoundExpansionExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockCompoundExpansionExample.js @@ -30,7 +30,7 @@ export class MockCompoundExpansion extends React.Component { item.expandType = expandProp; } this.setState({ listItems: mockListItems }); - }; + } renderAdditionalInfoExpandItems(item) { return ( @@ -80,7 +80,7 @@ export class MockCompoundExpansion extends React.Component { ); - }; + } render() { const { listItems } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockListItems.js b/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockListItems.js index 030eb7375a1..746d2bb0b39 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockListItems.js +++ b/packages/patternfly-3/patternfly-react/src/components/ListView/__mocks__/mockListItems.js @@ -11,10 +11,10 @@ export const mockListItems = [ properties: { hosts: 3, clusters: 1, nodes: 7, images: 4 }, expandedContentText: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry', compoundExpandText: { - hosts: "Text describing Item 1's hosts", - clusters: "Text describing Item 1's clusters", - nodes: "Text describing Item 1's nodes", - images: "Text describing Item 1's images" + hosts: 'Text describing Item 1\'s hosts', + clusters: 'Text describing Item 1\'s clusters', + nodes: 'Text describing Item 1\'s nodes', + images: 'Text describing Item 1\'s images' } }, { @@ -23,10 +23,10 @@ export const mockListItems = [ properties: { hosts: 2, clusters: 1, nodes: 11, images: 8 }, expandedContentText: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry', compoundExpandText: { - hosts: "Text describing Item 2's hosts", - clusters: "Text describing Item 2's clusters", - nodes: "Text describing Item 2's nodes", - images: "Text describing Item 2's images" + hosts: 'Text describing Item 2\'s hosts', + clusters: 'Text describing Item 2\'s clusters', + nodes: 'Text describing Item 2\'s nodes', + images: 'Text describing Item 2\'s images' } }, { @@ -35,30 +35,30 @@ export const mockListItems = [ properties: { hosts: 4, clusters: 2, nodes: 9, images: 8 }, expandedContentText: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry', compoundExpandText: { - hosts: "Text describing Item 3's hosts", - clusters: "Text describing Item 3's clusters", - nodes: "Text describing Item 3's nodes", - images: "Text describing Item 3's images" + hosts: 'Text describing Item 3\'s hosts', + clusters: 'Text describing Item 3\'s clusters', + nodes: 'Text describing Item 3\'s nodes', + images: 'Text describing Item 3\'s images' } }, { description: 'This is Item without heading', expandedContentText: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry', compoundExpandText: { - hosts: "Text describing Item 4's hosts", - clusters: "Text describing Item 4's clusters", - nodes: "Text describing Item 4's nodes", - images: "Text describing Item 4's images" + hosts: 'Text describing Item 4\'s hosts', + clusters: 'Text describing Item 4\'s clusters', + nodes: 'Text describing Item 4\'s nodes', + images: 'Text describing Item 4\'s images' } }, { properties: { hosts: 4, clusters: 2, nodes: 9, images: 8 }, expandedContentText: 'Lorem Ipsum is simply dummy text of the printing and typesetting industry', compoundExpandText: { - hosts: "Text describing Item 5's hosts", - clusters: "Text describing Item 5's clusters", - nodes: "Text describing Item 5's nodes", - images: "Text describing Item 5's images" + hosts: 'Text describing Item 5\'s hosts', + clusters: 'Text describing Item 5\'s clusters', + nodes: 'Text describing Item 5\'s nodes', + images: 'Text describing Item 5\'s images' } }, { @@ -66,10 +66,10 @@ export const mockListItems = [ expandedContentText: 'There is no close `x` on the right of this box.', hideCloseIcon: true, compoundExpandText: { - hosts: "Text describing Item 6's hosts", - clusters: "Text describing Item 6's clusters", - nodes: "Text describing Item 6's nodes", - images: "Text describing Item 6's images" + hosts: 'Text describing Item 6\'s hosts', + clusters: 'Text describing Item 6\'s clusters', + nodes: 'Text describing Item 6\'s nodes', + images: 'Text describing Item 6\'s images' } } ]; diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/SocialLoginPage.test.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/SocialLoginPage.test.js index aab48846153..5995b34d85c 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/SocialLoginPage.test.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/SocialLoginPage.test.js @@ -181,7 +181,7 @@ test('Click on the "More" button will expend the list and the button will change expect(component.find('.ReactCollapse--collapse > ul > li')).toBeTruthy(); }); -test("While the social list has 4 or less links, it won't have the 'double-col' class and the expend button won't exist", () => { +test('While the social list has 4 or less links, it won\'t have the \'double-col\' class and the expend button won\'t exist', () => { const props = { ...createProps() }; props.card.social.links = [...logoList].splice(0, 4); const component = mount(); diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardInputWarning.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardInputWarning.js index bfdb2f9984e..ca1f4be0487 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardInputWarning.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardInputWarning.js @@ -7,7 +7,7 @@ const LoginCardInputWarning = ({ children, className, ...props }) => children && (
- {` `} + {' '} {children}
); diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardSocialColumns.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardSocialColumns.js index bbe1af21522..d46b7a54217 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardSocialColumns.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardSocialColumns.js @@ -22,7 +22,7 @@ class LoginCardSocialColumns extends React.Component { this.setState({ width: window.innerWidth }); - }; + } getListItems = () => { this.hiddenLinks = []; @@ -38,7 +38,7 @@ class LoginCardSocialColumns extends React.Component { return ; }) ); - }; + } getHiddenListItems = () => { const { numberOfButtonsToShow } = this.props; @@ -48,11 +48,11 @@ class LoginCardSocialColumns extends React.Component { )) ); - }; + } toggleExpend = () => { this.setState({ expend: !this.state.expend }); - }; + } render() { const { links, numberOfButtonsToShow } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardWithValidation.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardWithValidation.js index 9d4a4a4222c..4f3b8ae6a31 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardWithValidation.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginCardWithValidation.js @@ -41,7 +41,7 @@ class LoginCardWithValidation extends React.Component { static getDerivedStateFromProps(props, state) { // disableSubmit prop will only be used in a not validated login card const { validate, disableSubmit } = props; - if (validate) return null; + if (validate) { return null; } if (disableSubmit !== state.form.disableSubmit) { return { form: { disableSubmit } @@ -57,7 +57,7 @@ class LoginCardWithValidation extends React.Component { const otherInputType = inputType === 'usernameField' ? 'passwordField' : 'usernameField'; const otherInputValue = this.state[otherInputType].value; return otherInputValue.length < 1; - }; + } onInputChange = (e, inputType) => { const { @@ -75,7 +75,7 @@ class LoginCardWithValidation extends React.Component { disableSubmit: this.shouldDisableSubmit(inputType, value) } })); - }; + } onInputFocus = (e, inputType) => { this.props[inputType].onFocus && this.props[inputType].onFocus(e); @@ -86,7 +86,7 @@ class LoginCardWithValidation extends React.Component { showError: false } }); - }; + } onInputBlur = (e, inputType) => { this.props[inputType].onBlur && this.props[inputType].onBlur(e); @@ -98,12 +98,12 @@ class LoginCardWithValidation extends React.Component { }, isCapsLock: false }); - }; + } onKeyPress = (e, inputType) => { this.props[inputType].onMouseEnter && this.props[inputType].onMouseEnter(e); this.handleCapsLock(e); - }; + } onSubmit = e => { e.preventDefault(); @@ -113,7 +113,7 @@ class LoginCardWithValidation extends React.Component { } else { this.handleOnInputErrors(); } - }; + } onSubmitStart = () => { this.setState(({ form }) => ({ @@ -125,7 +125,7 @@ class LoginCardWithValidation extends React.Component { showError: false } })); - }; + } onSubmitError = submitError => { this.setState(({ form }) => ({ @@ -138,7 +138,7 @@ class LoginCardWithValidation extends React.Component { isSubmitting: false } })); - }; + } getFormError = () => { const { @@ -151,7 +151,7 @@ class LoginCardWithValidation extends React.Component {
)) : submitError; - }; + } getModifiedProps = () => { const { usernameField, passwordField, isCapsLock, form } = this.state; @@ -186,7 +186,7 @@ class LoginCardWithValidation extends React.Component { isSubmitting: form.isSubmitting, submitError: this.getFormError() }; - }; + } handleOnInputErrors = () => { const { usernameField, passwordField } = this.state; @@ -207,13 +207,13 @@ class LoginCardWithValidation extends React.Component { } !topErrorOnly && this.hideSubmitError(); - }; + } isFormValid = () => !!this.state.usernameField.value && !!this.state.passwordField.value && !this.isPasswordShort() && - this.isUserNameValid(); + this.isUserNameValid() isPasswordShort = () => { const { @@ -225,7 +225,7 @@ class LoginCardWithValidation extends React.Component { } } = this.state; return passwordMinLength > 0 && currentPasswordLength < passwordMinLength; - }; + } hideSubmitError = () => { this.setState({ @@ -234,7 +234,7 @@ class LoginCardWithValidation extends React.Component { showError: false } }); - }; + } clearFormErrors = () => { this.setState(({ form }) => ({ @@ -243,7 +243,7 @@ class LoginCardWithValidation extends React.Component { errors: [] } })); - }; + } handleOnPasswordTooShort = () => { const { @@ -268,7 +268,7 @@ class LoginCardWithValidation extends React.Component { } } ); - }; + } handleOnInvalidUsername = () => { const { @@ -293,7 +293,7 @@ class LoginCardWithValidation extends React.Component { } } ); - }; + } handleOnEmptyInput = inputType => { const { @@ -318,7 +318,7 @@ class LoginCardWithValidation extends React.Component { } } ); - }; + } toggleCapsLock = e => { if (!this.state.passwordField.value) { @@ -328,7 +328,7 @@ class LoginCardWithValidation extends React.Component { this.setState({ isCapsLock: !this.state.isCapsLock }); - }; + } handleCapsLock = e => { const keyCode = e.keyCode ? e.keyCode : e.which; @@ -339,7 +339,7 @@ class LoginCardWithValidation extends React.Component { this.setState({ isCapsLock }); - }; + } isUserNameValid = () => { const { @@ -352,7 +352,7 @@ class LoginCardWithValidation extends React.Component { return atPos > 1 && dotPos - atPos > 2 && atPos < dotPos; } return true; - }; + } render() { const { validate, children } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginLanguagePicker.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginLanguagePicker.js index 1b9677470de..fe8efb5c55b 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginLanguagePicker.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginCardComponents/LoginLanguagePicker.js @@ -24,7 +24,7 @@ class LoginLanguagePicker extends React.Component { const { onLanguageChange } = this.props; onLanguageChange(e); this.setState({ title: e.target.text }); - }; + } render() { const { availableLanguages, className, id } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageAlert.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageAlert.js index 2e4ac1f7b00..b386ba82cdb 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageAlert.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageAlert.js @@ -12,7 +12,7 @@ class LoginPageAlert extends React.Component { return; } this.setState({ show: false }); - }; + } render() { const { type, message } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageWithTranslation.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageWithTranslation.js index dbd9e44c735..04ced43e1f0 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageWithTranslation.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/components/LoginPageComponents/LoginPageWithTranslation.js @@ -24,19 +24,19 @@ class LoginPageWithTranslation extends React.Component { return; } this.switchToLanguage(newLanguage); - }; + } onPasswordChange = e => { const { card } = this.props; card.form.passwordField.onChange && card.form.passwordField.onChange(e); this.setState({ passwordValue: e.target.value }); - }; + } onUsernameChange = e => { const { card } = this.props; card.form.usernameField.onChange && card.form.usernameField.onChange(e); this.setState({ usernameValue: e.target.value }); - }; + } getDefaultPropsToPass = () => { const { card } = this.props; @@ -59,7 +59,7 @@ class LoginPageWithTranslation extends React.Component { } } }; - }; + } switchToLanguage = language => { const { container, card, header } = this.props; @@ -124,7 +124,7 @@ class LoginPageWithTranslation extends React.Component { }; this.setState({ translatedProps, language }); - }; + } render() { const newProps = { diff --git a/packages/patternfly-3/patternfly-react/src/components/LoginPage/mocks/messages.fr.js b/packages/patternfly-3/patternfly-react/src/components/LoginPage/mocks/messages.fr.js index 9e0073df83b..acd5cfed128 100644 --- a/packages/patternfly-3/patternfly-react/src/components/LoginPage/mocks/messages.fr.js +++ b/packages/patternfly-3/patternfly-react/src/components/LoginPage/mocks/messages.fr.js @@ -1,11 +1,11 @@ const pageHeader = { - alert: `Patternfly sera mis à jour à 2.13.5 à 00:00, 23 Sep 2018 (UTC). Cette mise à jour durera de 8 à 12 heures, veuillez planifier à l'avance pour cette panne.`, + alert: 'Patternfly sera mis à jour à 2.13.5 à 00:00, 23 Sep 2018 (UTC). Cette mise à jour durera de 8 à 12 heures, veuillez planifier à l\'avance pour cette panne.', logo: 'Patternfly', - caption: `Utilisez cette zone pour placer des informations ou un message d'introduction sur votre application qui peut être pertinent pour utilisateurs.` + caption: 'Utilisez cette zone pour placer des informations ou un message d\'introduction sur votre application qui peut être pertinent pour utilisateurs.' }; const footerLinks = [ - { children: "Conditions d'utilisation", href: '#' }, + { children: 'Conditions d\'utilisation', href: '#' }, { children: 'Aidez-moi', href: '#' }, { children: 'Politique de confidentialité', href: '#' } ]; @@ -17,9 +17,9 @@ const cardHeader = { }; const signUp = { - label: "Besoin d'un compte?", + label: 'Besoin d\'un compte?', link: { - label: "S'inscrire" + label: 'S\'inscrire' } }; @@ -29,7 +29,7 @@ const forgotPassword = 'mot de passe oublié?'; const form = { error: 'Votre compte a été bloqué Contactez votre administrateur pour le débloquer.', - submitText: "S'identifier" + submitText: 'S\'identifier' }; const passwordField = { @@ -46,7 +46,7 @@ const passwordField = { const usernameField = { placeholder: 'Adresse e-mail', errors: { - empty: "S'il vous plaît entrer votre email.", + empty: 'S\'il vous plaît entrer votre email.', invalid: 'Votre email est invalide' } }; diff --git a/packages/patternfly-3/patternfly-react/src/components/Masthead/__mocks__/mockHorizontalMasthead.js b/packages/patternfly-3/patternfly-react/src/components/Masthead/__mocks__/mockHorizontalMasthead.js index 9306f086c96..a216caecf8e 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Masthead/__mocks__/mockHorizontalMasthead.js +++ b/packages/patternfly-3/patternfly-react/src/components/Masthead/__mocks__/mockHorizontalMasthead.js @@ -18,7 +18,7 @@ export class MockHorizontalMasthead extends React.Component { this.setState({ menuCollapsed: !this.state.menuCollapsed }); - }; + } render() { const { menuCollapsed } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogDeleteConfirmation.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogDeleteConfirmation.js index e36a8e17500..a497dd97a84 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogDeleteConfirmation.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogDeleteConfirmation.js @@ -11,15 +11,15 @@ class MessageDialogDeleteConfirmation extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text

; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogError.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogError.js index 36efdca9a8b..4a700308700 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogError.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogError.js @@ -11,15 +11,15 @@ class MessageDialogError extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text

; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogInfo.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogInfo.js index 67bdce38ef5..d6a0b3c64fa 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogInfo.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogInfo.js @@ -11,15 +11,15 @@ class MessageDialogInfo extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text

; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogNondestructiveAction.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogNondestructiveAction.js index 6e73e63028b..d5163838a13 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogNondestructiveAction.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogNondestructiveAction.js @@ -11,15 +11,15 @@ class MessageDialogNondestructiveAction extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text

; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogQuestion.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogQuestion.js index 25b11073123..74756134cac 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogQuestion.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogQuestion.js @@ -11,15 +11,15 @@ class MessageDialogQuestion extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text. Are you sure you want to xxxxx?

; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js index 8700ea9416e..96ecf0d473b 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogSuccess.js @@ -11,15 +11,15 @@ class MessageDialogSuccess extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text

; diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogToggleableOptions.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogToggleableOptions.js index da308db9c36..4a08c7027bd 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogToggleableOptions.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogToggleableOptions.js @@ -13,15 +13,15 @@ class MessageDialogToggleableOptions extends Component { primaryAction = () => { // Do some stuff this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { // StoryBook Knobs Config diff --git a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogWarning.js b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogWarning.js index b7fed11b37c..654d9b6061a 100644 --- a/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogWarning.js +++ b/packages/patternfly-3/patternfly-react/src/components/MessageDialog/Stories/MessageDialogWarning.js @@ -11,15 +11,15 @@ class MessageDialogWarning extends Component { primaryAction = () => { this.setState(() => ({ show: false })); - }; + } secondaryAction = () => { this.setState(() => ({ show: false })); - }; + } showModal = () => { this.setState(() => ({ show: true })); - }; + } render() { const primaryContent =

Main Dialog Text

; diff --git a/packages/patternfly-3/patternfly-react/src/components/Modal/ModalCloseButton.js b/packages/patternfly-3/patternfly-react/src/components/Modal/ModalCloseButton.js index 1abf5d7676e..948a94c51c2 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Modal/ModalCloseButton.js +++ b/packages/patternfly-3/patternfly-react/src/components/Modal/ModalCloseButton.js @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; import { Icon } from '../Icon'; const ModalCloseButton = ({ className, closeText, ...props }) => ( - diff --git a/packages/patternfly-3/patternfly-react/src/components/Modal/Patterns/StatefulModalPattern.js b/packages/patternfly-3/patternfly-react/src/components/Modal/Patterns/StatefulModalPattern.js index 92ebf495615..7d83d9d2383 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Modal/Patterns/StatefulModalPattern.js +++ b/packages/patternfly-3/patternfly-react/src/components/Modal/Patterns/StatefulModalPattern.js @@ -19,11 +19,11 @@ class StatefulModalPattern extends React.Component { open = () => { this.setState({ show: true }); - }; + } close = () => { this.setState({ show: false }); - }; + } getModalPatternProps = () => this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/Modal/Stories/ModalPatternExample.js b/packages/patternfly-3/patternfly-react/src/components/Modal/Stories/ModalPatternExample.js index c0bfa7f7638..1567c3556ba 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Modal/Stories/ModalPatternExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Modal/Stories/ModalPatternExample.js @@ -14,11 +14,11 @@ export class ModalPatternExample extends React.Component { setTimeout(() => { this.setState({ loading: false }); }, 1000); - }; + } close = () => { this.setState({ showModal: false, loading: false }); - }; + } renderStateless = () => { // We need knobs on the stateless example, because we must drive its state ourselves. @@ -44,7 +44,7 @@ export class ModalPatternExample extends React.Component { ); - }; + } renderStateful = () => ( // No knobs for the stateful example, we want to let it control its own state. @@ -66,7 +66,7 @@ export class ModalPatternExample extends React.Component { (Modal Contents Here) - ); + ) render() { return this.props.stateful ? this.renderStateful() : this.renderStateless(); diff --git a/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/ModelessOverlay.js b/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/ModelessOverlay.js index 109bb8f7cee..000af7500ad 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/ModelessOverlay.js +++ b/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/ModelessOverlay.js @@ -17,7 +17,7 @@ class ModelessOverlay extends React.Component { updateForTransitions = () => { this.setState({ isIn: this.props.show }); - }; + } render() { const { children, className, bsSize, show, ...otherProps } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/__mocks__/mockModelessManager.js b/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/__mocks__/mockModelessManager.js index 21e274f05e3..75229920900 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/__mocks__/mockModelessManager.js +++ b/packages/patternfly-3/patternfly-react/src/components/ModelessOverlay/__mocks__/mockModelessManager.js @@ -11,10 +11,10 @@ export class MockModelessManager extends React.Component { } close = () => { this.setState({ showOverlay: false }); - }; + } toggleOpen = () => { this.setState({ showOverlay: !this.state.showOverlay }); - }; + } render() { const { children, size } = this.props; const defaultBody = ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/NotificationDrawerPanelWrapper.js b/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/NotificationDrawerPanelWrapper.js index 44b40466c61..0849a0b6dc4 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/NotificationDrawerPanelWrapper.js +++ b/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/NotificationDrawerPanelWrapper.js @@ -28,7 +28,7 @@ const NotificationDrawerPanelWrapper = ({ const unreadCount = notifications.filter(notification => !notification.seen).length; const getUnread = () => { - if (unreadCount !== 1) return `${unreadCount} ${translations.unreadEvents}`; + if (unreadCount !== 1) { return `${unreadCount} ${translations.unreadEvents}`; } return `1 ${translations.unreadEvent}`; }; diff --git a/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulNotificationDrawerWrapper.js b/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulNotificationDrawerWrapper.js index 1e128bbf164..bc003ff756e 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulNotificationDrawerWrapper.js +++ b/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulNotificationDrawerWrapper.js @@ -15,7 +15,7 @@ class StatefulNotificationDrawerWrapper extends React.Component { onClickLink = url => { window.open(url.href); - }; + } onMarkPanelAsRead = panelkey => { const panels = this.state.panels.map(panel => { @@ -29,22 +29,22 @@ class StatefulNotificationDrawerWrapper extends React.Component { }); this.setState({ panels }); this.updateUnreadCount(); - }; + } onMarkPanelAsClear = key => { const panels = this.state.panels.map(panel => { - if (panel.panelkey === key) panel.notifications = []; + if (panel.panelkey === key) { panel.notifications = []; } return panel; }); this.setState({ panels }); this.updateUnreadCount(); - }; + } onNotificationAsRead = (panelkey, nkey) => { const panels = this.state.panels.map(panel => { if (panel.panelkey === panelkey) { panel.notifications.map(notification => { - if (notification.id === nkey) notification.seen = true; + if (notification.id === nkey) { notification.seen = true; } return notification; }); } @@ -52,11 +52,11 @@ class StatefulNotificationDrawerWrapper extends React.Component { }); this.setState({ panels }); this.updateUnreadCount(); - }; + } onNotificationClick = () => { // On Click - }; + } onNotificationHide = (panelkey, nkey) => { const panels = this.state.panels.map(panel => { @@ -71,18 +71,17 @@ class StatefulNotificationDrawerWrapper extends React.Component { }); this.setState({ panels }); this.updateUnreadCount(); - }; + } togglePanel = key => { - if (this.state.expandedPanel === key) this.setState({ expandedPanel: '-1' }); - else this.setState({ expandedPanel: key }); - }; + if (this.state.expandedPanel === key) { this.setState({ expandedPanel: '-1' }); } else { this.setState({ expandedPanel: key }); } + } toggleDrawerExpand = () => { this.setState(prevState => ({ isExpanded: !prevState.isExpanded })); - }; + } updateUnreadCount = () => { let hasunread = false; @@ -94,7 +93,7 @@ class StatefulNotificationDrawerWrapper extends React.Component { } } this.props.updateUnreadCount(hasunread); - }; + } render() { return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulToggleNotificationDrawerWrapper.js b/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulToggleNotificationDrawerWrapper.js index 63bb9dfd768..91f86578e71 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulToggleNotificationDrawerWrapper.js +++ b/packages/patternfly-3/patternfly-react/src/components/Notification/Wrappers/StatefulToggleNotificationDrawerWrapper.js @@ -18,12 +18,11 @@ class StatefulToggleNotificationDrawerWrapper extends React.Component { this.setState(prevState => ({ isDrawerOpen: !prevState.isDrawerOpen })); - }; + } updateUnreadCount = bool => { - if (bool) this.setState({ hasUnreadMessages: true }); - else this.setState({ hasUnreadMessages: false }); - }; + if (bool) { this.setState({ hasUnreadMessages: true }); } else { this.setState({ hasUnreadMessages: false }); } + } render() { return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Overlay/__mocks__/mockOverlayManager.js b/packages/patternfly-3/patternfly-react/src/components/Overlay/__mocks__/mockOverlayManager.js index 8955808ed65..53fa36c35db 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Overlay/__mocks__/mockOverlayManager.js +++ b/packages/patternfly-3/patternfly-react/src/components/Overlay/__mocks__/mockOverlayManager.js @@ -15,7 +15,7 @@ export class MockOverlayManager extends React.Component { toggleOverlay = () => { const { showOverlay } = this.state; this.setState({ showOverlay: !showOverlay }); - }; + } render() { const { placement } = this.props; const { showOverlay } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Pagination/Paginator.js b/packages/patternfly-3/patternfly-react/src/components/Pagination/Paginator.js index c21b1819e95..efecaefbcec 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Pagination/Paginator.js +++ b/packages/patternfly-3/patternfly-react/src/components/Pagination/Paginator.js @@ -41,7 +41,7 @@ class Paginator extends React.Component { handleFormSubmit = e => { this.setPage(this.state.pageChangeValue); - }; + } handlePageChange(e) { this.setState({ pageChangeValue: e.target.value }); diff --git a/packages/patternfly-3/patternfly-react/src/components/Pagination/__mocks__/mockPaginationRow.js b/packages/patternfly-3/patternfly-react/src/components/Pagination/__mocks__/mockPaginationRow.js index 43f9926653b..0b85e622cbc 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Pagination/__mocks__/mockPaginationRow.js +++ b/packages/patternfly-3/patternfly-react/src/components/Pagination/__mocks__/mockPaginationRow.js @@ -16,12 +16,12 @@ export class MockPaginationRow extends React.Component { const newPaginationState = Object.assign({}, this.state.pagination); newPaginationState.page = e.target.value; this.setState({ pagination: newPaginationState }); - }; + } onPerPageSelect = (eventKey, e) => { const newPaginationState = Object.assign({}, this.state.pagination); newPaginationState.perPage = eventKey; this.setState({ pagination: newPaginationState }); - }; + } render() { const { viewType, diff --git a/packages/patternfly-3/patternfly-react/src/components/SessionTimeout/SessionTimeout.stories.js b/packages/patternfly-3/patternfly-react/src/components/SessionTimeout/SessionTimeout.stories.js index 19796c4ca99..73e8a715302 100644 --- a/packages/patternfly-3/patternfly-react/src/components/SessionTimeout/SessionTimeout.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/SessionTimeout/SessionTimeout.stories.js @@ -23,7 +23,7 @@ stories displayBefore={number('displayBefore', 30)} timeLeft={number('timeLeft', 30)} primaryContent={

{text('primary content', 'Your session is about to expire')}

} - secondaryContent={
{text('secondary content', `to continue click on "Continue Session".`)}
} + secondaryContent={
{text('secondary content', 'to continue click on "Continue Session".')}
} /> )) .add('Count Down Session Timeout', () => ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Slider/Slider.js b/packages/patternfly-3/patternfly-react/src/components/Slider/Slider.js index 38efa2cbe43..0472b8b404a 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Slider/Slider.js +++ b/packages/patternfly-3/patternfly-react/src/components/Slider/Slider.js @@ -25,16 +25,16 @@ class Slider extends React.Component { onSlide = value => { this.setState({ value }, () => this.props.onSlide(value)); - }; + } onInputChange = event => { const newValue = parseInt(event.target.value || 0, 10); this.setState({ value: newValue }, () => this.props.onSlide(newValue)); - }; + } onFormatChange = format => { this.setState({ tooltipFormat: format }); - }; + } formatter = value => `${value} ${this.state.tooltipFormat}`; diff --git a/packages/patternfly-3/patternfly-react/src/components/Sort/__mocks__/mockSortExample.js b/packages/patternfly-3/patternfly-react/src/components/Sort/__mocks__/mockSortExample.js index 1aec26648d1..9e332bb5403 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Sort/__mocks__/mockSortExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Sort/__mocks__/mockSortExample.js @@ -51,13 +51,13 @@ export class MockSortExample extends React.Component { const activeFilters = [...this.state.activeFilters, { label: filterText }]; this.setState({ activeFilters }); - }; + } toggleCurrentSortDirection = () => { this.setState(prevState => ({ isSortAscending: !prevState.isSortAscending })); - }; + } updateCurrentSortType = sortType => { const { currentSortType } = this.state; @@ -68,7 +68,7 @@ export class MockSortExample extends React.Component { isSortAscending: true }); } - }; + } render() { const { currentSortType, isSortNumeric, isSortAscending } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Switch/Switch.stories.js b/packages/patternfly-3/patternfly-react/src/components/Switch/Switch.stories.js index 155278f6f88..1fbc4bddf76 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Switch/Switch.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/Switch/Switch.stories.js @@ -20,8 +20,8 @@ stories.add( const offColor = select('Off Color', Switch.SWITCH_COLORS, 'default'); const props = { bsSize, title: bsSize, id: 'bsSize-example' }; - if (onColor) props.onColor = onColor; - if (offColor) props.offColor = offColor; + if (onColor) { props.onColor = onColor; } + if (offColor) { props.offColor = offColor; } const story = (
diff --git a/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js b/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js index fe1f008abd6..590bde30cc7 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js +++ b/packages/patternfly-3/patternfly-react/src/components/Table/TableConfirmButtonsRow.js @@ -34,16 +34,16 @@ class TableConfirmButtonsRow extends React.Component { rowDimensions: this.element.getBoundingClientRect() }); } - }; + } handleScroll = event => { this.saveRowDimensions(); - }; + } handleResize = event => { this.fetchClientDimensions(); this.saveRowDimensions(); - }; + } fetchClientDimensions() { this.setState({ diff --git a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js index ad836bea4ab..f617b3fc87d 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js +++ b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockClientPaginationTable.js @@ -251,34 +251,34 @@ export class MockClientPaginationTable extends React.Component { } onFirstPage = () => { this.setPage(1); - }; + } onLastPage = () => { const { page } = this.state.pagination; const totalPages = this.totalPages(); if (page < totalPages) { this.setPage(totalPages); } - }; + } onNextPage = () => { const { page } = this.state.pagination; if (page < this.totalPages()) { this.setPage(this.state.pagination.page + 1); } - }; + } onPageInput = e => { this.setState({ pageChangeValue: e.target.value }); - }; + } onPerPageSelect = (eventKey, e) => { const newPaginationState = Object.assign({}, this.state.pagination); newPaginationState.perPage = eventKey; newPaginationState.page = 1; this.setState({ pagination: newPaginationState }); - }; + } onPreviousPage = () => { if (this.state.pagination.page > 1) { this.setPage(this.state.pagination.page - 1); } - }; + } onRow = (row, { rowIndex }) => { const { selectedRows } = this.state; const selected = selectedRows.indexOf(row.id) > -1; @@ -286,7 +286,7 @@ export class MockClientPaginationTable extends React.Component { className: classNames({ selected }), role: 'row' }; - }; + } onSelectAllRows = event => { const { onRowsLogger } = this.props; const { rows, selectedRows } = this.state; @@ -316,7 +316,7 @@ export class MockClientPaginationTable extends React.Component { }); onRowsLogger(updatedRows.filter(r => r.selected)); } - }; + } onSelectRow = (event, row) => { const { onRowsLogger } = this.props; const { rows, selectedRows } = this.state; @@ -339,10 +339,10 @@ export class MockClientPaginationTable extends React.Component { }); onRowsLogger(rows.filter(r => r.selected)); } - }; + } onSubmit = () => { this.setPage(this.state.pageChangeValue); - }; + } setPage = value => { const page = Number(value); if (!Number.isNaN(value) && value !== '' && page > 0 && page <= this.totalPages()) { @@ -350,7 +350,7 @@ export class MockClientPaginationTable extends React.Component { newPaginationState.page = page; this.setState({ pagination: newPaginationState, pageChangeValue: page }); } - }; + } currentRows() { const { rows, sortingColumns, columns, pagination } = this.state; return compose( @@ -366,7 +366,7 @@ export class MockClientPaginationTable extends React.Component { totalPages = () => { const { perPage } = this.state.pagination; return Math.ceil(mockRows.length / perPage); - }; + } render() { const { columns, pagination, sortingColumns, pageChangeValue } = this.state; const sortedPaginatedRows = this.currentRows(); diff --git a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js index 8a75a0af592..7189dd5ea8a 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js +++ b/packages/patternfly-3/patternfly-react/src/components/Table/__mocks__/mockServerPaginationTable.js @@ -211,14 +211,14 @@ export class MockServerPaginationTable extends React.Component { const newPaginationState = Object.assign({}, this.state.pagination); newPaginationState.page = page; this.getPage(this.state.sortingColumns, newPaginationState); - }; + } onPerPageSelect = (eventKey, e) => { const newPaginationState = Object.assign({}, this.state.pagination); newPaginationState.perPage = eventKey; newPaginationState.page = 1; this.getPage(this.state.sortingColumns, newPaginationState); - }; + } onSelectAllRows = event => { const { sortingColumns, pagination, rows } = this.state; @@ -227,7 +227,7 @@ export class MockServerPaginationTable extends React.Component { // refresh rows after all rows selected this.getPage(sortingColumns, pagination); }); - }; + } onSelectRow = (event, row) => { const { sortingColumns, pagination } = this.state; @@ -235,7 +235,7 @@ export class MockServerPaginationTable extends React.Component { // refresh rows after row is selected this.getPage(sortingColumns, pagination); }); - }; + } onSort = (e, column, sortDirection) => { // Clearing existing sortingColumns does simple single column sort. To do multisort, // set each column based on existing sorts specified and set sort position. @@ -249,7 +249,7 @@ export class MockServerPaginationTable extends React.Component { alert(`Server API called with: sort by ${column.property} ${updatedSortingColumns[column.property].direction}`); this.getPage(updatedSortingColumns, this.state.pagination); - }; + } getPage(sortingColumns, pagination) { const { onServerPageLogger } = this.props; @@ -343,7 +343,7 @@ export class MockServerPaginationTable extends React.Component { role: 'row' }; } - + constructor(props) { super(props); diff --git a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js index c6fce04bd4d..d664e68238b 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js +++ b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/TimedToastNotification.js @@ -43,12 +43,12 @@ class TimedToastNotification extends React.Component { onMouseEnter = () => { const { onMouseEnter } = this.props; onMouseEnter && onMouseEnter(); - }; + } onMouseLeave = () => { const { onMouseLeave } = this.props; onMouseLeave && onMouseLeave(); - }; + } render() { const { children, className, type, onDismiss } = this.props; const { onMouseEnter, onMouseLeave } = this; diff --git a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js index d4eda44f90c..818c17254d8 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotification.stories.js @@ -19,7 +19,7 @@ stories.addDecorator(withKnobs); stories.add( 'Toast Notification', - withInfo(`Toast Notifications pop onto the screen to notify the user of a system occurrence`)(() => { + withInfo('Toast Notifications pop onto the screen to notify the user of a system occurrence')(() => { const header = text('Header', 'Great job!'); const message = text('Message', 'This is really working out.'); const type = select('Type', ToastNotification.TOAST_NOTIFICATION_TYPES, 'success'); @@ -70,13 +70,13 @@ class ToastNotificationStoryWrapper extends React.Component { type: 'info', persistent: false, timerdelay: 8000, - message: `By default, a toast notification's timer expires after eight seconds.` + message: 'By default, a toast notification\'s timer expires after eight seconds.' }, { key: 2, type: 'warning', persistent: false, - message: `Additionally, if the user hovers any toast notification each timer is reset.` + message: 'Additionally, if the user hovers any toast notification each timer is reset.' } ]; @@ -150,7 +150,7 @@ class ToastNotificationStoryWrapper extends React.Component { stories.add( 'Toast Notification List', - withInfo(`This is the Toast Notification List with a custom timer delay supplied.`)(() => { + withInfo('This is the Toast Notification List with a custom timer delay supplied.')(() => { const story = ; return inlineTemplate({ title: 'Toast Notification List', diff --git a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js index fe5bbadf510..d9a615781d5 100644 --- a/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js +++ b/packages/patternfly-3/patternfly-react/src/components/ToastNotification/ToastNotificationList.js @@ -18,19 +18,19 @@ class ToastNotificationList extends React.Component { this.setState({ paused: true }); const { onMouseEnter } = this.props; onMouseEnter(); - }; + } onMouseLeave = () => { this.setState({ paused: false }); const { onMouseLeave } = this.props; onMouseLeave(); - }; + } onMouseOver = () => { this.setState({ paused: true }); const { onMouseOver } = this.props; onMouseOver(); - }; + } renderChildren() { const { paused } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js b/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js index 72f9e606cf5..7a81ea1b44e 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js +++ b/packages/patternfly-3/patternfly-react/src/components/Toolbar/ToolbarFind.js @@ -19,7 +19,7 @@ class ToolbarFind extends React.Component { if (keyEvent.key === 'Enter' && onEnter) { onEnter(currentValue); } - }; + } handleFindNext = () => { const { currentValue } = this.state; @@ -28,7 +28,7 @@ class ToolbarFind extends React.Component { if (onFindNext) { onFindNext(currentValue); } - }; + } handleFindPrevious = () => { const { currentValue } = this.state; @@ -37,7 +37,7 @@ class ToolbarFind extends React.Component { if (onFindPrevious) { onFindPrevious(currentValue); } - }; + } handleValueChange = event => { const { onChange } = this.props; @@ -47,15 +47,15 @@ class ToolbarFind extends React.Component { if (onChange) { onChange(event.target.value); } - }; + } hideDropdown = () => { this.setState({ dropdownShown: false }); - }; + } toggleDropdownShown = () => { this.setState(prevState => ({ dropdownShown: !prevState.dropdownShown })); - }; + } renderCounts() { const { currentValue } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js b/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js index 8fb4f02a42f..0e5585ad349 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Toolbar/__mocks__/mockToolbarExample.js @@ -26,7 +26,7 @@ export class MockToolbarExample extends React.Component { keyEvent.stopPropagation(); keyEvent.preventDefault(); } - }; + } setViewType(viewType) { const { onViewChanged } = this.props; @@ -47,13 +47,13 @@ export class MockToolbarExample extends React.Component { this.filterAdded(currentFilterType, filterValue); } } - }; + } clearFilters = () => { const { onFiltersChanged } = this.props; this.setState({ activeFilters: [] }); onFiltersChanged && onFiltersChanged('Filters cleared.'); - }; + } filterAdded = (field, value) => { const { onFiltersChanged } = this.props; @@ -77,14 +77,14 @@ export class MockToolbarExample extends React.Component { const activeFilters = [...this.state.activeFilters, { label: filterText }]; this.setState({ activeFilters }); onFiltersChanged && onFiltersChanged(`Filter Added: ${filterText}`); - }; + } filterCategorySelected = category => { const { filterCategory } = this.state; if (filterCategory !== category) { this.setState({ filterCategory: category }); } - }; + } filterValueSelected = filterValue => { const { currentFilterType, currentValue } = this.state; @@ -95,7 +95,7 @@ export class MockToolbarExample extends React.Component { this.filterAdded(currentFilterType, filterValue); } } - }; + } removeFilter = filter => { const { onFiltersChanged } = this.props; @@ -107,7 +107,7 @@ export class MockToolbarExample extends React.Component { this.setState({ activeFilters: updated }); } onFiltersChanged && onFiltersChanged(`Filter Removed: ${filter.label}`); - }; + } selectFilterType = filterType => { const { currentFilterType } = this.state; @@ -118,7 +118,7 @@ export class MockToolbarExample extends React.Component { this.setState({ filterCategory: undefined }); } } - }; + } toggleCurrentSortDirection = () => { const { isSortAscending } = this.state; @@ -126,7 +126,7 @@ export class MockToolbarExample extends React.Component { this.setState({ isSortAscending: !isSortAscending }); onSortChanged && onSortChanged(`sort ascending: ${!isSortAscending}`); - }; + } updateCurrentSortType = sortType => { const { currentSortType } = this.state; @@ -140,11 +140,11 @@ export class MockToolbarExample extends React.Component { }); } onSortChanged && onSortChanged(`sort type: ${sortType.title}`); - }; + } updateCurrentValue = event => { this.setState({ currentValue: event.target.value }); - }; + } renderInput() { const { currentFilterType, currentValue, filterCategory } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js index 0abb5006c21..74b50133226 100644 --- a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js +++ b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeView.js @@ -16,7 +16,7 @@ class TreeView extends React.Component { onFocus = node => { this.setState(() => ({ focusedNodeId: node.dataset.id })); - }; + } onKeyDown = event => { const nodes = this.getVisibleNodes([...this.treeRef.current.getElementsByTagName('li')]); @@ -33,7 +33,7 @@ class TreeView extends React.Component { const [lastVisibleNode] = nodes.slice(-1); lastVisibleNode.focus(); } - }; + } onKeyPress = event => { const nodes = this.getVisibleNodes([...this.treeRef.current.getElementsByTagName('li')]); @@ -58,13 +58,13 @@ class TreeView extends React.Component { if (key === '*') { this.setState(prevState => ({ expandSiblings: prevState.focusedNodeId })); } - }; + } getVisibleNodes = nodes => nodes.filter(node => !node.className.match(/node-hidden/)); clearExpandSiblings = () => { this.setState(() => ({ expandSiblings: '' })); - }; + } treeRef = React.createRef(); diff --git a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js index c4562eb9d50..b513f8c7f2d 100644 --- a/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js +++ b/packages/patternfly-3/patternfly-react/src/components/TreeView/TreeViewNode.js @@ -64,17 +64,17 @@ class TreeViewNode extends Component { e.stopPropagation(); this.handleSelect(e); } - }; + } onFocus = e => { e.stopPropagation(); this.props.onFocus(this.nodeRef.current); this.setState(() => ({ focused: true })); - }; + } onBlur = () => { this.setState(() => ({ focused: false })); - }; + } handleSelect = e => { const { node, selectNode } = this.props; @@ -85,16 +85,16 @@ class TreeViewNode extends Component { this.nodeRef.current.focus(); selectNode(node); } - }; + } toggleExpand = e => { e.stopPropagation(); this.toggleExpandedState(); - }; + } toggleExpandedState = () => { this.setState(prevState => ({ expanded: !prevState.expanded })); - }; + } nodeRef = React.createRef(); diff --git a/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js b/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js index 8c9400277d7..677aa85ef5f 100644 --- a/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js +++ b/packages/patternfly-3/patternfly-react/src/components/TreeView/__mocks__/MockTreeView.js @@ -27,13 +27,13 @@ export class MockTreeView extends React.Component { return { ...node, selected: false }; } return node; - }); + }) selectNode = selectedNode => { this.setState(prevState => ({ nodes: this.nodeSelector(prevState.nodes, selectedNode) })); - }; + } render() { const { nodes } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js index 766f4124607..53d17c9505c 100644 --- a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js +++ b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/AsyncTypeAheadSelect.js @@ -16,7 +16,7 @@ class AsyncTypeAheadSelect extends React.Component { handleSearch = query => { this.onSearchStart(); Promise.resolve(this.props.onSearch(query)).then(options => this.onSearchEnd(options)); - }; + } render() { const { innerRef, ...props } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js index 63fd6ee93d8..14dcfbf6514 100644 --- a/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js +++ b/packages/patternfly-3/patternfly-react/src/components/TypeAheadSelect/mock.js @@ -185,7 +185,7 @@ const mockData = { 'Tajikistan', 'Tanzania', 'Thailand', - "Timor L'Este", + 'Timor L\'Este', 'Togo', 'Tonga', 'Trinidad & Tobago', diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js index a85a3477277..393fd9626b6 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.js @@ -63,29 +63,29 @@ class BaseVerticalNav extends React.Component { const { onLayoutChange, setControlledState } = this.props; setControlledState({ isMobile: newLayout === 'mobile' }); onLayoutChange && onLayoutChange(newLayout); - }; + } setActivePath = activePath => { if (!this.state.controlledActivePath) { this.props.setControlledState({ activePath }); } - }; + } setControlledActivePath = controlledActivePath => { this.setState({ controlledActivePath }); - }; + } setControlledHoverPath = controlledHoverPath => { this.setState({ controlledHoverPath }); - }; + } setControlledMobilePath = controlledMobilePath => { this.setState({ controlledMobilePath }); - }; + } setControlledPinnedPath = controlledPinnedPath => { this.setState({ controlledPinnedPath }); - }; + } setHoverPath = hoverPath => { if (!this.state.controlledHoverPath) { @@ -94,56 +94,56 @@ class BaseVerticalNav extends React.Component { ...(hoverPath === null ? { showMobileNav: false } : {}) }); } - }; + } setMobilePath = mobilePath => { if (!this.state.controlledMobilePath) { this.props.setControlledState({ mobilePath }); } - }; + } setPinnedPath = pinnedPath => { if (!this.state.controlledPinnedPath) { this.props.setControlledState({ pinnedPath }); } - }; + } hoverTimer = new Timer(); clearBodyClasses = () => { if (this.props.dynamicBodyClasses) { setBodyClassIf(false, 'collapsed-nav'); setBodyClassIf(false, 'hidden-nav'); } - }; + } collapseMenu = () => { const { onCollapse, setControlledState } = this.props; setControlledState({ navCollapsed: true }); onCollapse && onCollapse(); - }; + } expandMenu = () => { const { onExpand, setControlledState } = this.props; setControlledState({ navCollapsed: false }); onExpand && onExpand(); - }; + } forceHideSecondaryMenu = () => { this.setState({ forceHidden: true }); // eslint-disable-line react/no-unused-state setTimeout(() => { this.setState({ forceHidden: false }); // eslint-disable-line react/no-unused-state }, 500); - }; + } handleBodyClick = () => { // Clear hover state on body click. Helps especially when using blurDisabled prop. this.setHoverPath(null); - }; + } navigateToItem = item => { const { onNavigate } = this.props; onNavigate(item); // Note: This should become router-aware later on. - }; + } updateBodyClasses = () => { // Note: Updating the body element classes from here like this is a hacky, non-react-y pattern. @@ -154,7 +154,7 @@ class BaseVerticalNav extends React.Component { setBodyClassIf(!isMobile && collapsed, 'collapsed-nav'); setBodyClassIf(isMobile, 'hidden-nav'); } - }; + } updateNavOnItemBlur = (primary, secondary, tertiary, idPath, parentPath, noDelay, callback) => { const { hoverPath, blurDelay, blurDisabled, setControlledState } = this.props; @@ -181,7 +181,7 @@ class BaseVerticalNav extends React.Component { } } } - }; + } updateNavOnItemClick = (primary, secondary, tertiary, idPath, parentPath) => { const { onItemClick, hoverPath, hoverDisabled, isMobile } = this.props; @@ -201,7 +201,7 @@ class BaseVerticalNav extends React.Component { this.navigateToItem(item); } onItemClick && onItemClick(primary, secondary, tertiary); - }; + } updateNavOnItemHover = (primary, secondary, tertiary, idPath, parentPath, callback) => { const { onItemHover, hoverPath, hoverDelay, hoverDisabled, isMobile } = this.props; @@ -221,7 +221,7 @@ class BaseVerticalNav extends React.Component { }, hoverDelay); } } - }; + } updateNavOnMenuToggleClick = () => { const { onMenuToggleClick, isMobile, showMobileNav, navCollapsed, setControlledState } = this.props; @@ -238,21 +238,21 @@ class BaseVerticalNav extends React.Component { this.collapseMenu(); } onMenuToggleClick && onMenuToggleClick(); - }; + } updateNavOnMobileSelection = (primary, secondary, tertiary) => { const { onMobileSelection } = this.props; // All the behavior here is handled by mobilePath and setMobilePath, // but we still make a callback available here. onMobileSelection && onMobileSelection(primary, secondary, tertiary); - }; + } updateNavOnPin = (item, depth, pinned) => { const { onItemPin, isMobile } = this.props; if (!isMobile) { onItemPin && onItemPin(item, depth, pinned); } - }; + } render() { const { items, children } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js index 9f0149870d9..9f8447198fe 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNav.stories.js @@ -215,7 +215,7 @@ stories.add( 'Custom Masthead', withInfo({ propTablesExclude: [MockFixedLayout, MockIconBarChildren, Icon, MenuItem, Dropdown, Dropdown.Menu, Dropdown.Toggle], - text: `Example using the **Masthead**, **Brand** and **IconBar** components with images. (items from 'Items as Objects').` + text: 'Example using the **Masthead**, **Brand** and **IconBar** components with images. (items from \'Items as Objects\').' })(() => (
diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js index 4cf56e0e867..4772ceda46d 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavConstants.js @@ -118,9 +118,9 @@ const getNextDepth = depth => const deepestOf = (pri, sec, ter) => (pri && sec && ter) || (pri && sec) || pri; const componentForDepth = depth => { - if (depth === 'primary') return VerticalNavItem; - if (depth === 'secondary') return VerticalNavSecondaryItem; - if (depth === 'tertiary') return VerticalNavTertiaryItem; + if (depth === 'primary') { return VerticalNavItem; } + if (depth === 'secondary') { return VerticalNavSecondaryItem; } + if (depth === 'tertiary') { return VerticalNavTertiaryItem; } return null; }; diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js index f07c9c15eca..bb63db12a77 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItem.js @@ -9,7 +9,7 @@ import VerticalNavItemHelper from './VerticalNavItemHelper'; * In the future, we could lift some of the primary-specific code from Helper into this file. */ const BaseVerticalNavItem = props => { - if (wrongDepth(props, 'primary')) return correctDepth(props); + if (wrongDepth(props, 'primary')) { return correctDepth(props); } return ; }; diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js index 292e0da4762..74a41d4e261 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavItemHelper.js @@ -78,7 +78,7 @@ class BaseVerticalNavItemHelper extends React.Component { const { primary, secondary, tertiary } = this.getContextNavItems(); const { updateNavOnItemBlur, idPath, onBlur } = this.props; updateNavOnItemBlur(primary, secondary, tertiary, this.idPath(), idPath, noDelay, onBlur); - }; + } onItemClick = event => { const { primary, secondary, tertiary } = this.getContextNavItems(); @@ -95,19 +95,19 @@ class BaseVerticalNavItemHelper extends React.Component { } this.setActive(); onClick && onClick(primary, secondary, tertiary); - }; + } onItemHover = () => { const { primary, secondary, tertiary } = this.getContextNavItems(); const { updateNavOnItemHover, idPath, onHover } = this.props; updateNavOnItemHover(primary, secondary, tertiary, this.idPath(), idPath, onHover); - }; + } onMobileSelection = (primary, secondary, tertiary) => { const { setMobilePath, updateNavOnMobileSelection } = this.props; setMobilePath(this.idPath()); updateNavOnMobileSelection(primary, secondary, tertiary); - }; + } getContextNavItems = () => { // We have primary, secondary, and tertiary items as props if they are part of the parent context, @@ -119,11 +119,11 @@ class BaseVerticalNavItemHelper extends React.Component { secondary: depth === 'secondary' ? navItem : secondaryItem, tertiary: depth === 'tertiary' ? navItem : tertiaryItem }; - }; + } setActive = () => { this.props.setActivePath(this.idPath()); - }; + } setHovered() { this.props.setHoverPath(this.idPath()); @@ -132,7 +132,7 @@ class BaseVerticalNavItemHelper extends React.Component { id = () => { const { id, title } = this.navItem(null, true); // Need to ignorePath here so we don't get an infinite call stack... return id || title || this.props.index; - }; + } idPath = () => `${this.props.idPath}${this.id()}/`; @@ -150,7 +150,7 @@ class BaseVerticalNavItemHelper extends React.Component { selectedOnMobile: valOrOnPath(item.selectedOnMobile, props.mobilePath), pinned: valOrOnPath(item.pinned, props.pinnedPath) }; - }; + } pinNextDepth = () => { const { @@ -181,7 +181,7 @@ class BaseVerticalNavItemHelper extends React.Component { } } updateNavOnPin(this.navItem(), nextDepth, !pinnedPath); - }; + } render() { const { diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js index 18f3a0a3488..847044a2f64 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavSecondaryItem.js @@ -9,7 +9,7 @@ import VerticalNavItemHelper from './VerticalNavItemHelper'; * In the future, we could lift some of the secondary-specific code from Helper into this file. */ const BaseVerticalNavSecondaryItem = props => { - if (wrongDepth(props, 'secondary')) return correctDepth(props); + if (wrongDepth(props, 'secondary')) { return correctDepth(props); } return ; }; diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js index 273d052612e..a7d4443b516 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/VerticalNavTertiaryItem.js @@ -9,7 +9,7 @@ import VerticalNavItemHelper from './VerticalNavItemHelper'; * In the future, we could lift some of the tertiary-specific code from Helper into this file. */ const BaseVerticalNavTertiaryItem = props => { - if (wrongDepth(props, 'tertiary')) return correctDepth(props); + if (wrongDepth(props, 'tertiary')) { return correctDepth(props); } return ; }; diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js index 715259be74c..852539a301c 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockNavItems.js @@ -96,7 +96,7 @@ export const mockNavItems = [ badges: [ { count: 9999, - tooltip: "Whoa, that's a lot" + tooltip: 'Whoa, that\'s a lot' } ] }, diff --git a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js index 759d803214d..169a1367a72 100644 --- a/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js +++ b/packages/patternfly-3/patternfly-react/src/components/VerticalNav/__mocks__/mockWithMastHeadComponent.js @@ -9,7 +9,7 @@ export class MockWithMastHeadComponent extends React.Component { onCollapse = () => { this.setState({ collapse: !this.state.collapse }); - }; + } render() { return ( diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js index f6ba81a9d2b..d105aae944d 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/StatefulWizardPattern.js @@ -33,7 +33,7 @@ class StatefulWizardPattern extends React.Component { return; } this.setState({ activeStepIndex: newStepIndex }); - }; + } render() { const { shouldDisableNextStep, shouldDisablePreviousStep, shouldDisableCancelButton, ...otherProps } = this.props; diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js index b668bdf37f5..26510ffeee7 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Patterns/WizardPattern.js @@ -58,18 +58,18 @@ const WizardPattern = ({ const activeStep = getStep(); const goToStep = newStepIndex => { - if (shouldPreventGoToStep(newStepIndex)) return; + if (shouldPreventGoToStep(newStepIndex)) { return; } if (newStepIndex === activeStepIndex + 1) { const stepOnNextResult = activeStep.onNext && activeStep.onNext(); const propOnNextResult = onNext(newStepIndex); const stepFailed = stepOnNextResult === false || propOnNextResult === false; - if (stepFailed) return; + if (stepFailed) { return; } } if (newStepIndex === activeStepIndex - 1) { const stepFailed = onBack(newStepIndex) === false; - if (stepFailed) return; + if (stepFailed) { return; } } - if (onStepChanged) onStepChanged(newStepIndex); + if (onStepChanged) { onStepChanged(newStepIndex); } }; const shouldPreventGoToStep = newStepIndex => { diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js index 59dcf2e6b2a..4c741e6ae10 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/LoadingWizardExample.js @@ -12,10 +12,10 @@ export class LoadingWizardExample extends React.Component { } close = () => { this.setState({ showModal: false }); - }; + } open = () => { this.setState({ showModal: true }); - }; + } render() { const { showModal } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js index cde44b59d2f..42b17eb44f4 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardExample.js @@ -11,10 +11,10 @@ import { renderWizardSteps, renderSidebarItems, renderWizardContents } from './m export class WizardExample extends MockWizardBase { open = () => { this.setState({ showModal: true }); - }; + } close = () => { this.setState({ showModal: false }); - }; + } render() { const { showModal, activeStepIndex, activeSubStepIndex } = this.state; diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js index 9f3244ceeaa..6a65b88de5f 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/WizardPatternExample.js @@ -28,13 +28,13 @@ export class WizardPatternExample extends React.Component { close = () => { this.setState({ showModal: false, loading: false }); - }; + } open = () => { this.setState({ showModal: true, loading: true }); setTimeout(() => { this.setState({ loading: false }); }, 1000); - }; + } renderStateless = () => { // We need knobs on the stateless example, because we must drive its state ourselves. const { loading, activeStepIndex } = this.state; @@ -64,7 +64,7 @@ export class WizardPatternExample extends React.Component { />
); - }; + } renderStateful = () => ( // No knobs for the stateful example, we want to let it control its own state.
@@ -84,7 +84,7 @@ export class WizardPatternExample extends React.Component { loading={this.state.loading} />
- ); + ) render() { return this.props.stateful ? this.renderStateful() : this.renderStateless(); } diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js index ba024559f88..148086e03a4 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardBase.js @@ -23,7 +23,7 @@ class MockWizardBase extends React.Component { activeSubStepIndex: steps[prevState.activeStepIndex - 1].subSteps.length - 1 })); } - }; + } onNextButtonClick = () => { const { steps } = this.props; const { activeStepIndex, activeSubStepIndex } = this.state; @@ -39,13 +39,13 @@ class MockWizardBase extends React.Component { activeSubStepIndex: 0 })); } - }; + } onSidebarItemClick = (stepIndex, subStepIndex) => { this.setState({ activeStepIndex: stepIndex, activeSubStepIndex: subStepIndex }); - }; + } onStepClick = stepIndex => { if (stepIndex === this.state.activeStepIndex) { return; @@ -54,7 +54,7 @@ class MockWizardBase extends React.Component { activeStepIndex: stepIndex, activeSubStepIndex: 0 }); - }; + } render() { return false; } diff --git a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js index 0f9bba1d4f5..8c7d78ae614 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js +++ b/packages/patternfly-3/patternfly-react/src/components/Wizard/Stories/mockWizardReviewStepsManager.js @@ -16,7 +16,7 @@ class MockWizardReviewStepsManager extends React.Component { this.setState({ steps: updated }); - }; + } subStepClicked = (e, stepIndex, subStepIndex) => { e.preventDefault(); const updated = [...this.state.steps]; @@ -24,7 +24,7 @@ class MockWizardReviewStepsManager extends React.Component { this.setState({ steps: updated }); - }; + } render() { const { steps } = this.state; return ( diff --git a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js index 9ca03d1b23d..6ea69fc2623 100644 --- a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js +++ b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.js @@ -24,21 +24,21 @@ class SerialConsole extends React.Component { } onResetClick = event => { - if (event.button !== 0) return; + if (event.button !== 0) { return; } this.props.onDisconnect(); this.props.onConnect(); event.target.blur(); this.focusTerminal(); - }; + } onDisconnectClick = event => { - if (event.button !== 0) return; + if (event.button !== 0) { return; } this.props.onDisconnect(); event.target.blur(); this.focusTerminal(); - }; + } /** * Backend sent data. @@ -60,7 +60,7 @@ class SerialConsole extends React.Component { focusTerminal = () => { this.childTerminal && this.childTerminal.focus(); - }; + } render() { const { id, status, topClassName } = this.props; diff --git a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js index 01434d96e10..6b4c6d12db0 100644 --- a/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js +++ b/packages/patternfly-3/react-console/src/SerialConsole/SerialConsole.stories.js @@ -44,13 +44,13 @@ export class SerialConsoleConnector extends React.Component { passKeys: false, status: DISCONNECTED // will close the terminal window }); - }; + } onConnect = () => { log('SerialConsoleConnector.onConnect(), ', this.state); this.setConnected(); this.tellFairyTale(); - }; + } onData = data => { log('UI terminal component produced data, i.e. a key was pressed, pass it to backend. [', data, ']'); @@ -60,32 +60,32 @@ export class SerialConsoleConnector extends React.Component { if (this.state.passKeys) { this.onDataFromBackend(data); } - }; + } onDataFromBackend = data => { log('Backend sent data, pass them to the UI component. [', data, ']'); if (this.childSerialconsole) { this.childSerialconsole.onDataReceived(data); } - }; + } onDisconnect = () => { this.setState({ status: DISCONNECTED }); timeoutIds.forEach(id => clearTimeout(id)); - }; + } onResize = (rows, cols) => { log('UI has been resized, pass this info to backend. [', rows, ', ', cols, ']'); - }; + } setConnected = () => { this.setState({ status: CONNECTED, passKeys: true }); - }; + } tellFairyTale = () => { let time = 1000; @@ -102,7 +102,7 @@ export class SerialConsoleConnector extends React.Component { time += 5000; timeoutIds.push(setTimeout(this.onBackendDisconnected, time)); - }; + } render() { return ( diff --git a/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js b/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js index 8c7e738db6f..9d122ae8506 100644 --- a/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js +++ b/packages/patternfly-3/react-console/src/SerialConsole/XTerm.js @@ -100,7 +100,7 @@ class XTerm extends React.Component { // https://developer.mozilla.org/en-US/docs/Web/Events/beforeunload event.returnValue = ''; return ''; - }; + } /** * Backend closed connection. @@ -125,11 +125,11 @@ class XTerm extends React.Component { onFocus = () => { window.addEventListener('beforeunload', this.onBeforeUnload); - }; + } onBlur = () => { window.removeEventListener('beforeunload', this.onBeforeUnload); - }; + } /** * If autoFit is enabled, compute the size and set it @@ -174,8 +174,8 @@ class XTerm extends React.Component { } focus = () => { - if (this.state.terminal) this.state.terminal.focus(); - }; + if (this.state.terminal) { this.state.terminal.focus(); } + } render() { // ensure react never reuses this div by keying it with the terminal widget diff --git a/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js b/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js index 908ac2bca15..82092c82b07 100644 --- a/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js +++ b/packages/patternfly-3/react-console/src/SpiceConsole/SpiceConsole.js @@ -45,7 +45,7 @@ class SpiceConsole extends React.Component { } onConnected = () => { this.setState({ status: CONNECTED }); - }; + } onCtrlAltDel = e => { if (this.sc) { @@ -54,23 +54,23 @@ class SpiceConsole extends React.Component { sendCtrlAltDel(); window.sc = undefined; } - }; + } onSpiceError = e => { this.disconnect(); this.onDisconnected(e); // if (e !== undefined && e.message === "Permission denied.") { - }; + } onDisconnected = e => { this.setState({ status: DISCONNECTED }); this.props.onDisconnected(e); - }; + } onSecurityFailure = e => { this.setState({ status: DISCONNECTED }); this.props.onSecurityFailure(e); - }; + } render() { const { textDisconnected, textConnecting, textSendShortcut, textCtrlAltDel } = this.props; diff --git a/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js b/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js index a6df6a15508..91d8af39448 100644 --- a/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js +++ b/packages/patternfly-3/react-console/src/VncConsole/VncConsole.js @@ -73,45 +73,45 @@ class VncConsole extends React.Component { return; } this.rfb.disconnect(); - }; + } onConnected = () => { this.setState({ status: CONNECTED }); - }; + } onCtrlAltDel = e => { if (this.rfb) { this.rfb.sendCtrlAltDel(); this.focusVnc(e); } - }; + } onDisconnected = e => { this.setState({ status: DISCONNECTED }); this.props.onDisconnected(e); - }; + } onSecurityFailure = e => { this.setState({ status: DISCONNECTED }); this.props.onSecurityFailure(e); - }; + } removeEventListeners = () => { this.rfb.removeEventListener('connect', this.onConnected); this.rfb.removeEventListener('disconnect', this.onDisconnected); this.rfb.removeEventListener('securityfailure', this.onSecurityFailure); - }; + } setNovncElem = e => { this.novncElem = e; - }; + } focusVnc = e => { if (e && e.target && e.target.blur) { e.target.blur(); } this.novncElem && this.novncElem.focus(); - }; + } render() { const { diff --git a/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx b/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx index eeb73051b8d..94041f55506 100644 --- a/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/Chart/Chart.test.tsx @@ -4,8 +4,8 @@ import { Chart } from './Chart'; import { ChartGroup } from '../ChartGroup'; import { ChartLine } from '../ChartLine'; -Object.values([true, false]).forEach(isRead => { - test(`Chart`, () => { +Object.values([true, false]).forEach((isRead) => { + test('Chart', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx b/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx index 827f5ef3091..7c6ee072e63 100644 --- a/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx +++ b/packages/patternfly-4/react-charts/src/components/Chart/Chart.tsx @@ -21,7 +21,7 @@ import { ChartLegendOrientation, ChartLegendPosition, ChartLegendWrapper -} from "../ChartLegend"; +} from '../ChartLegend'; import { ChartCommonStyles, ChartThemeDefinition } from '../ChartTheme'; import { getLabelTextSize, getPaddingForSide, getTheme } from '../ChartUtils'; @@ -195,13 +195,13 @@ export interface ChartProps extends VictoryChartProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - legendData?: Array<{ + legendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The orientation prop takes a string that defines whether legend data * are displayed in a row or column. When orientation is "horizontal", @@ -271,7 +271,7 @@ export interface ChartProps extends VictoryChartProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The scale prop determines which scales your chart should use. This prop can be * given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx index 3bccece1b5c..1fb3b2b5cec 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartArea } from '../ChartArea'; -Object.values([true, false]).forEach(isRead => { - test(`ChartArea`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartArea', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx index 0281e642c9e..b24984ef1f8 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartArea/ChartArea.tsx @@ -22,7 +22,7 @@ import { getTheme } from '../ChartUtils'; export enum ChartAreaSortOrder { ascending = 'ascending', descending = 'descending' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -140,7 +140,7 @@ export interface ChartAreaProps extends VictoryAreaProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', 'all'>[]; /** * ChartArea uses the standard externalEventMutations prop. */ @@ -251,7 +251,7 @@ export interface ChartAreaProps extends VictoryAreaProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The samples prop specifies how many individual points to plot when plotting * y as a function of x. Samples is ignored if x props are provided instead. @@ -371,7 +371,7 @@ export interface ChartAreaProps extends VictoryAreaProps { * @example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"] */ y0?: DataGetterPropType; -}; +} export const ChartArea: React.FunctionComponent = ({ themeColor, diff --git a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx index 7a86b0d8c80..8555b10f3e1 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.test.tsx @@ -5,8 +5,8 @@ import { ChartAxis } from './ChartAxis'; import { ChartGroup } from '../ChartGroup'; import { ChartLine } from '../ChartLine'; -Object.values([true, false]).forEach(isRead => { - test(`ChartAxis`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartAxis', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx index 2f83a73f15a..46d0ba76945 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartAxis/ChartAxis.tsx @@ -11,7 +11,7 @@ import { VictoryAxis, VictoryAxisProps, } from 'victory'; -import { ChartThemeDefinition } from "../ChartTheme"; +import { ChartThemeDefinition } from '../ChartTheme'; import { getAxisTheme, getTheme } from '../ChartUtils'; /** @@ -132,7 +132,7 @@ export interface ChartAxisProps extends VictoryAxisProps { * } * ]} */ - events?: EventPropTypeInterface<"axis" | "axisLabel" | "grid" | "ticks" | "tickLabels" | "parent", number | string>[]; + events?: EventPropTypeInterface<'axis' | 'axisLabel' | 'grid' | 'ticks' | 'tickLabels' | 'parent', number | string>[]; /** * ChartLegend uses the standard externalEventMutations prop. */ @@ -231,7 +231,7 @@ export interface ChartAxisProps extends VictoryAxisProps { /** * The orientation prop specifies the position and orientation of your axis. */ - orientation?: "top" | "bottom" | "left" | "right"; + orientation?: 'top' | 'bottom' | 'left' | 'right'; /** * The padding props specifies the amount of padding in number of pixels between * the edge of the chart and any rendered child components. This prop can be given @@ -252,7 +252,7 @@ export interface ChartAxisProps extends VictoryAxisProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The scale prop determines which scales your chart should use. This prop can be * given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), @@ -419,6 +419,6 @@ export const ChartAxis: React.FunctionComponent = ({ return ( ); -} +}; hoistNonReactStatics(ChartAxis, VictoryAxis); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx index 39b8d987c20..48237775359 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.test.tsx @@ -4,8 +4,8 @@ import { Chart } from '../Chart'; import { ChartBar } from './ChartBar'; import { ChartGroup } from '../ChartGroup'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBar`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBar', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx index 93b60050e17..39794699f47 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBar/ChartBar.tsx @@ -33,7 +33,7 @@ export interface ChartBarProps extends VictoryBarProps { * This prop may be given as “start”, “middle” or “end”. When this prop is not specified, * bars will have “middle” alignment relative to their data points. */ - alignment?: "start" | "middle" | "end"; + alignment?: 'start' | 'middle' | 'end'; /** * The animate prop specifies props for VictoryAnimation to use. * The animate prop should also be used to specify enter and exit @@ -174,7 +174,7 @@ export interface ChartBarProps extends VictoryBarProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', number | string>[]; /** * ChartBar uses the standard externalEventMutations prop. */ @@ -281,7 +281,7 @@ export interface ChartBarProps extends VictoryBarProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The samples prop specifies how many individual points to plot when plotting * y as a function of x. Samples is ignored if x props are provided instead. diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx index 54cb4597a26..2913b4aecad 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBullet } from './ChartBullet'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletQualitativeRange`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletQualitativeRange', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); @@ -15,7 +15,7 @@ test('renders component data', () => { ariaDesc="Storage capacity" ariaTitle="Bullet chart example" comparativeWarningMeasureData={[{name: 'Warning', y: 88}]} - labels={datum => `${datum.name}: ${datum.y}`} + labels={(datum) => `${datum.name}: ${datum.y}`} maxDomain={{y: 100}} primarySegmentedMeasureData={[{ name: 'Measure', y: 50 }]} qualitativeRangeData={[{ name: 'Range', y: 50 }, { name: 'Range', y: 75 }]} diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx index 151ff9efdbe..cc4c20cc159 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBullet.tsx @@ -110,13 +110,13 @@ export interface ChartBulletProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - comparativeErrorMeasureLegendData?: Array<{ + comparativeErrorMeasureLegendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The comparative measure warning component to render with the chart */ @@ -148,13 +148,13 @@ export interface ChartBulletProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - comparativeWarningMeasureLegendData?: Array<{ + comparativeWarningMeasureLegendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The domain prop describes the range of values your chart will include. This prop can be * given as a array of the minimum and maximum expected values for your chart, @@ -316,13 +316,13 @@ export interface ChartBulletProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - primaryDotMeasureLegendData?: Array<{ + primaryDotMeasureLegendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The primary segmented measure component to render with the chart */ @@ -354,13 +354,13 @@ export interface ChartBulletProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - primarySegmentedMeasureLegendData?: Array<{ + primarySegmentedMeasureLegendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The qualitative range component to render with the chart */ @@ -399,13 +399,13 @@ export interface ChartBulletProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - qualitativeRangeLegendData?: Array<{ + qualitativeRangeLegendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The standalone prop determines whether the component will render a standalone svg * or a tag that will be included in an external svg. Set standalone to false to @@ -491,8 +491,8 @@ interface ChartBulletThemeInterface { primarySegmentedMeasureLegendData?: any[]; qualitativeRangeData?: any[]; qualitativeRangeLegendData?: any[]; - themeColor?: string, - themeVariant?: string + themeColor?: string; + themeVariant?: string; } // Returns the min and max domain for comparative / primary measures and qualitative range data diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx index 01e08a308ad..70ec37eef46 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletComparativeErrorMeasure } from './ChartBulletComparativeErrorMeasure'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletComparativeErrorMeasure`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletComparativeErrorMeasure', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx index 48709708be2..327d1ef419d 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeErrorMeasure.tsx @@ -152,7 +152,7 @@ export interface ChartBulletComparativeErrorMeasureProps { interface ChartBulletComparativeErrorMeasureInterface { data?: any[]; invert?: boolean; - theme?: ChartThemeDefinition, + theme?: ChartThemeDefinition; themeColor?: string; themeVariant?: string; y?: DataGetterPropType; diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx index ffbff93658b..15affe868a5 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletComparativeMeasure } from './ChartBulletComparativeMeasure'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletComparativeMeasure`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletComparativeMeasure', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx index b412031a0d7..9f7f9018dcb 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeMeasure.tsx @@ -154,7 +154,7 @@ export interface ChartBulletComparativeMeasureProps { interface ChartBulletComparativeMeasureInterface { data?: any[]; invert?: boolean; - theme?: ChartThemeDefinition, + theme?: ChartThemeDefinition; themeColor?: string; themeVariant?: string; y?: DataGetterPropType; @@ -221,16 +221,16 @@ export const ChartBulletComparativeMeasure: React.FunctionComponent { + dx={(datum) => { if (horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth; return result / 2; }} - dy={datum => { + dy={(datum) => { if (!horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth; return result / 2; diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx index ffc6ce7e245..ce00bdfb564 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletComparativeWarningMeasure } from './ChartBulletComparativeWarningMeasure'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletComparativeZeroMeasure`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletComparativeZeroMeasure', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx index 0cd14c2a9b3..66ce71a1844 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletComparativeWarningMeasure.tsx @@ -152,7 +152,7 @@ export interface ChartBulletComparativeWarningMeasureProps { interface ChartBulletComparativeWarningMeasureInterface { data?: any[]; invert?: boolean; - theme?: ChartThemeDefinition, + theme?: ChartThemeDefinition; themeColor?: string; themeVariant?: string; y?: DataGetterPropType; diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx index 6f88f36951e..3eab6fe3dbb 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletGroupTitle.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletGroupTitle } from './ChartBulletGroupTitle'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletGroupTitle`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletGroupTitle', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx index 562ff87b026..297eecccbed 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletPrimaryDotMeasure } from './ChartBulletPrimaryDotMeasure'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletPrimaryDotMeasure`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletPrimaryDotMeasure', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx index b187e969aa0..3e8bd3668aa 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimaryDotMeasure.tsx @@ -156,7 +156,7 @@ export interface ChartBulletPrimaryDotMeasureProps { interface ChartBulletPrimaryDotMeasureDataInterface { data?: any[]; invert?: boolean; - theme?: ChartThemeDefinition, + theme?: ChartThemeDefinition; themeColor?: string; themeVariant?: string; y?: DataGetterPropType; @@ -221,15 +221,15 @@ export const ChartBulletPrimaryDotMeasure: React.FunctionComponent { + dx={(datum) => { if (horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } return ChartBulletStyles.primaryDotMeasureSize; }} - dy={datum => { + dy={(datum) => { if (!horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } return ChartBulletStyles.primaryDotMeasureSize; }} diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx index beb0ff53702..b79dbdbd416 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletPrimarySegmentedMeasure } from './ChartBulletPrimarySegmentedMeasure'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletPrimarySegmentedMeasure`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletPrimarySegmentedMeasure', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx index f8507252a30..25fad93631c 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletPrimarySegmentedMeasure.tsx @@ -13,7 +13,7 @@ import { ChartContainer } from '../ChartContainer'; import { ChartBulletStyles, ChartThemeDefinition } from '../ChartTheme'; import { ChartTooltip } from '../ChartTooltip'; import { getBulletPrimaryNegativeMeasureTheme, getBulletPrimarySegmentedMeasureTheme } from '../ChartUtils'; -import { ChartBulletComparativeMeasure } from "./ChartBulletComparativeMeasure"; +import { ChartBulletComparativeMeasure } from './ChartBulletComparativeMeasure'; /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -178,8 +178,8 @@ export interface ChartBulletPrimarySegmentedMeasureProps { interface ChartBulletPrimarySegmentedMeasureDataInterface { data?: any[]; invert?: boolean; - negativeMeasureTheme?: ChartThemeDefinition, - theme?: ChartThemeDefinition, + negativeMeasureTheme?: ChartThemeDefinition; + theme?: ChartThemeDefinition; themeColor?: string; themeVariant?: string; y?: DataGetterPropType; @@ -275,16 +275,16 @@ export const ChartBulletPrimarySegmentedMeasure: React.FunctionComponent { + dx={(datum) => { if (horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth; return result / 2; }} - dy={datum => { + dy={(datum) => { if (!horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth; return result / 2; diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx index ead18094570..19d6251f36e 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletQualitativeRange } from './ChartBulletQualitativeRange'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletQualitativeRange`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletQualitativeRange', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx index c6c18b91ced..5a147c74157 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletQualitativeRange.tsx @@ -165,7 +165,7 @@ export interface ChartBulletQualitativeRangeProps { interface ChartBulletQualitativeRangeDataInterface { data?: any[]; invert?: boolean; - theme?: ChartThemeDefinition, + theme?: ChartThemeDefinition; themeColor?: string; themeVariant?: string; y?: DataGetterPropType; @@ -239,16 +239,16 @@ export const ChartBulletQualitativeRange: React.FunctionComponent { + dx={(datum) => { if (horizontal) { - return datum._y > 0 ? -10 : 10 + return datum._y > 0 ? -10 : 10; } const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth; return result / 2; }} - dy={datum => { + dy={(datum) => { if (!horizontal) { - return -10 + return -10; } const result = (typeof barWidth === 'function') ? barWidth(data, false) : barWidth; return result / 2; diff --git a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx index 0a40947430e..1852fc9f663 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartBullet/ChartBulletTitle.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartBulletTitle } from './ChartBulletTitle'; -Object.values([true, false]).forEach(isRead => { - test(`ChartBulletTitle`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartBulletTitle', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx index cee984ab72a..25ed039c08d 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.test.tsx @@ -3,8 +3,8 @@ import { shallow } from 'enzyme'; import { ChartContainer } from './ChartContainer'; import { ChartLegend } from '../ChartLegend'; -Object.values([true, false]).forEach(isRead => { - test(`ChartContainer`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartContainer', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx index 6a5e4fdb244..dd5577b4446 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/ChartContainer.tsx @@ -89,7 +89,7 @@ export interface ChartContainerProps extends VictoryContainerProps { * is given, the width prop from the child component passed will be used. */ width?: number; -}; +} // const ChartContainer = props => ; export const ChartContainer: React.FunctionComponent = ({ diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx index 50474a31635..b8b58c42a7c 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartDonut } from './ChartDonut'; -Object.values([true, false]).forEach(isRead => { - test(`ChartDonut`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartDonut', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx index a27eb52c53f..0d3d1018dd6 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx @@ -22,12 +22,12 @@ export enum ChartDonutLabelPosition { centroid = 'centroid', endAngle = 'endAngle', startAngle = 'startAngle' -}; +} export enum ChartDonutSortOrder { ascending = 'ascending', descending = 'descending' -}; +} export enum ChartDonutSubTitlePosition { bottom = 'bottom', @@ -219,7 +219,7 @@ export interface ChartDonutProps extends ChartPieProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback | string[] | number[]>[]; /** * ChartDonut uses the standard externalEventMutations prop. */ @@ -297,13 +297,13 @@ export interface ChartDonutProps extends ChartPieProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - legendData?: Array<{ + legendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * Defines a horizontal shift from the x coordinate. It should not be set manually. */ diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx index da805333f20..b1d80e3f66a 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartDonutThreshold } from './ChartDonutThreshold'; -Object.values([true, false]).forEach(isRead => { - test(`ChartDonutThreshold`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartDonutThreshold', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx index 98d3d63c212..cb3861e5466 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx @@ -9,40 +9,40 @@ import { StringOrNumberOrCallback, VictoryPie, VictoryStyleInterface -} from "victory"; +} from 'victory'; import { Data } from 'victory-core'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { ChartContainer } from '../ChartContainer'; import { ChartDonut, ChartDonutProps } from '../ChartDonut'; -import { ChartCommonStyles, ChartDonutStyles, ChartThemeDefinition } from "../ChartTheme"; +import { ChartCommonStyles, ChartDonutStyles, ChartThemeDefinition } from '../ChartTheme'; import { getChartOrigin, getDonutThresholdDynamicTheme, getDonutThresholdStaticTheme } from '../ChartUtils'; export enum ChartDonutThresholdDonutOrientation { left = 'left', right = 'right', top = 'top' -}; +} export enum ChartDonutThresholdLabelOrientation { horizontal = 'horizontal', vertical = 'vertical' -}; +} export enum ChartDonutThresholdLabelPosition { centroid = 'centroid', endAngle = 'endAngle', startAngle = 'startAngle' -}; +} export enum ChartDonutThresholdLegendPosition { bottom = 'bottom', right = 'right' -}; +} export enum ChartDonutThresholdSortOrder { ascending = 'ascending', descending = 'descending' -}; +} export enum ChartDonutThresholdSubTitlePosition { bottom = 'bottom', @@ -237,7 +237,7 @@ export interface ChartDonutThresholdProps extends ChartDonutProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback | string[] | number[]>[]; /** * ChartDonutThreshold uses the standard externalEventMutations prop. */ @@ -459,7 +459,7 @@ export const ChartDonutThreshold: React.FunctionComponent { // Format and sort data. Sorting ensures thresholds are displayed in the correct order and simplifies calculations. - const datum = Data.formatData(data, {x, y, ...rest}, ['x', 'y']).sort((a: any,b: any) => a._y - b._y); + const datum = Data.formatData(data, {x, y, ...rest}, ['x', 'y']).sort((a: any, b: any) => a._y - b._y); // Data must be offset so that the sum of all data point y-values (including the final slice) == 100. const [prev, computedData] = datum.reduce((acc: [number, any], dataPoint: {_x: number | string, _y: number}) => { @@ -498,7 +498,7 @@ export const ChartDonutThreshold: React.FunctionComponent { const dynamicHeight = donutSize - (theme.pie.height - dynamicTheme.pie.height); return Math.round((donutSize - dynamicHeight) / 2); - } + }; // Returns the horizontal shift for the donut utilization legend const getLegendDx = (dynamicTheme: ChartThemeDefinition, position: string) => { @@ -520,7 +520,7 @@ export const ChartDonutThreshold: React.FunctionComponent { @@ -536,11 +536,11 @@ export const ChartDonutThreshold: React.FunctionComponent { return getLegendDy(dynamicTheme, position); - } + }; // Render dynamic utilization donut cart const renderChildren = () => - React.Children.toArray(children).map(child => { + React.Children.toArray(children).map((child) => { if (child.props) { const { data: childData, ...childProps } = child.props; const datum = Data.formatData([childData], childProps, ['x', 'y']); // Format child data independently of this component's props diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx index 5549cb85d1a..59536336d51 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartDonutUtilization } from './ChartDonutUtilization'; -Object.values([true, false]).forEach(isRead => { - test(`ChartDonutUtilization`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartDonutUtilization', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx index 5aa0576b51b..a63bcf947c7 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutUtilization.tsx @@ -14,7 +14,7 @@ import { } from 'victory'; import { Data } from 'victory-core'; import { ChartContainer } from '../ChartContainer'; -import { ChartDonut, ChartDonutProps } from "../ChartDonut"; +import { ChartDonut, ChartDonutProps } from '../ChartDonut'; import { ChartThemeDefinition, ChartDonutUtilizationStyles } from '../ChartTheme'; import { getDonutUtilizationTheme } from '../ChartUtils'; @@ -22,22 +22,22 @@ export enum ChartDonutUtilizationLabelPosition { centroid = 'centroid', endAngle = 'endAngle', startAngle = 'startAngle' -}; +} export enum ChartDonutUtilizationLegendOrientation { horizontal = 'horizontal', vertical = 'vertical' -}; +} export enum ChartDonutUtilizationLegendPosition { bottom = 'bottom', right = 'right' -}; +} export enum ChartDonutUtilizationSortOrder { ascending = 'ascending', descending = 'descending' -}; +} export enum ChartDonutUtilizationSubTitlePosition { bottom = 'bottom', @@ -251,7 +251,7 @@ export interface ChartDonutUtilizationProps extends ChartDonutProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback | string[] | number[]>[]; /** * ChartDonutUtilization uses the standard externalEventMutations prop. */ @@ -322,13 +322,13 @@ export interface ChartDonutUtilizationProps extends ChartDonutProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - legendData?: Array<{ + legendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * Defines a horizontal shift from the x coordinate. It should not be set manually. */ @@ -561,7 +561,7 @@ export const ChartDonutUtilization: React.FunctionComponent { const datum = [{ ...data }]; - return Data.formatData(datum, { x, y, ...rest }, ['x', 'y']).sort((a: any,b: any) => a._y - b._y); + return Data.formatData(datum, { x, y, ...rest }, ['x', 'y']).sort((a: any, b: any) => a._y - b._y); }; // Returns thresholds with default color scale diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx index e299bb0d4b5..9041c15dcfe 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.test.tsx @@ -3,8 +3,8 @@ import { shallow } from 'enzyme'; import { ChartArea } from '../ChartArea'; import { ChartGroup } from './ChartGroup'; -Object.values([true, false]).forEach(isRead => { - test(`ChartGroup`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartGroup', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx index 08bdfad5c81..3c537dfddb8 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/ChartGroup.tsx @@ -20,12 +20,12 @@ import { } from 'victory'; import { ChartThemeDefinition } from '../ChartTheme'; import { getTheme } from '../ChartUtils'; -import {ChartContainer} from "../ChartContainer"; +import {ChartContainer} from '../ChartContainer'; export enum ChartGroupSortOrder { ascending = 'ascending', descending = 'descending' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -172,7 +172,7 @@ export interface ChartGroupProps extends VictoryGroupProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', 'all'>[]; /** * ChartGroup uses the standard externalEventMutations prop. */ @@ -286,7 +286,7 @@ export interface ChartGroupProps extends VictoryGroupProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The samples prop specifies how many individual points to plot when plotting * y as a function of x. Samples is ignored if x props are provided instead. @@ -403,7 +403,7 @@ export interface ChartGroupProps extends VictoryGroupProps { * @example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"] */ y0?: DataGetterPropType; -}; +} export const ChartGroup: React.FunctionComponent = ({ allowZoom = false, diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx index da3d25043ca..9972c4be9c2 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartLabel } from './ChartLabel'; -Object.values([true, false]).forEach(isRead => { - test(`ChartLabel`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartLabel', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx index 2030449bd69..e44899e124b 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx @@ -12,13 +12,13 @@ export enum ChartLabelDirection { rtl = 'rtl', ltr = 'ltr', inherit = 'inherit' -}; +} export enum ChartLabelPlacement { parallel = 'parallel', perpendicular = 'perpendicular', vertical = 'vertical' -}; +} type TextAnchorType = 'start' | 'middle' | 'end' | 'inherit'; @@ -164,7 +164,7 @@ export interface ChartLabelProps extends VictoryLabelProps { * The y prop defines the y coordinate to use as a basis for vertical positioning. */ y?: number; -}; +} export const ChartLabel: React.FunctionComponent = ({ style, @@ -177,7 +177,7 @@ export const ChartLabel: React.FunctionComponent = ({ }); const newStyle = Array.isArray(style) ? style.map(applyDefaultStyle) : applyDefaultStyle(style); return ; -} +}; // Note: VictoryLabel.role must be hoisted hoistNonReactStatics(ChartLabel, VictoryLabel); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx index 4c6ab94dc49..9d4f6660e4b 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartLegend } from './ChartLegend'; -Object.values([true, false]).forEach(isRead => { - test(`ChartLegend`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartLegend', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx index ddfe307c63c..281b879a0d4 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegend.tsx @@ -20,18 +20,18 @@ import { getTheme } from '../ChartUtils'; export enum ChartLegendOrientation { horizontal = 'horizontal', vertical = 'vertical' -}; +} export enum ChartLegendPosition { bottom = 'bottom', bottomLeft = 'bottom-left', right = 'right' -}; +} export enum ChartLegendRowGutter { bottom = 'bottom', top = 'top' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -97,13 +97,13 @@ export interface ChartLegendProps extends VictoryLegendProps { * array of objects with name (required), symbol, and labels properties. * The data prop must be given as an array. */ - data?: Array<{ + data?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * The dataComponent prop takes a component instance which will be * responsible for rendering a data element used to associate a symbol @@ -124,7 +124,7 @@ export interface ChartLegendProps extends VictoryLegendProps { /** * ChartLegend uses the standard events prop. */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback>[]; /** * ChartLegend uses the standard externalEventMutations prop. */ diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx index 59989df80f1..f494c462fce 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/ChartLegendWrapper.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; -import { ChartLegendOrientation, ChartLegendPosition } from "../ChartLegend"; +import { ChartLegendOrientation, ChartLegendPosition } from '../ChartLegend'; import { ChartCommonStyles, ChartThemeDefinition } from '../ChartTheme'; -import { getLegendX, getLegendY, getTheme } from "../ChartUtils"; +import { getLegendX, getLegendY, getTheme } from '../ChartUtils'; export enum ChartLegendConfigChartType { chart = 'chart', pie = 'pie' -}; +} /** * Helper to position a legend component within a component's SVG diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx index cc51b67156d..d1f9ec35543 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.test.tsx @@ -4,8 +4,8 @@ import { Chart } from '../Chart'; import { ChartGroup } from '../ChartGroup'; import { ChartLine } from './ChartLine'; -Object.values([true, false]).forEach(isRead => { - test(`ChartLine`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartLine', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx index a8ebe3a7396..0b50507a9a8 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLine/ChartLine.tsx @@ -22,7 +22,7 @@ import { getTheme } from '../ChartUtils'; export enum ChartLineSortOrder { ascending = 'ascending', descending = 'descending' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -140,7 +140,7 @@ export interface ChartLineProps extends VictoryLineProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', number | string>[]; /** * ChartLine uses the standard externalEventMutations prop. */ @@ -251,7 +251,7 @@ export interface ChartLineProps extends VictoryLineProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The samples prop specifies how many individual points to plot when plotting * y as a function of x. Samples is ignored if x props are provided instead. @@ -371,7 +371,7 @@ export interface ChartLineProps extends VictoryLineProps { * @example 'last_quarter_profit', () => 10, 1, 'employees.salary', ["employees", "salary"] */ y0?: DataGetterPropType; -}; +} export const ChartLine: React.FunctionComponent = ({ themeColor, diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx index 5378bd28bb2..3bc3ff60c17 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.test.tsx @@ -2,8 +2,8 @@ import * as React from 'react'; import { shallow } from 'enzyme'; import { ChartPie } from './ChartPie'; -Object.values([true, false]).forEach(isRead => { - test(`ChartPie`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartPie', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx index c9b1fd59f62..2e4aae67ecc 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/ChartPie.tsx @@ -22,17 +22,17 @@ export enum ChartPieLabelPosition { centroid = 'centroid', endAngle = 'endAngle', startAngle = 'startAngle' -}; +} export enum ChartPieLegendPosition { bottom = 'bottom', right = 'right' -}; +} export enum ChartPieSortOrder { ascending = 'ascending', descending = 'descending' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -170,7 +170,7 @@ export interface ChartPieProps extends VictoryPieProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback | string[] | number[]>[]; /** * ChartPie uses the standard externalEventMutations prop. */ @@ -249,13 +249,13 @@ export interface ChartPieProps extends VictoryPieProps { * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ - legendData?: Array<{ + legendData?: { name?: string; symbol?: { fill?: string; type?: string; }; - }>; + }[]; /** * Defines a horizontal shift from the x coordinate. It should not be set manually. */ @@ -526,7 +526,7 @@ export const ChartPie: React.FunctionComponent = ({ {getWrappedLegend()} ); -} +}; // Note: VictoryPie.role must be hoisted hoistNonReactStatics(ChartPie, VictoryPie); diff --git a/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx index d767bcb9e13..cbb16660766 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartPoint/ChartPoint.test.tsx @@ -3,8 +3,8 @@ import { shallow } from 'enzyme'; import { ChartLegend } from '../ChartLegend'; import { ChartPoint } from './ChartPoint'; -Object.values([true, false]).forEach(isRead => { - test(`ChartPoint`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartPoint', () => { const view = shallow(} />); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts b/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts index 4156507f817..f1ced8fe8f4 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartPoint/path-helpers.ts @@ -89,7 +89,7 @@ export const PathHelpers = { const baseSize = 1.35 * size; const angle = Math.PI / 5; const range = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - const starCoords = range.map(index => { + const starCoords = range.map((index) => { const length = index % 2 === 0 ? baseSize : baseSize / 2; return `${length * Math.sin(angle * (index + 1)) + x}, ${length * Math.cos(angle * (index + 1)) + y}`; diff --git a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx index 2421b61497c..c6175d6e2f3 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.test.tsx @@ -4,8 +4,8 @@ import { Chart } from '../Chart/Chart'; import { ChartGroup } from '../ChartGroup/ChartGroup'; import { ChartScatter } from './ChartScatter'; -Object.values([true, false]).forEach(isRead => { - test(`ChartScatter`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartScatter', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx index 434ac68820f..a4277a0a24e 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartScatter/ChartScatter.tsx @@ -22,7 +22,7 @@ import { getTheme } from '../ChartUtils'; export enum ChartScatterSortOrder { ascending = 'ascending', descending = 'descending' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -145,7 +145,7 @@ export interface ChartScatterProps extends VictoryScatterProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback>[]; /** * ChartScatter uses the standard externalEventMutations prop. */ @@ -260,7 +260,7 @@ export interface ChartScatterProps extends VictoryScatterProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The samples prop specifies how many individual points to plot when plotting * y as a function of x. Samples is ignored if x props are provided instead. diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx index 2bc1b689830..96ebbf158ac 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.test.tsx @@ -4,8 +4,8 @@ import { Chart } from '../Chart'; import { ChartBar } from '../ChartBar'; import { ChartStack } from './ChartStack'; -Object.values([true, false]).forEach(isRead => { - test(`ChartStack`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartStack', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx index 3eb38af205e..783207ad5ea 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartStack/ChartStack.tsx @@ -136,7 +136,7 @@ export interface ChartStackProps extends VictoryStackProps { * } * ]} */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + events?: EventPropTypeInterface<'data' | 'labels' | 'parent', StringOrNumberOrCallback>[]; /** * ChartStack uses the standard externalEventMutations prop. */ @@ -243,7 +243,7 @@ export interface ChartStackProps extends VictoryStackProps { * Cartesian: range={{ x: [50, 250], y: [50, 250] }} * Polar: range={{ x: [0, 360], y: [0, 250] }} */ - range?: [number, number] | { x?: [number, number], y?: [number, number] } + range?: [number, number] | { x?: [number, number], y?: [number, number] }; /** * The scale prop determines which scales your chart should use. This prop can be * given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), diff --git a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx index a4ed9c26dcf..95b74833919 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartTooltip/ChartTooltip.test.tsx @@ -5,8 +5,8 @@ import { ChartGroup } from '../ChartGroup'; import { ChartVoronoiContainer } from '../ChartVoronoiContainer'; import { ChartTooltip } from './ChartTooltip'; -Object.values([true, false]).forEach(isRead => { - test(`ChartTooltip`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartTooltip', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); @@ -15,7 +15,7 @@ Object.values([true, false]).forEach(isRead => { test('allows tooltip via container component', () => { const view = shallow( "y: " + point.y} />} + containerComponent={ 'y: ' + point.y} />} height={200} width={200} > diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts index 501da9a2db8..109eb724110 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-domain.ts @@ -1,6 +1,6 @@ -import * as React from "react"; +import * as React from 'react'; import { DataGetterPropType } from 'victory'; -import { Data } from "victory-core"; +import { Data } from 'victory-core'; interface DomainInterface { data?: any; @@ -19,7 +19,7 @@ interface SourcesInterface { }[]; } -export type ChartDomain = {x: [number, number], y: [number, number]}; +export interface ChartDomain {x: [number, number], y: [number, number]} // Returns the min and max domain for given data export const getDomain = ({ @@ -102,7 +102,7 @@ export const getDomains = ({ sources }: SourcesInterface): ChartDomain => { const domains: ChartDomain[] = []; - sources.forEach(source => { + sources.forEach((source) => { const {data: compData = source.data} = source.component ? source.component.props : undefined; const domain = getDomain({ data: compData, diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts index 69bc0ffd23a..019011e1aa3 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts @@ -1,5 +1,5 @@ import {ChartCommonStyles, ChartThemeDefinition} from '../ChartTheme'; -import { TextSize } from "victory-core"; +import { TextSize } from 'victory-core'; interface ChartLabelPaddingXInterface { dx?: number; // Horizontal shift from the x coordinate diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts index 03d47437683..434e849df78 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts @@ -1,9 +1,9 @@ import { VictoryLegend } from 'victory'; -import { TextSize } from "victory-core"; +import { TextSize } from 'victory-core'; import { ChartLegendProps } from '../ChartLegend'; import { ChartCommonStyles, ChartThemeDefinition } from '../ChartTheme'; import { overpassFontCharacterConstant } from './chart-label'; -import { getPaddingForSide } from "./chart-padding"; +import { getPaddingForSide } from './chart-padding'; interface ChartLegendPaddingXInterface { chartWidth: number; // Width of chart (e.g., donut) within SVG @@ -56,7 +56,7 @@ export const getLegendDimensions = ({ }); } return {}; -} +}; // Returns x coordinate for legend export const getLegendX = ({ @@ -154,7 +154,7 @@ const getTextSizeWorkAround = ({ // For vertical legends, account for the growing char count of the longest legend item if (legendOrientation === 'vertical') { - legendData.forEach(data => { + legendData.forEach((data) => { if (data.name && data.name.length > result.length) { result = data.name; } diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts index eada3a8a6b1..a10859d6522 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-padding.ts @@ -11,4 +11,4 @@ export const getPaddingForSide = (side: 'bottom' | 'left' | 'right' | 'top', pad } return getPaddingForSide(side, fallback, 0); -} +}; diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts index 443c792d3b9..8d9068f2fb5 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts @@ -46,10 +46,10 @@ export const getCustomTheme = (themeColor: string, themeVariant: string, customT merge(getTheme(themeColor, themeVariant), customTheme); // Returns axis theme -export const getAxisTheme = (themeColor: string, themeVariant: string) : ChartThemeDefinition => { +export const getAxisTheme = (themeColor: string, themeVariant: string): ChartThemeDefinition => { const theme = getCustomTheme(themeColor, themeVariant, ChartAxisTheme); return theme; -} +}; // Returns bullet chart theme export const getBulletTheme = (themeColor: string, themeVariant: string): ChartThemeDefinition => diff --git a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx index 45b906b5a50..08625ba985f 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoContainer.test.tsx @@ -4,8 +4,8 @@ import { ChartArea } from '../ChartArea'; import { ChartGroup } from '../ChartGroup'; import { ChartVoronoiContainer } from './ChartVoronoiContainer'; -Object.values([true, false]).forEach(isRead => { - test(`ChartVoronoiContainer`, () => { +Object.values([true, false]).forEach((isRead) => { + test('ChartVoronoiContainer', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx index 539aed72a02..b2ab3ea24c1 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/ChartVoronoiContainer.tsx @@ -11,7 +11,7 @@ import { getTheme } from '../ChartUtils'; export enum ChartVoronoiDimension { x = 'x', y = 'y' -}; +} /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts @@ -105,7 +105,7 @@ export interface ChartVoronoiContainerProps extends VictoryVoronoiContainerProps * position will be activated regardless of y value. When this prop is not given, voronoi selection * is determined by both x any y values. */ - voronoiDimension?: "x" | "y"; + voronoiDimension?: 'x' | 'y'; /** * When the voronoiPadding prop is given, the area of the chart that will trigger voronoi events is * reduced by the given padding on every side. By default, no padding is applied, and the entire range @@ -127,7 +127,7 @@ export const ChartVoronoiContainer: React.FunctionComponent; -} +}; ChartVoronoiContainer.defaultProps = (VictoryVoronoiContainer as any).defaultProps; // Note: VictoryVoronoiContainer.defaultEvents & VictoryContainer.role must be hoisted diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx index 0943cce4bbf..d54cb7ef581 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.test.tsx @@ -8,7 +8,7 @@ const mockListener = jest.spyOn(ReactDOM, 'createPortal'); jest.spyOn(document, 'createElement'); jest.spyOn(document, 'addEventListener'); -mockListener.mockImplementation(node => node as React.ReactPortal); +mockListener.mockImplementation((node) => node as React.ReactPortal); const props = { onClose: jest.fn(), diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx index 13adac7953f..ed04397bccb 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModal.tsx @@ -27,7 +27,7 @@ export interface AboutModalProps { backgroundImageSrc?: string; /** Prevents the about modal from rendering content inside a container; allows for more flexible layouts */ noAboutModalBoxContentContainer?: boolean; -}; +} interface ModalState { container: HTMLElement; @@ -66,7 +66,7 @@ export class AboutModal extends React.Component { if (event.keyCode === KEY_CODES.ESCAPE_KEY && this.props.isOpen) { this.props.onClose(); } - }; + } toggleSiblingsFromScreenReaders = (hide: boolean) => { const bodyChildren = document.body.children; @@ -75,7 +75,7 @@ export class AboutModal extends React.Component { hide ? child.setAttribute('aria-hidden', '' + hide) : child.removeAttribute('aria-hidden'); } } - }; + } componentDidMount() { const container = document.createElement('div'); diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBox.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBox.tsx index 11f67fe9488..c626bd35084 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBox.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBox.tsx @@ -7,7 +7,7 @@ export interface AboutModalBoxProps extends React.HTMLProps { children: React.ReactNode; /** additional classes added to the AboutModalBox */ className?: string; -}; +} export const AboutModalBox: React.SFC = ({ children, diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxBrand.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxBrand.tsx index 524e6ca09f7..17a32182efa 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxBrand.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxBrand.tsx @@ -9,7 +9,7 @@ export interface AboutModalBoxBrandProps extends React.HTMLProps src?: string; /** the alternate text of the Brand image. */ alt: string; -}; +} export const AboutModalBoxBrand: React.SFC = ({ className = '', diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx index aea0ba56826..7049709da3f 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxCloseButton.tsx @@ -9,7 +9,7 @@ export interface AboutModalBoxCloseButtonProps extends React.HTMLProps void; -}; +} export const AboutModalBoxCloseButton: React.SFC = ({ className = '', diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx index 82ed0e6fcd3..4201d246d6c 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxContent.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/AboutModalBox/about-modal-box'; -import titleStyles from '@patternfly/react-styles/css/components/Title/title'; import contentStyles from '@patternfly/react-styles/css/components/Content/content'; export interface AboutModalBoxContentProps extends React.HTMLProps { @@ -15,7 +14,7 @@ export interface AboutModalBoxContentProps extends React.HTMLProps = ({ children, diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx index 790b2184042..f185ac5d9bc 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalBoxHero.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { css } from '@patternfly/react-styles'; import styles from '@patternfly/react-styles/css/components/AboutModalBox/about-modal-box'; -import { c_about_modal_box__hero_sm_BackgroundImage } from '@patternfly/react-tokens' +import { c_about_modal_box__hero_sm_BackgroundImage } from '@patternfly/react-tokens'; export interface AboutModalBoxHeroProps extends React.HTMLProps { /** additional classes added to the About Modal Hero */ diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx index c33e9470f38..30554b11685 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx @@ -37,7 +37,7 @@ export interface AboutModalContainerProps extends React.HTMLProps = ({ children, diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx b/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx index 7b7571615f7..9dcbd9b272b 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx @@ -6,11 +6,11 @@ import { AlertActionLink } from './AlertActionLink'; import { AlertActionCloseButton } from './AlertActionCloseButton'; test('default Alert variant is info', () => { - const view = shallow(Alert testing) + const view = shallow(Alert testing); expect(view.props().className).toMatch(/pf-m-info/); -}) +}); -Object.values(AlertVariant).forEach(variant => { +Object.values(AlertVariant).forEach((variant) => { describe(`Alert - ${variant}`, () => { test('Description', () => { const view = mount( diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx b/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx index c605c717485..eb3c03e93b8 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx @@ -29,10 +29,10 @@ export interface AlertProps /** Additional classes added to the Alert */ className?: string; /** Adds accessible text to the Alert */ - 'aria-label'?: string, + 'aria-label'?: string; /** Variant label text for screen readers */ variantLabel?: string; -}; +} export const Alert: React.FunctionComponent = ({ variant = AlertVariant.info, diff --git a/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.tsx b/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.tsx index 6334fe03c2f..9ea591a73e4 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/AlertActionCloseButton.tsx @@ -11,7 +11,7 @@ interface AlertActionCloseButtonProps extends ButtonProps { 'aria-label'?: string; /** Variant Label for the Close button */ variantLabel?: string; -}; +} export const AlertActionCloseButton = ({ className = '', diff --git a/packages/patternfly-4/react-core/src/components/Alert/AlertActionLink.tsx b/packages/patternfly-4/react-core/src/components/Alert/AlertActionLink.tsx index 43f62bd3bd8..1daeeacf6fc 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/AlertActionLink.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/AlertActionLink.tsx @@ -6,7 +6,7 @@ export interface AlertActionLinkProps extends ButtonProps { children?: string; /** Additional classes added to the AlertActionLink */ className?: string; -}; +} export const AlertActionLink: React.FunctionComponent = ({ className = '', diff --git a/packages/patternfly-4/react-core/src/components/Alert/AlertIcon.tsx b/packages/patternfly-4/react-core/src/components/Alert/AlertIcon.tsx index 83e959d3cfb..24fae539106 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/AlertIcon.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/AlertIcon.tsx @@ -22,7 +22,7 @@ export interface AlertIconProps extends React.HTMLProps { variant: 'success' | 'danger' | 'warning' | 'info' | 'default'; /** className */ className?: string; -}; +} export const AlertIcon = ({ variant, diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx index 07dc4d58bab..be2d66100b4 100644 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx @@ -33,23 +33,23 @@ export interface ApplicationLauncherProps extends React.HTMLProps { static defaultProps = { - className: '', - isDisabled: false, - direction: DropdownDirection.down, - dropdownItems: [] as React.ReactNode[], - items: [] as React.ReactNode[], - isOpen: false, - position: DropdownPosition.left, - onSelect: (_event: any): any => undefined, - onToggle: (_value: boolean): any => undefined, + "className": '', + "isDisabled": false, + "direction": DropdownDirection.down, + "dropdownItems": [] as React.ReactNode[], + "items": [] as React.ReactNode[], + "isOpen": false, + "position": DropdownPosition.left, + "onSelect": (_event: any): any => undefined, + "onToggle": (_value: boolean): any => undefined, 'aria-label': 'Application launcher', - isGrouped: false, - toggleIcon: + "isGrouped": false, + "toggleIcon": }; render() { const { diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherItem.tsx b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherItem.tsx index 1a64829ec6e..49fc2480c22 100644 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherItem.tsx +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherItem.tsx @@ -28,7 +28,7 @@ export const ApplicationLauncherItem: React.FunctionComponent ( - { /** content rendered inside the backdrop */ - children?: React.ReactNode; + children?: React.ReactNode; /** additional classes added to the button */ - className?: string; + className?: string; } export const Backdrop: React.FunctionComponent = ({ - children = null, - className = '', + children = null, + className = '', ...props }: BackdropProps) => (
{children}
-) \ No newline at end of file +); diff --git a/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.test.tsx b/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.test.tsx index 1038a53f6b0..f6a0f1fe5c8 100644 --- a/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.test.tsx +++ b/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.test.tsx @@ -11,8 +11,8 @@ const images = { [BackgroundImageSrc.filter]: '/assets/images/background-filter.svg' }; -Object.values([true, false]).forEach(isRead => { - test(`BackgroundImage`, () => { +Object.values([true, false]).forEach((isRead) => { + test('BackgroundImage', () => { const view = shallow(); expect(view).toMatchSnapshot(); }); diff --git a/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.tsx b/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.tsx index c3c66605642..485de49a518 100644 --- a/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.tsx +++ b/packages/patternfly-4/react-core/src/components/BackgroundImage/BackgroundImage.tsx @@ -20,7 +20,7 @@ export enum BackgroundImageSrc { sm2x = 'sm2x', lg = 'lg', filter = 'filter' -}; +} const cssVariables = { [BackgroundImageSrc.xs]: c_background_image_BackgroundImage && c_background_image_BackgroundImage.name, @@ -31,23 +31,23 @@ const cssVariables = { }; export interface BackgroundImageSrcMap { - xs: string, - xs2x: string, - sm: string, - sm2x: string, - lg: string, - filter?: string -}; + xs: string; + xs2x: string; + sm: string; + sm2x: string; + lg: string; + filter?: string; +} export interface BackgroundImageProps extends Omit, 'src'> { /** Additional classes added to the background. */ - className?: string; + className?: string; /** Override image styles using a string or BackgroundImageSrc */ - src: string | BackgroundImageSrcMap; -}; + src: string | BackgroundImageSrcMap; +} export const BackgroundImage: React.FunctionComponent = ({ - className = '', + className = '', src, ...props }: BackgroundImageProps) => { @@ -66,8 +66,8 @@ export const BackgroundImage: React.FunctionComponent = ({ // Build stylesheet string based on cssVariables let cssSheet = ''; - (Object.keys(cssVariables) as [keyof typeof srcMap]).forEach(size => { - cssSheet += `${cssVariables[size as keyof typeof cssVariables]}: url('${srcMap[size]}');` + (Object.keys(cssVariables) as [keyof typeof srcMap]).forEach((size) => { + cssSheet += `${cssVariables[size as keyof typeof cssVariables]}: url('${srcMap[size]}');`; }); // Create emotion stylesheet to inject new css @@ -75,7 +75,7 @@ export const BackgroundImage: React.FunctionComponent = ({ bgOverrides: `&.pf-c-background-image { ${cssSheet} }`}); - + return (
diff --git a/packages/patternfly-4/react-core/src/components/Badge/Badge.test.tsx b/packages/patternfly-4/react-core/src/components/Badge/Badge.test.tsx index 2ff701a3bc7..76bc21cc498 100644 --- a/packages/patternfly-4/react-core/src/components/Badge/Badge.test.tsx +++ b/packages/patternfly-4/react-core/src/components/Badge/Badge.test.tsx @@ -2,7 +2,7 @@ import { Badge } from './Badge'; import React from 'react'; import { shallow } from 'enzyme'; -Object.values([true, false]).forEach(isRead => { +Object.values([true, false]).forEach((isRead) => { test(`${isRead} Badge`, () => { const view = shallow({isRead ? 'read' : 'unread'} Badge); expect(view).toMatchSnapshot(); diff --git a/packages/patternfly-4/react-core/src/components/Badge/Badge.tsx b/packages/patternfly-4/react-core/src/components/Badge/Badge.tsx index 8909e8d51a6..7f6f9e14ce6 100644 --- a/packages/patternfly-4/react-core/src/components/Badge/Badge.tsx +++ b/packages/patternfly-4/react-core/src/components/Badge/Badge.tsx @@ -11,12 +11,12 @@ export interface BadgeProps extends React.HTMLProps { className?: string; } -export const Badge: React.FunctionComponent = ({ - isRead = false, - className = '', - children = '', +export const Badge: React.FunctionComponent = ({ + isRead = false, + className = '', + children = '', ...props }: BadgeProps) => ( {children} -); \ No newline at end of file +); diff --git a/packages/patternfly-4/react-core/src/components/Brand/Brand.tsx b/packages/patternfly-4/react-core/src/components/Brand/Brand.tsx index 113052924d1..d65a1153783 100644 --- a/packages/patternfly-4/react-core/src/components/Brand/Brand.tsx +++ b/packages/patternfly-4/react-core/src/components/Brand/Brand.tsx @@ -3,7 +3,7 @@ import { css } from '@patternfly/react-styles'; export interface BrandProps extends React.DetailedHTMLProps, HTMLImageElement> { /** Additional classes added to the Brand. */ - className?: string; + className?: string; /** Attribute that specifies the URL of the image for the Brand. */ src?: string; /** Attribute that specifies the alt text of the image for the Brand. */ @@ -11,11 +11,11 @@ export interface BrandProps extends React.DetailedHTMLProps = ({ - className = '', - src = '', + className = '', + src = '', alt, ...props }) => ( /** the brand component currently contains no styling the 'pf-c-brand' string will be used for the className */ {alt} -); \ No newline at end of file +); diff --git a/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbHeading.tsx b/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbHeading.tsx index 0ca64aa6073..45ac36fbc4d 100644 --- a/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbHeading.tsx +++ b/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbHeading.tsx @@ -41,4 +41,4 @@ export const BreadcrumbHeading: React.FunctionComponent ); -} \ No newline at end of file +}; diff --git a/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx b/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx index 3f4188a47ed..4bf2af2c4b3 100644 --- a/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx +++ b/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx @@ -48,4 +48,4 @@ export const BreadcrumbItem: React.FunctionComponent = ({ )} ); -} \ No newline at end of file +}; diff --git a/packages/patternfly-4/react-core/src/components/Button/Button.test.tsx b/packages/patternfly-4/react-core/src/components/Button/Button.test.tsx index 115e917e3ec..cbfa89b5fd2 100644 --- a/packages/patternfly-4/react-core/src/components/Button/Button.test.tsx +++ b/packages/patternfly-4/react-core/src/components/Button/Button.test.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { mount } from 'enzyme'; import { CartArrowDownIcon } from '@patternfly/react-icons'; -Object.values(ButtonVariant).forEach(variant => { +Object.values(ButtonVariant).forEach((variant) => { test(`${variant} button`, () => { const view = mount( ); }; - diff --git a/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroup.tsx b/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroup.tsx index 9e855562cc4..942e63df089 100644 --- a/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroup.tsx +++ b/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroup.tsx @@ -10,7 +10,7 @@ export interface ChipGroupProps extends React.HTMLProps { /** Content rendered inside the chip text */ children?: React.ReactNode; /** Additional classes added to the chip item */ - className?: string; + className?: string; /** Flag for having the chip group default to expanded */ defaultIsOpen?: boolean; /** Customizable "Show Less" text string */ @@ -27,27 +27,27 @@ interface ChipGroupState { isOpen: boolean; } -export class ChipGroup extends React.Component{ +export class ChipGroup extends React.Component { constructor(props: ChipGroupProps) { - super(props); + super(props); this.state = { isOpen: this.props.defaultIsOpen - } + }; } - + static defaultProps = { className: '', expandedText: 'Show Less', collapsedText: '${remaining} more', withToolbar: false, defaultIsOpen: false - } + }; toggleCollapse = () => { - this.setState(prevState => ({ + this.setState((prevState) => ({ isOpen: !prevState.isOpen })); - }; + } renderToolbarGroup() { const { isOpen } = this.state; @@ -87,7 +87,7 @@ const InnerChipGroup = (props: InnerChipGroupProps) => { const { children, expandedText, isOpen, onToggleCollapse, collapsedText, withToolbar } = props; const collapsedTextResult = fillTemplate(collapsedText as string, { remaining: React.Children.count(children) - 1 }); - const mappedChildren = React.Children.map(children, c => { + const mappedChildren = React.Children.map(children, (c) => { const child = c as React.ReactElement; if (withToolbar) { return React.cloneElement(child, { @@ -107,7 +107,7 @@ const InnerChipGroup = (props: InnerChipGroupProps) => { ) : ( {mappedChildren.map((child, i) => { - if (i === 0) { + if (i === 0) { return child; } })} @@ -121,4 +121,3 @@ const InnerChipGroup = (props: InnerChipGroupProps) => { ); }; - diff --git a/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroupToolbarItem.tsx b/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroupToolbarItem.tsx index 607da717089..97d6136a3a9 100644 --- a/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroupToolbarItem.tsx +++ b/packages/patternfly-4/react-core/src/components/ChipGroup/ChipGroupToolbarItem.tsx @@ -4,7 +4,7 @@ import styles from '@patternfly/react-styles/css/components/ChipGroup/chip-group import {ChipGroupContext} from './ChipGroup'; export interface ChipGroupToolbarItemProps extends React.HTMLProps { - /** Category name text */ + /** Category name text */ categoryName?: string; /** Content rendered inside the chip text */ children: React.ReactNode; @@ -13,9 +13,9 @@ export interface ChipGroupToolbarItemProps extends React.HTMLProps = ({ - categoryName = '', - children = null, - className = '', + categoryName = '', + children = null, + className = '', ...props }: ChipGroupToolbarItemProps) => { if (React.Children.count(children)) { @@ -35,4 +35,4 @@ export const ChipGroupToolbarItem: React.FunctionComponent /** Flag to show if the input is read only. */ isReadOnly?: boolean; /** Adds Clipboard Copy variant styles. */ - variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion'; + variant?: typeof ClipboardCopyVariant | 'inline' | 'expansion'; /** Copy button popover position. */ position?: OneOf; /** Maximum width of the tooltip (default 150px). */ @@ -79,7 +79,7 @@ export class ClipboardCopy extends React.Component undefined, textAriaLabel: 'Copyable input', toggleAriaLabel: 'Show content' - } - + }; + expandContent = (_event: React.MouseEvent) => { - this.setState(prevState => ({ + this.setState((prevState) => ({ expanded: !prevState.expanded })); - }; + } updateText = (text: string | number) => { this.setState({ text }); this.props.onChange(text); - }; + } render = () => { const { @@ -129,7 +129,7 @@ export class ClipboardCopy extends React.Component - {id => ( + {(id) => (
{variant === 'expansion' && ( diff --git a/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.test.tsx b/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.test.tsx index f8458f87210..617be02d754 100644 --- a/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.test.tsx +++ b/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.test.tsx @@ -3,14 +3,14 @@ import { shallow } from 'enzyme'; import { ClipboardCopyButton } from './ClipboardCopyButton'; const props = { - id: 'my-id', - textId: 'my-text-id', - className: 'fancy-copy-button', - onClick: jest.fn(), - exitDelay: 1000, - entryDelay: 2000, - maxWidth: '500px', - position: 'right' as 'right', + "id": 'my-id', + "textId": 'my-text-id', + "className": 'fancy-copy-button', + "onClick": jest.fn(), + "exitDelay": 1000, + "entryDelay": 2000, + "maxWidth": '500px', + "position": 'right' as 'right', 'aria-label': 'click this button to copy text' }; diff --git a/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.tsx b/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.tsx index 0e6495f9017..603755ab12d 100644 --- a/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.tsx +++ b/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyButton.tsx @@ -5,16 +5,16 @@ import { CopyIcon } from '@patternfly/react-icons'; import { Tooltip } from '../Tooltip'; export interface ClipboardCopyButtonProps extends React.DetailedHTMLProps, HTMLButtonElement> { - onClick: (event: React.MouseEvent) => void; - children: React.ReactNode; - id: string; - textId: string; - className?: string; - exitDelay?: number; - entryDelay?: number; - maxWidth?: string; - position?: 'auto' | 'top' | 'bottom' | 'left' | 'right'; - 'aria-label'?: string; + onClick: (event: React.MouseEvent) => void; + children: React.ReactNode; + id: string; + textId: string; + className?: string; + exitDelay?: number; + entryDelay?: number; + maxWidth?: string; + position?: 'auto' | 'top' | 'bottom' | 'left' | 'right'; + 'aria-label'?: string; } export const ClipboardCopyButton: React.FunctionComponent = ({ @@ -25,7 +25,7 @@ export const ClipboardCopyButton: React.FunctionComponent { - className?: string; - children: React.ReactNode; - onChange?: (text: string, e: React.FormEvent) => void; - isReadOnly: boolean; + className?: string; + children: React.ReactNode; + onChange?: (text: string, e: React.FormEvent) => void; + isReadOnly: boolean; } export class ClipboardCopyExpanded extends React.Component { @@ -18,10 +18,10 @@ export class ClipboardCopyExpanded extends React.Component undefined, - className: '', - isReadOnly: false - } + onChange: (): any => undefined, + className: '', + isReadOnly: false + }; componentDidMount() { if (this.contentRef.current) { @@ -36,7 +36,7 @@ export class ClipboardCopyExpanded extends React.Component onChange(e.target.innerText, e)} + onInput={(e: any) => onChange(e.target.innerText, e)} contentEditable={!isReadOnly} {...props} /> diff --git a/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyToggle.tsx b/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyToggle.tsx index ec142535fac..675f5045073 100644 --- a/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyToggle.tsx +++ b/packages/patternfly-4/react-core/src/components/ClipboardCopy/ClipboardCopyToggle.tsx @@ -4,21 +4,21 @@ import { css } from '@patternfly/react-styles'; import { AngleRightIcon } from '@patternfly/react-icons'; export interface ClipboardCopyToggleProps extends React.DetailedHTMLProps, HTMLButtonElement> { - onClick: (event: React.MouseEvent) => void; - id: string; - textId: string; - contentId: string; - isExpanded?: boolean; - className?: string; + onClick: (event: React.MouseEvent) => void; + id: string; + textId: string; + contentId: string; + isExpanded?: boolean; + className?: string; } export const ClipboardCopyToggle: React.FunctionComponent = ({ - onClick, + onClick, className = '', - id, - textId, + id, + textId, contentId, - isExpanded = false, + isExpanded = false, ...props }: ClipboardCopyToggleProps) => { return ( @@ -33,5 +33,5 @@ export const ClipboardCopyToggle: React.FunctionComponent
- ) + ); } } diff --git a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackColorZoomDemo.tsx b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackColorZoomDemo.tsx index 12d0f575784..ee861632de0 100644 --- a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackColorZoomDemo.tsx +++ b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackColorZoomDemo.tsx @@ -36,6 +36,6 @@ export class StackColorZoomDemo extends React.Component {
- ) + ); } } diff --git a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackGoldBottomLegendDemo.tsx b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackGoldBottomLegendDemo.tsx index 15c4317bace..307a52f693d 100644 --- a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackGoldBottomLegendDemo.tsx +++ b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackChartDemo/StackGoldBottomLegendDemo.tsx @@ -37,6 +37,6 @@ export class StackGoldBottomLegendDemo extends React.Component { - ) + ); } } diff --git a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackDemo/StackDemo.tsx b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackDemo/StackDemo.tsx index 374044c43f2..de70531aec9 100644 --- a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackDemo/StackDemo.tsx +++ b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/StackDemo/StackDemo.tsx @@ -13,6 +13,6 @@ export class StackDemo extends Component { content - ) + ); } } diff --git a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/SwitchDemo/SwitchDemo.tsx b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/SwitchDemo/SwitchDemo.tsx index d3adec5bdca..5ba8f36d922 100644 --- a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/SwitchDemo/SwitchDemo.tsx +++ b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/SwitchDemo/SwitchDemo.tsx @@ -2,17 +2,16 @@ import React from 'react'; import { Switch } from '@patternfly/react-core'; interface SwitchState { - isChecked: boolean -}; + isChecked: boolean; +} export class SwitchDemo extends React.Component<{}, SwitchState> { state = { isChecked: true }; - handleChange = isChecked => { + handleChange = (isChecked) => { this.setState({ isChecked }); - }; - + } render() { const { isChecked } = this.state; @@ -24,10 +23,10 @@ export class SwitchDemo extends React.Component<{}, SwitchState> { onChange={this.handleChange} aria-label="Switch" isChecked={isChecked} - /> + />
); } -} \ No newline at end of file +} diff --git a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/TabsDemo/TabsDemo.tsx b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/TabsDemo/TabsDemo.tsx index 92384bbc4cc..70398e5425a 100644 --- a/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/TabsDemo/TabsDemo.tsx +++ b/packages/patternfly-4/react-integration/demo-app-ts/src/components/demos/TabsDemo/TabsDemo.tsx @@ -4,7 +4,7 @@ import React, { Component } from 'react'; export class TabDemo extends Component { state = { activeTabKey: 0 - } + }; private contentRef1: any; private contentRef2: any; private contentRef3: any; @@ -22,7 +22,7 @@ export class TabDemo extends Component { this.setState({ activeTabKey: tabIndex }); - }; + } componentDidMount() { window.scrollTo(0, 0); @@ -37,7 +37,7 @@ export class TabDemo extends Component {
- console.log(event)}> + console.log(event)}> Tab 1 section