From 26ccb798aae1dcd2c6952025c347718e21a7b831 Mon Sep 17 00:00:00 2001 From: Jeff Pihach Date: Mon, 24 Sep 2018 16:40:04 -0600 Subject: [PATCH 1/9] Add react/jsx-first-prop-new-line eslint rule and updated react/jsx-max-props-per-line rule. --- .eslintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc b/.eslintrc index cd5e986ac6..ee17f4ae31 100644 --- a/.eslintrc +++ b/.eslintrc @@ -39,11 +39,12 @@ "react/prop-types": 2, "react/sort-prop-types": 2, "react/jsx-closing-bracket-location": ["error", "after-props"], + "react/jsx-first-prop-new-line": 2, "react/jsx-sort-props": [2, { "ignoreCase": true }], "react/jsx-tag-spacing": ["error", { "beforeSelfClosing": "always" }], "react/jsx-uses-react": 2, "react/jsx-uses-vars": 2, - "react/jsx-max-props-per-line": [1, { "when": "always" }], + "react/jsx-max-props-per-line": [2, { "when": "multiline" }], "semi": [2, "always"], "space-before-blocks": 2, "space-before-function-paren": ["error", "never"], From 3e8df459c94d3cc8fab35e2b5ed8df6e5ef01914 Mon Sep 17 00:00:00 2001 From: Jeff Pihach Date: Mon, 24 Sep 2018 16:58:01 -0600 Subject: [PATCH 2/9] Apply eslint --fix for the JSX prop location changes. --- .../accordion-section/accordion-section.js | 3 +- .../test-accordion-section.js | 15 +- .../added-services-list/item/item.js | 3 +- .../added-services-list/item/test-item.js | 3 +- .../boolean-config/boolean-config.js | 3 +- .../boolean-config/test-boolean-config.js | 3 +- .../components/budget-chart/budget-chart.js | 6 +- .../budget-chart/test-budget-chart.js | 12 +- .../app/components/budget-table/row/row.js | 9 +- .../components/budget-table/row/test-row.js | 6 +- .../button-dropdown/button-dropdown.js | 12 +- .../button-dropdown/test-button-dropdown.js | 24 ++- .../src/app/components/card-form/card-form.js | 3 +- .../components/card-form/test-card-form.js | 3 +- .../components/charmbrowser/charmbrowser.js | 3 +- .../charmbrowser/test-charmbrowser.js | 9 +- .../check-list-item/check-list-item.js | 13 +- .../check-list-item/test-check-list-item.js | 13 +- .../app/components/constraints/constraints.js | 12 +- .../constraints/test-constraints.js | 12 +- .../copy-to-clipboard/copy-to-clipboard.js | 6 +- .../test-copy-to-clipboard.js | 6 +- .../create-payment-user.js | 12 +- .../test-create-payment-user.js | 12 +- .../components/date-display/date-display.js | 3 +- .../date-display/test-date-display.js | 42 +++-- .../notification/notification.js | 3 +- .../notification/test-notification.js | 3 +- .../deployment-flow/agreements/agreements.js | 6 +- .../agreements/test-agreements.js | 6 +- .../change-item/change-item.js | 3 +- .../change-item/test-change-item.js | 7 +- .../components/deployment-flow/cloud/cloud.js | 3 +- .../deployment-flow/cloud/test-cloud.js | 9 +- .../deployment-flow/credential/add/add.js | 10 +- .../credential/add/test-add.js | 33 ++-- .../direct-deploy/direct-deploy.js | 9 +- .../direct-deploy/test-direct-deploy.js | 15 +- .../expert-intro/expert-intro.js | 9 +- .../expert-intro/test-expert-intro.js | 9 +- .../components/deployment-flow/login/login.js | 3 +- .../deployment-flow/login/test-login.js | 3 +- .../deployment-flow/machines/machines.js | 3 +- .../deployment-flow/machines/test-machines.js | 12 +- .../deployment-flow/payment/payment.js | 3 +- .../deployment-flow/payment/test-payment.js | 3 +- .../pricing/plan-table/plan-table.js | 3 +- .../pricing/plan-table/test-plan-table.js | 3 +- .../deployment-flow/pricing/pricing.js | 9 +- .../pricing/support-selection/plan/plan.js | 6 +- .../support-selection/plan/test-plan.js | 9 +- .../deployment-flow/pricing/test-pricing.js | 9 +- .../deployment-flow/signup/signup.js | 3 +- .../deployment-flow/signup/test-signup.js | 3 +- .../deployment-flow/sshkey/sshkey.js | 15 +- .../deployment-flow/sshkey/test-sshkey.js | 25 ++- .../deployment-flow/vpc/test-vpc.js | 6 +- .../app/components/deployment-flow/vpc/vpc.js | 6 +- .../content/config-option/config-option.js | 3 +- .../config-option/test-config-option.js | 3 +- .../entity-details/content/content.js | 34 ++-- .../content/description/description.js | 3 +- .../content/description/test-description.js | 6 +- .../entity-details/content/diagram/diagram.js | 4 +- .../content/diagram/test-diagram.js | 4 +- .../entity-details/content/files/files.js | 21 ++- .../content/files/test-files.js | 35 +++- .../content/readme/test-readme.js | 3 +- .../content/relations/relations.js | 13 +- .../content/relations/test-relations.js | 12 +- .../content/resources/resources.js | 3 +- .../content/resources/test-resources.js | 9 +- .../entity-details/content/test-content.js | 75 +++++--- .../entity-details/entity-details.js | 6 +- .../entity-details/header/header.js | 37 ++-- .../entity-details/header/test-header.js | 51 +++-- .../entity-details/test-entity-details.js | 9 +- .../env-size-display/env-size-display.js | 9 +- .../components/env-switcher/env-switcher.js | 12 +- .../app/components/env-switcher/list/list.js | 6 +- .../components/env-switcher/list/test-list.js | 30 ++- .../env-switcher/test-env-switcher.js | 12 +- .../app/components/environment/environment.js | 58 ++++-- .../app/components/expert-card/expert-card.js | 3 +- .../expert-card/test-expert-card.js | 4 +- .../expert-contact-card.js | 6 +- .../test-expert-contact-card.js | 15 +- .../expert-store-card/expert-store-card.js | 3 +- .../test-expert-store-card.js | 3 +- .../app/components/file-field/file-field.js | 6 +- .../components/file-field/test-file-field.js | 15 +- .../components/generic-input/generic-input.js | 9 +- .../generic-input/test-generic-input.js | 18 +- .../src/app/components/hash-link/hash-link.js | 3 +- .../components/hash-link/test-hash-link.js | 3 +- .../header-breadcrumb/header-breadcrumb.js | 6 +- .../test-header-breadcrumb.js | 9 +- .../app/components/header-logo/header-logo.js | 3 +- .../header-logo/test-header-logo.js | 9 +- .../components/header-search/header-search.js | 20 +- .../gui/src/app/components/help/help.js | 36 ++-- .../src/app/components/help/tour/test-tour.js | 3 +- .../gui/src/app/components/help/tour/tour.js | 28 ++- .../src/app/components/icon-list/icon-list.js | 9 +- .../components/icon-list/test-icon-list.js | 18 +- .../components/inset-select/inset-select.js | 9 +- .../inset-select/test-inset-select.js | 6 +- .../change-version/change-version.js | 3 +- .../inspector/change-version/item/item.js | 6 +- .../change-version/item/test-item.js | 9 +- .../change-version/test-change-version.js | 3 +- .../inspector/expose/unit/test-unit.js | 18 +- .../components/inspector/expose/unit/unit.js | 8 +- .../app/components/inspector/header/header.js | 13 +- .../overview-action/overview-action.js | 13 +- .../overview-action/test-overview-action.js | 6 +- .../inspector/relate-to/relate-to.js | 3 +- .../inspector/relate-to/test-relate-to.js | 3 +- .../inspector/resources/list/list.js | 3 +- .../inspector/resources/list/test-list.js | 6 +- .../inspector/scale-service/scale-service.js | 9 +- .../unit-details/test-unit-details.js | 51 +++-- .../inspector/unit-details/unit-details.js | 12 +- .../app/components/isv-profile/isv-profile.js | 6 +- .../app/components/lightbox/test-lightbox.js | 21 ++- .../gui/src/app/components/link/link.js | 3 +- .../gui/src/app/components/link/test-link.js | 3 +- .../local-inspector/local-inspector.js | 16 +- .../local-inspector/test-local-inspector.js | 20 +- .../gui/src/app/components/logout/logout.js | 3 +- .../src/app/components/logout/test-logout.js | 3 +- .../machine-view/add-machine/add-machine.js | 3 +- .../add-machine/test-add-machine.js | 3 +- .../components/machine-view/column/column.js | 3 +- .../machine-view/column/test-column.js | 3 +- .../components/machine-view/machine-view.js | 9 +- .../machine-view/scale-up/scale-up.js | 12 +- .../machine-view/scale-up/test-scale-up.js | 21 ++- .../machine-view/test-machine-view.js | 18 +- .../unplaced-unit/test-unplaced-unit.js | 4 +- .../unplaced-unit/unplaced-unit.js | 4 +- .../modal-gui-settings/modal-gui-settings.js | 31 +++- .../test-modal-gui-settings.js | 26 ++- .../modal-shortcuts/modal-shortcuts.js | 8 +- .../modal-shortcuts/test-modal-shortcuts.js | 8 +- .../components/model-actions/model-actions.js | 27 ++- .../model-actions/test-model-actions.js | 27 ++- .../components/notification-list/item/item.js | 7 +- .../notification-list/item/test-item.js | 6 +- .../notification-list/notification-list.js | 3 +- .../test-notification-list.js | 3 +- .../components/notification/notification.js | 3 +- .../notification/test-notification.js | 3 +- .../app/components/payment/charges/charges.js | 3 +- .../charges/receipt-popup/receipt-popup.js | 3 +- .../payment/charges/test-charges.js | 3 +- .../components/payment/methods/card/card.js | 3 +- .../payment/methods/card/test-card.js | 3 +- .../app/components/payment/methods/methods.js | 3 +- .../payment/methods/test-methods.js | 3 +- .../post-deployment/post-deployment.js | 11 +- .../post-deployment/test-post-deployment.js | 11 +- .../profile/bundle-list/bundle-list.js | 3 +- .../profile/bundle-list/test-bundle-list.js | 3 +- .../profile/charm-list/charm-list.js | 15 +- .../profile/charm-list/test-charm-list.js | 45 +++-- .../charmstore-login/charmstore-login.js | 6 +- .../charmstore-login/test-charmstore-login.js | 6 +- .../expanded-content/expanded-content.js | 15 +- .../expanded-content/test-expanded-content.js | 30 ++- .../app/components/profile/header/header.js | 21 ++- .../components/profile/header/test-header.js | 6 +- .../profile/model-list/model-list.js | 6 +- .../profile/model-list/test-model-list.js | 39 ++-- .../gui/src/app/components/profile/profile.js | 15 +- .../relation-menu/ambiguous-relation-menu.js | 3 +- .../components/relation-menu/relation-menu.js | 12 +- .../components/search-results/item/item.js | 18 +- .../search-results/item/test-item.js | 24 ++- .../search-results/search-results.js | 3 +- .../select-filter/select-filter.js | 6 +- .../select-filter/test-select-filter.js | 3 +- .../search-results/test-search-results.js | 3 +- .../type-filter/test-type-filter.js | 18 +- .../search-results/type-filter/type-filter.js | 6 +- .../components/shared/basic-table/row/row.js | 6 +- .../shared/basic-table/row/test-row.js | 3 +- .../app/components/shared/button/button.js | 3 +- .../shared/expanding-row/expanding-row.js | 9 +- .../expanding-row/test-expanding-row.js | 15 +- .../shared/machine-unit/machine-unit.js | 3 +- .../app/components/shared/machine/machine.js | 6 +- .../components/shared/machine/test-machine.js | 9 +- .../src/app/components/shared/panel/panel.js | 6 +- .../app/components/shared/panel/test-panel.js | 6 +- .../application-list/application-list.js | 6 +- .../components/shared/status/model/model.js | 6 +- .../status/relation-list/relation-list.js | 6 +- .../shared/status/unit-list/unit-list.js | 9 +- .../gui/src/app/components/store/store.js | 174 ++++++++++++------ .../src/app/components/store/test-store.js | 3 +- .../components/string-config/input/input.js | 3 +- .../string-config/input/test-input.js | 3 +- .../components/string-config/string-config.js | 3 +- .../string-config/test-string-config.js | 3 +- .../src/app/components/svg-icon/svg-icon.js | 3 +- .../app/components/svg-icon/test-svg-icon.js | 4 +- .../app/components/terminal/test-terminal.js | 9 +- .../usso-login-link/test-usso-login-link.js | 3 +- .../usso-login-link/usso-login-link.js | 3 +- .../gui/src/app/components/zoom/test-zoom.js | 12 +- .../gui/src/app/components/zoom/zoom.js | 12 +- jujugui/static/gui/src/app/init/app.js | 18 +- .../static/gui/src/app/init/cookie-util.js | 3 +- .../gui/src/app/init/test-cookie-util.js | 3 +- jujugui/static/gui/src/app/init/utils.js | 18 +- 216 files changed, 1606 insertions(+), 785 deletions(-) diff --git a/jujugui/static/gui/src/app/components/accordion-section/accordion-section.js b/jujugui/static/gui/src/app/components/accordion-section/accordion-section.js index d56d9179db..d621f1afb2 100644 --- a/jujugui/static/gui/src/app/components/accordion-section/accordion-section.js +++ b/jujugui/static/gui/src/app/components/accordion-section/accordion-section.js @@ -85,7 +85,8 @@ class AccordionSection extends React.Component { @return {Object} The React div element. */ _generateContent() { - return (
{this.props.children} diff --git a/jujugui/static/gui/src/app/components/accordion-section/test-accordion-section.js b/jujugui/static/gui/src/app/components/accordion-section/test-accordion-section.js index fad70c50ca..6856159ef3 100644 --- a/jujugui/static/gui/src/app/components/accordion-section/test-accordion-section.js +++ b/jujugui/static/gui/src/app/components/accordion-section/test-accordion-section.js @@ -21,7 +21,8 @@ describe('AccordionSection', () => { const wrapper = renderComponent(); const expected = (
-
My title! @@ -30,7 +31,9 @@ describe('AccordionSection', () => { name="chevron_down_16" size="16" />
-
Hello
); assert.compareJSX(wrapper, expected); @@ -44,7 +47,9 @@ describe('AccordionSection', () => { }; instance._toggle(); const expected = ( -
Hello
); @@ -54,7 +59,9 @@ describe('AccordionSection', () => { it('does not show chevron or content when there are no children', () => { const wrapper = renderComponent({ children: null }); const expected = ( -
{null}
); diff --git a/jujugui/static/gui/src/app/components/added-services-list/item/item.js b/jujugui/static/gui/src/app/components/added-services-list/item/item.js index 958ec007c2..ab5690f141 100644 --- a/jujugui/static/gui/src/app/components/added-services-list/item/item.js +++ b/jujugui/static/gui/src/app/components/added-services-list/item/item.js @@ -100,7 +100,8 @@ class AddedServicesListItem extends React.Component { var statusData = this._getPriorityUnits(service.units.toArray()); var statusIndicator = this._renderStatusIndicator(statusData); return ( -
  • -
    diff --git a/jujugui/static/gui/src/app/components/boolean-config/test-boolean-config.js b/jujugui/static/gui/src/app/components/boolean-config/test-boolean-config.js index 4707622988..30fb30809d 100644 --- a/jujugui/static/gui/src/app/components/boolean-config/test-boolean-config.js +++ b/jujugui/static/gui/src/app/components/boolean-config/test-boolean-config.js @@ -48,7 +48,8 @@ describe('BooleanConfig', function() { -
    diff --git a/jujugui/static/gui/src/app/components/budget-chart/budget-chart.js b/jujugui/static/gui/src/app/components/budget-chart/budget-chart.js index aad59471d0..316c3fd623 100644 --- a/jujugui/static/gui/src/app/components/budget-chart/budget-chart.js +++ b/jujugui/static/gui/src/app/components/budget-chart/budget-chart.js @@ -52,10 +52,12 @@ class BudgetChart extends React.Component {
    -
    -
    diff --git a/jujugui/static/gui/src/app/components/budget-chart/test-budget-chart.js b/jujugui/static/gui/src/app/components/budget-chart/test-budget-chart.js index 46ad6ae19b..c7994dff1c 100644 --- a/jujugui/static/gui/src/app/components/budget-chart/test-budget-chart.js +++ b/jujugui/static/gui/src/app/components/budget-chart/test-budget-chart.js @@ -25,10 +25,12 @@ describe('BudgetChart', function() {
    -
    -
    -
    -
    { return ( -
  • {plan.url}

    @@ -196,7 +197,8 @@ class BudgetTableRow extends React.Component { _generateAllocation() { if (this.props.allocationEditable && this.state.editAllocation) { return ( - ); } else { @@ -219,7 +221,8 @@ class BudgetTableRow extends React.Component { return (
    - {service.get('name')}
    diff --git a/jujugui/static/gui/src/app/components/budget-table/row/test-row.js b/jujugui/static/gui/src/app/components/budget-table/row/test-row.js index 1adf69672c..02233c0927 100644 --- a/jujugui/static/gui/src/app/components/budget-table/row/test-row.js +++ b/jujugui/static/gui/src/app/components/budget-table/row/test-row.js @@ -98,7 +98,8 @@ describe('BudgetTableRow', function() {
    - Landscape
    @@ -202,7 +203,8 @@ describe('BudgetTableRow', function() { 'budget-table__current twelve-col no-margin-bottom'}>
    - Landscape
    diff --git a/jujugui/static/gui/src/app/components/button-dropdown/button-dropdown.js b/jujugui/static/gui/src/app/components/button-dropdown/button-dropdown.js index f3969ee805..be08ecf589 100644 --- a/jujugui/static/gui/src/app/components/button-dropdown/button-dropdown.js +++ b/jujugui/static/gui/src/app/components/button-dropdown/button-dropdown.js @@ -81,7 +81,8 @@ class ButtonDropdown extends React.Component { content = item.element; } else if (item.action) { content = ( - {item.label} @@ -90,7 +91,8 @@ class ButtonDropdown extends React.Component { content = item.label; } return ( -
  • @@ -123,7 +125,8 @@ class ButtonDropdown extends React.Component { const icon = this.props.icon; if (typeof icon === 'string') { return ( - ); } @@ -169,7 +172,8 @@ class ButtonDropdown extends React.Component { ); return (
    -
  • - item1
  • , -
  • item2
  • , -
  • item3
  • , -
  • - item4 diff --git a/jujugui/static/gui/src/app/components/card-form/card-form.js b/jujugui/static/gui/src/app/components/card-form/card-form.js index dfded1a0a2..87ec9fa295 100644 --- a/jujugui/static/gui/src/app/components/card-form/card-form.js +++ b/jujugui/static/gui/src/app/components/card-form/card-form.js @@ -56,7 +56,8 @@ class CardForm extends React.Component { ref="name" required={true} validate={[required]} /> -
  • ); diff --git a/jujugui/static/gui/src/app/components/card-form/test-card-form.js b/jujugui/static/gui/src/app/components/card-form/test-card-form.js index c6829ad11a..d7dc3d70ae 100644 --- a/jujugui/static/gui/src/app/components/card-form/test-card-form.js +++ b/jujugui/static/gui/src/app/components/card-form/test-card-form.js @@ -33,7 +33,8 @@ describe('CardForm', function() { regex: /\S+/, error: 'This field is required.' }]} /> -
    ); assert.compareJSX(wrapper, expected); diff --git a/jujugui/static/gui/src/app/components/charmbrowser/charmbrowser.js b/jujugui/static/gui/src/app/components/charmbrowser/charmbrowser.js index 2637cfa40f..e4d14acae9 100644 --- a/jujugui/static/gui/src/app/components/charmbrowser/charmbrowser.js +++ b/jujugui/static/gui/src/app/components/charmbrowser/charmbrowser.js @@ -199,7 +199,8 @@ class Charmbrowser extends React.Component { focus={false} instanceName="white-box" visible={true}> -
    {this._generateContent()}
    diff --git a/jujugui/static/gui/src/app/components/charmbrowser/test-charmbrowser.js b/jujugui/static/gui/src/app/components/charmbrowser/test-charmbrowser.js index 88612a49f7..ee4555a145 100644 --- a/jujugui/static/gui/src/app/components/charmbrowser/test-charmbrowser.js +++ b/jujugui/static/gui/src/app/components/charmbrowser/test-charmbrowser.js @@ -72,7 +72,8 @@ describe('Charmbrowser', function() { }); const searchResults = wrapper.find('SearchResults'); const expected = ( -
    {this.props.extraInfo} ); @@ -116,11 +117,15 @@ class CheckListItem extends React.Component { render() { var id = this.props.label + '-item'; return ( -
  • + onClick={this.props.action} + role="button" + tabIndex="0">
  • + onClick={undefined} + role="button" + tabIndex="0">
    { extraInfo: 'Current workload status' }); const expected = ( - Current workload status ); diff --git a/jujugui/static/gui/src/app/components/constraints/constraints.js b/jujugui/static/gui/src/app/components/constraints/constraints.js index 7ee548a56d..508d121292 100644 --- a/jujugui/static/gui/src/app/components/constraints/constraints.js +++ b/jujugui/static/gui/src/app/components/constraints/constraints.js @@ -93,7 +93,8 @@ class Constraints extends React.Component { - Cores - Ram (MB) - Disk (MB) - CPU (GHZ) - Cores - Ram (MB) - Disk (MB) - - -