From 4873110b2a6720dc736e2544d7408197928cf996 Mon Sep 17 00:00:00 2001 From: Adi Dahiya Date: Tue, 21 Apr 2020 18:48:39 -0400 Subject: [PATCH] chore: upgrade to Prettier 2.0 (#4081) Prettier changed their method chain breaking heuristic, so there are a bunch of autoformatted lines changed in this PR. --- package.json | 2 +- .../components/editable-text/editableText.tsx | 4 +- .../src/components/hotkeys/hotkeyParser.ts | 5 +- .../test/context-menu/contextMenuTests.tsx | 5 +- .../core/test/controls/numericInputTests.tsx | 20 +---- .../core/test/controls/radioGroupTests.tsx | 8 +- packages/core/test/dialog/dialogTests.tsx | 5 +- packages/core/test/drawer/drawerTests.tsx | 5 +- .../test/editable-text/editableTextTests.tsx | 5 +- packages/core/test/menu/menuItemTests.tsx | 13 +-- .../test/overflow-list/overflowListTests.tsx | 8 +- .../core/test/panel-stack/panelStackTests.tsx | 10 +-- packages/core/test/popover/popoverTests.tsx | 28 ++---- .../core/test/slider/multiSliderTests.tsx | 5 +- packages/core/test/tabs/tabsTests.tsx | 5 +- .../core/test/tag-input/tagInputTests.tsx | 23 +---- packages/datetime/test/dateInputTests.tsx | 43 ++------- .../datetime/test/datePickerCaptionTests.tsx | 10 +-- packages/datetime/test/datePickerTests.tsx | 88 ++++-------------- .../datetime/test/dateRangeInputTests.tsx | 10 +-- .../datetime/test/dateRangePickerTests.tsx | 90 ++++--------------- .../datetime/test/dateTimePickerTests.tsx | 8 +- .../docs-app/src/components/colorSchemes.tsx | 18 +--- .../dateRangePickerExample.tsx | 12 +-- .../select-examples/multiSelectExample.tsx | 6 +- .../select-examples/selectExample.tsx | 4 +- packages/landing-app/src/logo.ts | 32 ++----- packages/select/test/multiSelectTests.tsx | 5 +- packages/select/test/selectComponentSuite.tsx | 8 +- packages/select/test/suggestTests.tsx | 5 +- packages/table-dev-app/src/mutableTable.tsx | 12 +-- .../src/quadrants/tableQuadrantStack.tsx | 8 +- packages/table/test/columnHeaderCellTests.tsx | 4 +- packages/table/test/editableNameTests.tsx | 4 +- packages/table/test/reorderableTests.tsx | 30 ++----- packages/table/test/resizableTests.tsx | 13 +-- packages/table/test/selectableTests.tsx | 17 +--- packages/table/test/selectionTests.tsx | 75 ++++------------ packages/table/test/tableTests.tsx | 58 +++--------- .../timezone/test/timezonePickerTests.tsx | 18 +--- yarn.lock | 8 +- 41 files changed, 149 insertions(+), 588 deletions(-) diff --git a/package.json b/package.json index 5c41cb796f..b2c6f0b5b4 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "http-server": "^0.11.1", "lerna": "^2.11.0", "npm-run-all": "^4.1.5", - "prettier": "^1.19.1", + "prettier": "^2.0.5", "sinon": "^7.3.2", "stylelint-config-palantir": "^4.0.0", "stylelint-scss": "^3.9.2", diff --git a/packages/core/src/components/editable-text/editableText.tsx b/packages/core/src/components/editable-text/editableText.tsx index c5db4e0876..beedfb1322 100644 --- a/packages/core/src/components/editable-text/editableText.tsx +++ b/packages/core/src/components/editable-text/editableText.tsx @@ -233,9 +233,7 @@ export class EditableText extends AbstractPureComponent2 {alwaysRenderInput || this.state.isEditing ? this.renderInput(value) : undefined} - {shouldHideContents ? ( - undefined - ) : ( + {shouldHideContents ? undefined : ( {hasValue ? value : this.props.placeholder} diff --git a/packages/core/src/components/hotkeys/hotkeyParser.ts b/packages/core/src/components/hotkeys/hotkeyParser.ts index 35b50ea2f9..9806cf0d93 100644 --- a/packages/core/src/components/hotkeys/hotkeyParser.ts +++ b/packages/core/src/components/hotkeys/hotkeyParser.ts @@ -184,10 +184,7 @@ export function comboMatches(a: IKeyCombo, b: IKeyCombo) { * unshifted version. For example, `@` is equivalent to `shift+2`. */ export const parseKeyCombo = (combo: string): IKeyCombo => { - const pieces = combo - .replace(/\s/g, "") - .toLowerCase() - .split("+"); + const pieces = combo.replace(/\s/g, "").toLowerCase().split("+"); let modifiers = 0; let key = null as string; for (let piece of pieces) { diff --git a/packages/core/test/context-menu/contextMenuTests.tsx b/packages/core/test/context-menu/contextMenuTests.tsx index d5dde1dde8..7c577ec33e 100644 --- a/packages/core/test/context-menu/contextMenuTests.tsx +++ b/packages/core/test/context-menu/contextMenuTests.tsx @@ -94,10 +94,7 @@ describe("ContextMenu", () => { rightClickMe.simulate("contextmenu"); assertContextMenuWasRendered(); - rightClickMe - .find(RightClickMe) - .last() - .simulate("contextmenu"); + rightClickMe.find(RightClickMe).last().simulate("contextmenu"); assertContextMenuWasRendered(childItems.length); }); diff --git a/packages/core/test/controls/numericInputTests.tsx b/packages/core/test/controls/numericInputTests.tsx index 93c5fffe1e..d0a31e5817 100644 --- a/packages/core/test/controls/numericInputTests.tsx +++ b/packages/core/test/controls/numericInputTests.tsx @@ -201,10 +201,7 @@ describe("", () => { incrementButton.simulate("mousedown"); dispatchMouseEvent(document, "mouseup"); - const inputElement = component - .find("input") - .first() - .getDOMNode(); + const inputElement = component.find("input").first().getDOMNode(); expect(onValueChangeSpy.calledOnceWithExactly(1, "1", inputElement)).to.be.true; }); @@ -629,10 +626,7 @@ describe("", () => { const newValue = component.state().value; expect(newValue).to.equal("0"); - const inputElement = component - .find("input") - .first() - .getDOMNode(); + const inputElement = component.find("input").first().getDOMNode(); expect(onValueChangeSpy.calledOnceWithExactly(0, "0", inputElement)).to.be.true; }); @@ -706,10 +700,7 @@ describe("", () => { const newValue = component.state().value; expect(newValue).to.equal("0"); - const inputElement = component - .find("input") - .first() - .getDOMNode(); + const inputElement = component.find("input").first().getDOMNode(); expect(onValueChangeSpy.calledOnceWithExactly(0, "0", inputElement)).to.be.true; }); @@ -740,10 +731,7 @@ describe("", () => { .simulate("mousedown"); expect(component.state().value).to.equal("2"); - const inputElement = component - .find("input") - .first() - .getDOMNode(); + const inputElement = component.find("input").first().getDOMNode(); expect(onValueChangeSpy.calledOnceWithExactly(2, "2", inputElement)).to.be.true; }); }); diff --git a/packages/core/test/controls/radioGroupTests.tsx b/packages/core/test/controls/radioGroupTests.tsx index 7b6991d8e5..ddd7eaaf8f 100644 --- a/packages/core/test/controls/radioGroupTests.tsx +++ b/packages/core/test/controls/radioGroupTests.tsx @@ -77,13 +77,7 @@ describe("", () => { const OPTIONS = [{ value: "text" }, { value: 23 }]; const group = mount(); OPTIONS.forEach(props => { - assert.strictEqual( - findInput(group, props) - .parents() - .first() - .text(), - props.value.toString(), - ); + assert.strictEqual(findInput(group, props).parents().first().text(), props.value.toString()); }); }); diff --git a/packages/core/test/dialog/dialogTests.tsx b/packages/core/test/dialog/dialogTests.tsx index 3749dfb1ec..507cef22df 100644 --- a/packages/core/test/dialog/dialogTests.tsx +++ b/packages/core/test/dialog/dialogTests.tsx @@ -136,10 +136,7 @@ describe("", () => { dialog body , ); - dialog - .find(`.${Classes.DIALOG_HEADER}`) - .find(Button) - .simulate("click"); + dialog.find(`.${Classes.DIALOG_HEADER}`).find(Button).simulate("click"); assert.isTrue(onClose.calledOnce, "onClose not called"); }); }); diff --git a/packages/core/test/drawer/drawerTests.tsx b/packages/core/test/drawer/drawerTests.tsx index 50a42f4c25..8194cb213d 100644 --- a/packages/core/test/drawer/drawerTests.tsx +++ b/packages/core/test/drawer/drawerTests.tsx @@ -329,10 +329,7 @@ describe("", () => { drawer body , ); - drawer - .find(`.${Classes.DRAWER_HEADER}`) - .find(Button) - .simulate("click"); + drawer.find(`.${Classes.DRAWER_HEADER}`).find(Button).simulate("click"); assert.isTrue(onClose.calledOnce, "onClose not called"); }); }); diff --git a/packages/core/test/editable-text/editableTextTests.tsx b/packages/core/test/editable-text/editableTextTests.tsx index 93b4c2f962..0ef4e9c681 100644 --- a/packages/core/test/editable-text/editableTextTests.tsx +++ b/packages/core/test/editable-text/editableTextTests.tsx @@ -297,10 +297,7 @@ describe("", () => { } function simulateHelper(wrapper: ReactWrapper, value: string, e: IFakeKeyboardEvent) { - wrapper - .find("textarea") - .simulate("change", { target: { value } }) - .simulate("keydown", e); + wrapper.find("textarea").simulate("change", { target: { value } }).simulate("keydown", e); } }); }); diff --git a/packages/core/test/menu/menuItemTests.tsx b/packages/core/test/menu/menuItemTests.tsx index ed8de2bb3f..828f8dfa30 100644 --- a/packages/core/test/menu/menuItemTests.tsx +++ b/packages/core/test/menu/menuItemTests.tsx @@ -103,10 +103,7 @@ describe("MenuItem", () => {