From fe716c6dc43d4d7acb437136b1c87902e8ff0bc4 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 31 Mar 2017 13:54:46 +0200 Subject: re-format js code (#1877) --- server/sonar-web/.eslintrc | 8 +- server/sonar-web/package.json | 4 +- .../src/main/js/app/components/GlobalFooter.js | 7 +- .../nav/component/ComponentNavBreadcrumbs.js | 3 +- .../components/nav/component/ComponentNavMenu.js | 45 ++-- .../js/app/components/nav/global/GlobalNavUser.js | 3 +- .../js/app/components/nav/settings/SettingsNav.js | 3 +- .../about/components/AboutAppForSonarQubeDotCom.js | 3 +- .../js/apps/about/components/AboutStandards.js | 6 +- .../js/apps/about/components/EntryIssueTypes.js | 9 +- .../EntryIssueTypesForSonarQubeDotCom.js | 9 +- .../main/js/apps/account/notifications/Projects.js | 3 +- .../organizations/CreateOrganizationForm.js | 3 +- .../apps/account/profile/UserExternalIdentity.js | 3 +- .../main/js/apps/account/projects/ProjectCard.js | 3 +- .../background-tasks/components/CurrentsFilter.js | 3 +- .../js/apps/background-tasks/components/Stats.js | 6 +- .../background-tasks/components/TaskActions.js | 6 +- .../main/js/apps/code/components/ComponentName.js | 3 +- .../main/js/apps/code/components/ComponentPin.js | 3 +- .../component-measures/components/IconBubbles.js | 7 +- .../component-measures/components/IconHistory.js | 7 +- .../apps/component-measures/components/IconList.js | 7 +- .../apps/component-measures/components/IconTree.js | 7 +- .../component-measures/components/IconTreemap.js | 3 +- .../components/bubbleChart/BubbleChart.js | 9 +- .../component-measures/details/MeasureDetails.js | 9 +- .../details/drilldown/ComponentCell.js | 9 +- .../details/drilldown/MeasureDrilldown.js | 15 +- .../main/js/apps/component-measures/home/Home.js | 6 +- .../component-measures/home/MeasureListValue.js | 3 +- .../apps/component-measures/home/MeasuresList.js | 3 +- .../src/main/js/apps/organizations/actions.js | 11 +- .../organizations/components/MembersListItem.js | 5 +- .../organizations/components/OrganizationDelete.js | 6 +- .../components/OrganizationGroupCheckbox.js | 3 +- .../components/__tests__/MembersList-test.js | 7 +- .../components/__tests__/MembersListHeader-test.js | 8 +- .../components/__tests__/MembersListItem-test.js | 17 +- .../components/__tests__/MembersPageHeader-test.js | 4 +- .../components/forms/AddMemberForm.js | 3 +- .../components/forms/ManageMemberGroupsForm.js | 8 +- .../components/forms/RemoveMemberForm.js | 3 +- .../navigation/OrganizationNavigation.js | 12 +- .../js/apps/overview/components/OverviewApp.js | 3 +- .../src/main/js/apps/overview/main/Coverage.js | 6 +- .../src/main/js/apps/overview/main/Duplications.js | 6 +- .../src/main/js/apps/overview/meta/MetaLink.js | 3 +- .../js/apps/overview/meta/MetaQualityProfiles.js | 3 +- .../src/main/js/apps/overview/meta/MetaTags.js | 8 +- .../overview/qualityGate/QualityGateCondition.js | 3 +- .../overview/qualityGate/QualityGateConditions.js | 3 +- .../permission-templates/components/ActionsCell.js | 3 +- .../permission-templates/components/Template.js | 3 +- .../apps/permission-templates/views/GroupsView.js | 4 +- .../global/components/AllHoldersList.js | 3 +- .../project/components/AllHoldersList.js | 3 +- .../permissions/shared/components/GroupHolder.js | 3 +- .../permissions/shared/components/HoldersList.js | 6 +- .../permissions/shared/components/SearchForm.js | 3 +- .../permissions/shared/components/UserHolder.js | 3 +- .../src/main/js/apps/project-admin/key/Key.js | 6 +- .../main/js/apps/project-admin/key/UpdateForm.js | 3 +- .../components/forms/AddEventForm.js | 3 +- .../components/forms/ChangeEventForm.js | 3 +- .../components/forms/RemoveAnalysisForm.js | 3 +- .../components/forms/RemoveEventForm.js | 3 +- .../src/main/js/apps/projects-admin/header.js | 6 +- .../src/main/js/apps/projects-admin/projects.js | 3 +- .../src/main/js/apps/projects-admin/search.js | 3 +- .../js/apps/projects/components/FavoriteFilter.js | 6 +- .../js/apps/projects/filters/LanguagesFilter.js | 9 +- .../main/js/apps/projects/filters/SortingFilter.js | 6 +- .../main/js/apps/projects/filters/TagsFilter.js | 5 +- .../filters/__tests__/LanguagesFilter-test.js | 7 +- .../projects/filters/__tests__/TagsFilter-test.js | 4 +- .../apps/projects/visualizations/QualityModel.js | 6 +- .../projects/visualizations/SimpleBubbleChart.js | 19 +- .../js/apps/quality-gates/components/Condition.js | 9 +- .../main/js/apps/quality-gates/components/List.js | 3 +- .../quality-profiles/components/ProfileActions.js | 6 +- .../quality-profiles/components/ProfileLink.js | 3 +- .../components/__tests__/ProfileContainer-test.js | 9 +- .../apps/quality-profiles/details/ProfileHeader.js | 6 +- .../quality-profiles/details/ProfileProjects.js | 3 +- .../quality-profiles/home/EvolutionDeprecated.js | 3 +- .../js/apps/quality-profiles/home/PageHeader.js | 6 +- .../quality-profiles/home/ProfilesListHeader.js | 6 +- .../apps/quality-profiles/home/ProfilesListRow.js | 6 +- .../main/js/apps/sessions/components/LoginForm.js | 3 +- .../js/apps/sessions/components/Unauthorized.js | 2 +- .../apps/settings/components/DefinitionChanges.js | 3 +- .../settings/components/inputs/MultiValueInput.js | 3 +- .../settings/components/inputs/PropertySetInput.js | 6 +- .../js/apps/settings/encryption/EncryptionForm.js | 7 +- .../settings/encryption/GenerateSecretKeyForm.js | 15 +- server/sonar-web/src/main/js/apps/system/main.js | 3 +- .../main/js/apps/users/components/UsersSearch.js | 36 +-- .../users/components/UsersSelectSearchOption.js | 3 +- .../users/components/UsersSelectSearchValue.js | 3 +- .../src/main/js/apps/web-api/components/Action.js | 9 +- .../js/apps/web-api/components/DeprecatedBadge.js | 3 +- .../js/apps/web-api/components/InternalBadge.js | 3 +- .../src/main/js/apps/web-api/components/Menu.js | 3 +- .../src/main/js/apps/web-api/components/Search.js | 6 +- .../js/components/SourceViewer/SourceViewerCode.js | 6 +- .../components/SourceViewer/SourceViewerHeader.js | 6 +- .../SourceViewer/SourceViewerIssueLocations.js | 16 +- .../components/SourceViewer/components/LineCode.js | 3 +- .../SourceViewer/components/LineCoverage.js | 3 +- .../components/LineDuplicationBlock.js | 3 +- .../SourceViewer/components/LineDuplications.js | 3 +- .../SourceViewer/components/LineIssuesIndicator.js | 3 +- .../components/SourceViewer/components/LineSCM.js | 3 +- .../SourceViewer/popups/line-actions-popup.js | 3 +- .../src/main/js/components/charts/Timeline.js | 3 +- .../main/js/components/common/MultiSelectOption.js | 3 +- .../src/main/js/components/controls/DateInput.js | 4 +- .../main/js/components/controls/FavoriteBase.js | 4 +- .../components/controls/FavoriteBaseStateless.js | 4 +- .../main/js/components/controls/GlobalMessages.js | 3 +- .../src/main/js/components/controls/Toggle.js | 3 +- .../components/shared/complexity-distribution.js | 3 +- .../src/main/js/components/shared/pending-icon.js | 4 +- .../src/main/js/components/tags/TagsSelector.js | 3 +- .../js/helpers/handlebars/severityChangelog.js | 3 +- .../main/js/helpers/handlebars/severityHelper.js | 3 +- .../src/main/js/helpers/handlebars/statusHelper.js | 3 +- server/sonar-web/src/main/js/helpers/request.js | 4 +- .../src/main/js/store/globalMessages/duck.js | 3 +- .../src/main/js/store/organizations/duck.js | 8 +- .../main/js/store/organizationsMembers/actions.js | 17 +- .../main/js/store/organizationsMembers/reducer.js | 6 +- server/sonar-web/src/main/js/store/rootReducer.js | 3 +- server/sonar-web/yarn.lock | 241 +++++++++++++++++++-- 135 files changed, 566 insertions(+), 442 deletions(-) (limited to 'server/sonar-web') diff --git a/server/sonar-web/.eslintrc b/server/sonar-web/.eslintrc index 70b2aac1fa0..a03e1f19e92 100644 --- a/server/sonar-web/.eslintrc +++ b/server/sonar-web/.eslintrc @@ -33,7 +33,7 @@ "block-scoped-var": 2, "block-spacing": 2, "brace-style": 2, - "comma-dangle": 2, + "comma-dangle": [2, "never"], "comma-spacing": 2, "comma-style": 2, "computed-property-spacing": 2, @@ -49,7 +49,7 @@ "jsx-quotes": 2, "key-spacing": 2, "keyword-spacing": 2, - "max-len": [2, 120], + "max-len": [2, 100], "new-parens": 2, "no-lonely-if": 2, "no-multi-spaces": 2, @@ -135,6 +135,10 @@ "jsx-a11y/tabindex-no-positive": 2, "react/jsx-boolean-value": [2, "always"], + "react/jsx-closing-bracket-location": [2, { + "nonEmpty": "after-props", + "selfClosing": "tag-aligned" + }], "react/jsx-curly-spacing": [2, "never"], "react/jsx-equals-spacing": [2, "never"], "react/jsx-key": 2, diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 2c92554fba4..3defe39abc6 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -89,7 +89,7 @@ "less-loader": "2.2.3", "path-exists": "2.1.0", "postcss-loader": "0.8.0", - "prettier": "^0.22.0", + "prettier-eslint-cli": "^3.1.3", "react-addons-test-utils": "15.4.2", "react-dev-utils": "0.2.1", "react-transform-hmr": "1.0.4", @@ -108,7 +108,7 @@ "build": "node scripts/build.js", "test": "node scripts/test.js", "coverage": "npm test -- --coverage", - "format": "prettier --write --list-different --print-width 100 --single-quote --parser flow \"src/main/js/!(libs)/**/*.js\"", + "format": "prettier-eslint --write \"src/main/js/!(libs)/**/*.js\"", "lint": "eslint src/main/js", "typecheck": "flow src/main/js", "validate": "eslint src/main/js && flow check src/main/js && NODE_ENV=test jest --runInBand" diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooter.js b/server/sonar-web/src/main/js/app/components/GlobalFooter.js index 886de879bab..b88d06cc1c8 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooter.js +++ b/server/sonar-web/src/main/js/app/components/GlobalFooter.js @@ -36,8 +36,11 @@ class GlobalFooter extends React.Component { Embedded database should be used for evaluation purpose only

- The embedded database will not scale, it will not support upgrading to newer versions of SonarQube, - and there is no support for migrating your data out of it into a different database engine. + The embedded database will not scale, it will not support upgrading to newer + {' '} + versions of SonarQube, and there is no support for migrating your data out of it + {' '} + into a different database engine.

} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js index 05648e1bec5..2f668b0b8b9 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js @@ -50,8 +50,7 @@ class ComponentNavBreadcrumbs extends React.Component { } + className="link-base-color"> {index === breadcrumbs.length - 1 ? {item.name} : {item.name}} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.js index 6d3cc006dc3..6b5ba3661a8 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.js +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.js @@ -78,8 +78,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {this.isView() ? translate('view_projects.page') : translate('code.page')}
  • @@ -95,8 +94,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('project_activity.page')}
  • @@ -108,8 +106,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('issues.page')}
  • @@ -121,8 +118,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('layout.measures')}
  • @@ -141,8 +137,7 @@ export default class ComponentNavMenu extends React.Component { className="dropdown-toggle navbar-admin-link" id="component-navigation-admin" data-toggle="dropdown" - href="#" - > + href="#"> {translate('layout.settings')}  @@ -170,8 +165,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('project_settings.page')}
  • @@ -186,8 +180,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('project_quality_profiles.page')}
  • @@ -202,8 +195,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('project_quality_gate.page')}
  • @@ -218,8 +210,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('custom_measures.page')}
  • @@ -234,8 +225,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('project_links.page')}
  • @@ -250,8 +240,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('permissions.page')}
  • @@ -266,8 +255,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('background_tasks.page')}
  • @@ -282,8 +270,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('update_key.page')}
  • @@ -305,8 +292,7 @@ export default class ComponentNavMenu extends React.Component {
  • + activeClassName="active"> {translate('deletion.page')}
  • @@ -342,8 +328,7 @@ export default class ComponentNavMenu extends React.Component { className="dropdown-toggle" id="component-navigation-more" data-toggle="dropdown" - href="#" - > + href="#"> {translate('more')}  diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js index 57fda1a1492..01db375a81b 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavUser.js @@ -38,7 +38,8 @@ class GlobalNavUser extends React.Component { const shouldReturnToCurrentPage = window.location.pathname !== `${window.baseUrl}/about`; if (shouldReturnToCurrentPage) { const returnTo = encodeURIComponent(window.location.pathname + window.location.search); - window.location = `${window.baseUrl}/sessions/new?return_to=${returnTo}${window.location.hash}`; + window.location = window.baseUrl + + `/sessions/new?return_to=${returnTo}${window.location.hash}`; } else { window.location = `${window.baseUrl}/sessions/new`; } diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js index b82a5e22a60..4c183f4e4ab 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js +++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js @@ -87,8 +87,7 @@ class SettingsNav extends React.Component { className="dropdown-toggle" data-toggle="dropdown" id="settings-navigation-configuration" - href="#" - > + href="#"> {translate('sidebar.project_settings')}