Skip to content

Commit

Permalink
chore(deps): update dependency prettier to v2 (react-bootstrap#787)
Browse files Browse the repository at this point in the history
* chore(deps): update dependency prettier to v2

* format

Co-authored-by: Renovate Bot <[email protected]>
Co-authored-by: Jimmy Jia <[email protected]>
  • Loading branch information
3 people authored Mar 22, 2020
1 parent 3ff9c89 commit 071da3e
Show file tree
Hide file tree
Showing 26 changed files with 89 additions and 120 deletions.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { rules, plugins } = require('webpack-atoms');

module.exports = config => {
module.exports = (config) => {
const { env } = process;

config.set({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"karma-webpack": "4.0.2",
"lint-staged": "^10.0.8",
"mocha": "^7.1.0",
"prettier": "^1.19.1",
"prettier": "^2.0.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-transition-group": "^4.3.0",
Expand Down
6 changes: 3 additions & 3 deletions src/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function Dropdown({
const menuElement = menuRef.current;

const setMenu = useCallback(
ref => {
(ref) => {
menuRef.current = ref;
// ensure that a menu set triggers an update for consumers
forceUpdate();
Expand All @@ -133,7 +133,7 @@ function Dropdown({
const focusInDropdown = useRef(false);

const toggle = useCallback(
event => {
(event) => {
onToggle(!show, event);
},
[onToggle, show],
Expand Down Expand Up @@ -218,7 +218,7 @@ function Dropdown({
return items[index];
};

const handleKeyDown = event => {
const handleKeyDown = (event) => {
const { key, target } = event;

// Second only to https://github.com/twbs/bootstrap/blob/8cfbf6933b8a0146ac3fbc369f19e520bd1ebdac/js/src/dropdown.js#L400
Expand Down
2 changes: 1 addition & 1 deletion src/DropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function useDropdownMenu(options = {}) {
hasShownRef.current = true;
}

const handleClose = e => {
const handleClose = (e) => {
if (!context.toggle) return;
context.toggle(false, e);
};
Expand Down
12 changes: 6 additions & 6 deletions src/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import useWaitForDOMRef from './utils/useWaitForDOMRef';
function omitProps(props, propTypes) {
const keys = Object.keys(props);
const newProps = {};
keys.forEach(prop => {
keys.forEach((prop) => {
if (!Object.prototype.hasOwnProperty.call(propTypes, prop)) {
newProps[prop] = props[prop];
}
Expand Down Expand Up @@ -214,7 +214,7 @@ class Modal extends React.Component {
enforceFocus: true,
restoreFocus: true,
onHide: () => {},
renderBackdrop: props => <div {...props} />,
renderBackdrop: (props) => <div {...props} />,
};

state = { exited: !this.props.show };
Expand Down Expand Up @@ -305,11 +305,11 @@ class Modal extends React.Component {
}
};

setDialogRef = ref => {
setDialogRef = (ref) => {
this.dialog = ref;
};

setBackdropRef = ref => {
setBackdropRef = (ref) => {
this.backdrop = ref && ReactDOM.findDOMNode(ref);
};

Expand All @@ -334,7 +334,7 @@ class Modal extends React.Component {
}
};

handleBackdropClick = e => {
handleBackdropClick = (e) => {
if (e.target !== e.currentTarget) {
return;
}
Expand All @@ -348,7 +348,7 @@ class Modal extends React.Component {
}
};

handleDocumentKeyDown = e => {
handleDocumentKeyDown = (e) => {
if (this.props.keyboard && e.keyCode === 27 && this.isTopModal()) {
if (this.props.onEscapeKeyDown) {
this.props.onEscapeKeyDown(e);
Expand Down
11 changes: 5 additions & 6 deletions src/ModalManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ModalManager {
}

containerIndexFromModal(modal) {
return findIndexOf(this.data, d => d.modals.indexOf(modal) !== -1);
return findIndexOf(this.data, (d) => d.modals.indexOf(modal) !== -1);
}

setContainerStyle(containerState, container) {
Expand All @@ -62,10 +62,9 @@ class ModalManager {
if (containerState.overflowing) {
// use computed style, here to get the real padding
// to add our scrollbar width
style.paddingRight = `${parseInt(
css(container, 'paddingRight') || 0,
10,
) + this.scrollbarSize}px`;
style.paddingRight = `${
parseInt(css(container, 'paddingRight') || 0, 10) + this.scrollbarSize
}px`;
}

css(container, style);
Expand All @@ -74,7 +73,7 @@ class ModalManager {
removeContainerStyle(containerState, container) {
const { style } = containerState;

Object.keys(style).forEach(key => {
Object.keys(style).forEach((key) => {
container.style[key] = style[key];
});
}
Expand Down
10 changes: 5 additions & 5 deletions src/usePopper.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export function toModifierMap(modifiers) {
}

// eslint-disable-next-line no-unused-expressions
modifiers?.forEach(m => {
modifiers?.forEach((m) => {
result[m.name] = m;
});
return result;
}

export function toModifierArray(map) {
if (Array.isArray(map)) return map;
return Object.keys(map || {}).map(k => {
return Object.keys(map || {}).map((k) => {
map[k].name = k;
return map[k];
});
Expand Down Expand Up @@ -84,7 +84,7 @@ export default function usePopper(
enabled: true,
phase: 'afterWrite',
requires: ['computeStyles'],
fn: data => {
fn: (data) => {
setState({
scheduleUpdate,
outOfBoundaries: data.state.modifiersData.hide?.isReferenceHidden,
Expand All @@ -100,7 +100,7 @@ export default function usePopper(

let modifiers = toModifierArray(userModifiers);

let eventsModifier = modifiers.find(m => m.name === 'eventListeners');
let eventsModifier = modifiers.find((m) => m.name === 'eventListeners');

if (!eventsModifier && eventsEnabled) {
eventsModifier = {
Expand Down Expand Up @@ -146,7 +146,7 @@ export default function usePopper(
if (popperInstanceRef.current !== null) {
popperInstanceRef.current.destroy();
popperInstanceRef.current = null;
setState(s => ({
setState((s) => ({
...s,
styles: initialPopperStyles,
arrowStyles: initialArrowStyles,
Expand Down
10 changes: 5 additions & 5 deletions src/useRootClose.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function useRootClose(
const onClose = onRootClose || noop;

const handleMouseCapture = useCallback(
e => {
(e) => {
const currentTarget = ref && ('current' in ref ? ref.current : ref);
warning(
!!currentTarget,
Expand All @@ -56,13 +56,13 @@ function useRootClose(
[ref],
);

const handleMouse = useEventCallback(e => {
const handleMouse = useEventCallback((e) => {
if (!preventMouseRootCloseRef.current) {
onClose(e);
}
});

const handleKeyUp = useEventCallback(e => {
const handleKeyUp = useEventCallback((e) => {
if (e.keyCode === escapeKeyCode) {
onClose(e);
}
Expand Down Expand Up @@ -90,14 +90,14 @@ function useRootClose(
if ('ontouchstart' in doc.documentElement) {
mobileSafariHackListeners = [].slice
.call(doc.body.children)
.map(el => listen(el, 'mousemove', noop));
.map((el) => listen(el, 'mousemove', noop));
}

return () => {
removeMouseCaptureListener();
removeMouseListener();
removeKeyupListener();
mobileSafariHackListeners.forEach(remove => remove());
mobileSafariHackListeners.forEach((remove) => remove());
};
}, [
ref,
Expand Down
6 changes: 3 additions & 3 deletions src/utils/manageAriaHidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let isHidable = ({ nodeType, tagName }) =>

let siblings = (container, exclude, cb) => {
exclude = [].concat(exclude);
[].forEach.call(container.children, node => {
[].forEach.call(container.children, (node) => {
if (exclude.indexOf(node) === -1 && isHidable(node)) {
cb(node);
}
Expand All @@ -22,9 +22,9 @@ export function ariaHidden(show, node) {
}

export function hideSiblings(container, { dialog, backdrop }) {
siblings(container, [dialog, backdrop], node => ariaHidden(true, node));
siblings(container, [dialog, backdrop], (node) => ariaHidden(true, node));
}

export function showSiblings(container, { dialog, backdrop }) {
siblings(container, [dialog, backdrop], node => ariaHidden(false, node));
siblings(container, [dialog, backdrop], (node) => ariaHidden(false, node));
}
2 changes: 1 addition & 1 deletion src/utils/ownerDocument.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ReactDOM from 'react-dom';
import ownerDocument from 'dom-helpers/ownerDocument';

export default function(componentOrElement) {
export default function (componentOrElement) {
return ownerDocument(ReactDOM.findDOMNode(componentOrElement));
}
2 changes: 1 addition & 1 deletion src/utils/useWaitForDOMRef.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ownerDocument from 'dom-helpers/ownerDocument';
import { useState, useEffect } from 'react';

const resolveRef = ref => {
const resolveRef = (ref) => {
if (typeof document === 'undefined') return undefined;
if (ref == null) return ownerDocument().body;
if (typeof ref === 'function') ref = ref();
Expand Down
Loading

0 comments on commit 071da3e

Please sign in to comment.