From 94574c132433f5afba2a212e57f8ee7a3aa362b3 Mon Sep 17 00:00:00 2001 From: David Mason Date: Thu, 14 Jul 2016 13:16:38 +1000 Subject: [PATCH] refactor(editor): enable react/jsx-indent linting rule for zanata-editor This rule leads to some odd indentation around ternary operators and logic operators, but there is an active bug for it so it should be ok to leave the rule on and wait for a fix. See https://github.com/yannickcr/eslint-plugin-react/issues/540 --- zanata-editor/src/.eslintrc | 3 - .../src/app/components/DashboardLink.js | 12 ++-- .../src/app/components/LogoLoader/index.js | 42 ++++++------ zanata-editor/src/app/components/Pager.js | 26 ++++---- .../src/app/components/ProgressBar/index.js | 2 +- .../src/app/components/SuggestionContents.js | 2 +- .../app/components/TransUnitSourceHeader.js | 34 +++++----- .../app/components/TransUnitSourcePanel.js | 64 +++++++++---------- .../src/app/components/TransUnitStatus.js | 44 ++++++------- .../components/TransUnitTranslationFooter.js | 24 +++---- .../components/TransUnitTranslationPanel.js | 4 +- .../src/app/containers/NeedSlugMessage.js | 8 +-- .../src/app/containers/SuggestionsHeader.js | 18 +++--- 13 files changed, 140 insertions(+), 143 deletions(-) diff --git a/zanata-editor/src/.eslintrc b/zanata-editor/src/.eslintrc index a2fe2150b8..00710f5f47 100644 --- a/zanata-editor/src/.eslintrc +++ b/zanata-editor/src/.eslintrc @@ -15,9 +15,6 @@ rules: # These rules should all be turned on and the linting errors fixed after the # other changes have been reviewed. - # FIXME enable rule and fix code style - react/jsx-indent: [0] - # FIXME enable rule and fix code style react/jsx-indent-props: [0] diff --git a/zanata-editor/src/app/components/DashboardLink.js b/zanata-editor/src/app/components/DashboardLink.js index 13b8efac1e..5877d15c7e 100644 --- a/zanata-editor/src/app/components/DashboardLink.js +++ b/zanata-editor/src/app/components/DashboardLink.js @@ -20,12 +20,12 @@ const DashboardLink = React.createClass({ render: function () { return ( - - - + + + ) } }) diff --git a/zanata-editor/src/app/components/LogoLoader/index.js b/zanata-editor/src/app/components/LogoLoader/index.js index e5b1631b1a..f5f270e3a3 100644 --- a/zanata-editor/src/app/components/LogoLoader/index.js +++ b/zanata-editor/src/app/components/LogoLoader/index.js @@ -12,27 +12,27 @@ const LogoLoader = ({ inverted, loading }) => { /* eslint-disable max-len */ return ( - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + ) /* eslint-enable max-len */ } diff --git a/zanata-editor/src/app/components/Pager.js b/zanata-editor/src/app/components/Pager.js index 3b887af681..3806573611 100644 --- a/zanata-editor/src/app/components/Pager.js +++ b/zanata-editor/src/app/components/Pager.js @@ -12,19 +12,19 @@ const PagerButton = React.createClass({ title={this.props.title} className="u-sizeWidth-1"/> return ( -
  • - {this.props.disabled - ? - {icon} - - : - {icon} - - } -
  • +
  • + {this.props.disabled + ? + {icon} + + : + {icon} + + } +
  • ) } }) diff --git a/zanata-editor/src/app/components/ProgressBar/index.js b/zanata-editor/src/app/components/ProgressBar/index.js index e191574c19..72bcd0cbba 100644 --- a/zanata-editor/src/app/components/ProgressBar/index.js +++ b/zanata-editor/src/app/components/ProgressBar/index.js @@ -23,7 +23,7 @@ const ProgressItem = React.createClass({ width: this.props.width + '%' } return ( - + ) } }) diff --git a/zanata-editor/src/app/components/SuggestionContents.js b/zanata-editor/src/app/components/SuggestionContents.js index 502a4ad9aa..78704bb991 100644 --- a/zanata-editor/src/app/components/SuggestionContents.js +++ b/zanata-editor/src/app/components/SuggestionContents.js @@ -52,7 +52,7 @@ const SuggestionContents = React.createClass({ text2={content}/> :
    {content} -
    + }, render: function () { diff --git a/zanata-editor/src/app/components/TransUnitSourceHeader.js b/zanata-editor/src/app/components/TransUnitSourceHeader.js index 852aeb4382..7075a17e84 100644 --- a/zanata-editor/src/app/components/TransUnitSourceHeader.js +++ b/zanata-editor/src/app/components/TransUnitSourceHeader.js @@ -26,27 +26,27 @@ const TransUnitSourceHeader = React.createClass({ const copyButtonItem = this.props.phrase.plural ? undefined : ( -
  • - -
  • - ) +
  • + +
  • + ) const closeButtonItem = hasTranslationChanged(this.props.phrase) ? undefined : ( -
  • - -
  • - ) +
  • + +
  • + ) return (
    diff --git a/zanata-editor/src/app/components/TransUnitSourcePanel.js b/zanata-editor/src/app/components/TransUnitSourcePanel.js index 499b90359c..3df03e4900 100644 --- a/zanata-editor/src/app/components/TransUnitSourcePanel.js +++ b/zanata-editor/src/app/components/TransUnitSourcePanel.js @@ -30,8 +30,8 @@ const TransUnitSourcePanel = React.createClass({ const sources = isLoading ? - - + + : this.props.phrase.sources.map( (source, index) => { // TODO make this translatable @@ -43,25 +43,25 @@ const TransUnitSourcePanel = React.createClass({ const copyButton = this.props.selected ?
      -
    • - -
    • -
    +
  • + +
  • + : undefined const itemHeader = isPlural ?
    - - {headerLabel} - - {copyButton} -
    + + {headerLabel} + + {copyButton} +
    : undefined return ( @@ -75,21 +75,21 @@ const TransUnitSourcePanel = React.createClass({ // empty, but this is what is output in the Angular version const footer = this.props.selected ? ( -
    -
    - {/* - - */} -
    -
    - ) +
    +
    + {/* + + */} +
    +
    + ) : undefined return ( diff --git a/zanata-editor/src/app/components/TransUnitStatus.js b/zanata-editor/src/app/components/TransUnitStatus.js index 2cc74a12a6..ace8ba6fd9 100644 --- a/zanata-editor/src/app/components/TransUnitStatus.js +++ b/zanata-editor/src/app/components/TransUnitStatus.js @@ -27,32 +27,32 @@ const TransUnitStatus = React.createClass({ const comments = phrase.comments ? ( -
  • - -
  • - ) +
  • + +
  • + ) : undefined const errors = phrase.errors ? ( -
  • - -
  • - ) +
  • + +
  • + ) : undefined return ( diff --git a/zanata-editor/src/app/components/TransUnitTranslationFooter.js b/zanata-editor/src/app/components/TransUnitTranslationFooter.js index 5a9c2d9d64..8f7db79f7d 100644 --- a/zanata-editor/src/app/components/TransUnitTranslationFooter.js +++ b/zanata-editor/src/app/components/TransUnitTranslationFooter.js @@ -113,14 +113,14 @@ const TransUnitTranslationFooter = React.createClass({ const actionButtonKeyShortcut = saveAsMode && this.statusShortcutKeys[selectedButtonStatus] const actionButton = ( - + ) const otherStatuses = nonDefaultValidSaveStatuses(phrase) @@ -138,10 +138,10 @@ const TransUnitTranslationFooter = React.createClass({ 'Dropdown-toggle', this.buttonClassByStatus[selectedButtonStatus])} title="Save as…"> - - + + : undefined const otherActionButtonList = ( diff --git a/zanata-editor/src/app/components/TransUnitTranslationPanel.js b/zanata-editor/src/app/components/TransUnitTranslationPanel.js index 1030ba6395..2567779153 100644 --- a/zanata-editor/src/app/components/TransUnitTranslationPanel.js +++ b/zanata-editor/src/app/components/TransUnitTranslationPanel.js @@ -115,8 +115,8 @@ const TransUnitTranslationPanel = React.createClass({ if (isLoading) { translations = - - + +
    } else { const newTranslations = phrase.newTranslations ? phrase.newTranslations diff --git a/zanata-editor/src/app/containers/NeedSlugMessage.js b/zanata-editor/src/app/containers/NeedSlugMessage.js index db84276aee..e834b0ab46 100644 --- a/zanata-editor/src/app/containers/NeedSlugMessage.js +++ b/zanata-editor/src/app/containers/NeedSlugMessage.js @@ -16,10 +16,10 @@ class NeedSlugMessage extends React.Component {

    Need a URL in the form .../project-slug/version-slug/translate

    -

    If using fake-zanata-server, try using - /tiny-project/1/translate/hello.txt/fr - +

    If using fake-zanata-server, try using + /tiny-project/1/translate/hello.txt/fr +

    ) diff --git a/zanata-editor/src/app/containers/SuggestionsHeader.js b/zanata-editor/src/app/containers/SuggestionsHeader.js index 1399493a7d..bd4d3dddb3 100644 --- a/zanata-editor/src/app/containers/SuggestionsHeader.js +++ b/zanata-editor/src/app/containers/SuggestionsHeader.js @@ -56,15 +56,15 @@ const SuggestionsHeader = React.createClass({ const showSearch = textSearchSelected || !this.props.phraseSelected const searchInput = showSearch ?
    - this.searchInput = ref} - text={this.props.search.input.text} - loading={this.props.search.loading} - hasSearch={this.props.search.searchStrings.length !== 0} - resultCount={this.props.search.suggestions.length} - clearSearch={this.props.search.clear} - onTextChange={this.props.search.changeText}/> -
    + this.searchInput = ref} + text={this.props.search.input.text} + loading={this.props.search.loading} + hasSearch={this.props.search.searchStrings.length !== 0} + resultCount={this.props.search.suggestions.length} + clearSearch={this.props.search.clear} + onTextChange={this.props.search.changeText}/> + : undefined return (