diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2018-08-10 16:02:22 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-08-10 20:21:32 +0200 |
commit | d3530ff0004d44a2c4e9140ff9cc7774b8bc38a4 (patch) | |
tree | 03ad7aa9ab7d9bcfb0f5b354149da9c014052010 /server/sonar-web/src | |
parent | 29b5f4a0ebf686f9dee7f1d6c6eab65fe381654d (diff) | |
download | sonarqube-d3530ff0004d44a2c4e9140ff9cc7774b8bc38a4.tar.gz sonarqube-d3530ff0004d44a2c4e9140ff9cc7774b8bc38a4.zip |
update main dependencies & fix autofixable eslint warnings (#601)
Diffstat (limited to 'server/sonar-web/src')
241 files changed, 909 insertions, 776 deletions
diff --git a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx index c6440c317e0..4a14a53d0d7 100644 --- a/server/sonar-web/src/main/js/app/components/AdminContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/AdminContainer.tsx @@ -104,6 +104,7 @@ const mapDispatchToProps: DispatchToProps = { setAdminPages }; -export default connect<StateProps, DispatchToProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - AdminContainer -); +export default connect<StateProps, DispatchToProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(AdminContainer); diff --git a/server/sonar-web/src/main/js/app/components/App.tsx b/server/sonar-web/src/main/js/app/components/App.tsx index dca11f0b8eb..23211fbae33 100644 --- a/server/sonar-web/src/main/js/app/components/App.tsx +++ b/server/sonar-web/src/main/js/app/components/App.tsx @@ -100,4 +100,7 @@ const mapDispatchToProps = ({ fetchMyOrganizations } as any) as DispatchProps; -export default connect(mapStateToProps, mapDispatchToProps)(App); +export default connect( + mapStateToProps, + mapDispatchToProps +)(App); diff --git a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx index 176a21d06ac..00e376c5dfc 100644 --- a/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/ComponentContainer.tsx @@ -244,9 +244,15 @@ export class ComponentContainer extends React.PureComponent<Props, State> { return !task.branch && !task.pullRequest; }; - handleComponentChange = (changes: {}) => { + handleComponentChange = (changes: Partial<Component>) => { if (this.mounted) { - this.setState(state => ({ component: { ...state.component, ...changes } })); + this.setState(state => { + if (state.component) { + const newComponent: Component = { ...state.component, ...changes }; + return { component: newComponent }; + } + return null; + }); } }; @@ -309,4 +315,7 @@ export class ComponentContainer extends React.PureComponent<Props, State> { const mapDispatchToProps = { fetchOrganizations }; -export default connect<any, any, any>(null, mapDispatchToProps)(ComponentContainer); +export default connect<any, any, any>( + null, + mapDispatchToProps +)(ComponentContainer); diff --git a/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.js b/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.js index 8ce14f4c343..8f1f47e880d 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.js +++ b/server/sonar-web/src/main/js/app/components/GlobalFooterBranding.js @@ -30,7 +30,8 @@ export default function GlobalFooterBranding() { but is <strong>not</strong> an official version provided by{' '} <a href="http://www.sonarsource.com" title="SonarSource SA"> SonarSource SA - </a>. + </a> + . </div> ); } diff --git a/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.js b/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx index f159a481b7b..d8366702bc8 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.js +++ b/server/sonar-web/src/main/js/app/components/GlobalMessagesContainer.tsx @@ -22,10 +22,13 @@ import GlobalMessages from '../../components/controls/GlobalMessages'; import { getGlobalMessages } from '../../store/rootReducer'; import { closeGlobalMessage } from '../../store/globalMessages/duck'; -const mapStateToProps = state => ({ +const mapStateToProps = (state: any) => ({ messages: getGlobalMessages(state) }); const mapDispatchToProps = { closeGlobalMessage }; -export default connect(mapStateToProps, mapDispatchToProps)(GlobalMessages); +export default connect( + mapStateToProps, + mapDispatchToProps +)(GlobalMessages); diff --git a/server/sonar-web/src/main/js/app/components/MarkdownHelp.js b/server/sonar-web/src/main/js/app/components/MarkdownHelp.js index 1a2c67397c7..f4b957da4f0 100644 --- a/server/sonar-web/src/main/js/app/components/MarkdownHelp.js +++ b/server/sonar-web/src/main/js/app/components/MarkdownHelp.js @@ -54,8 +54,8 @@ export default function MarkdownHelp() { </tr> <tr> <td className="text-top"> - * first item<br /> - * second item + * first item + <br />* second item </td> <td className="markdown"> <ul> @@ -66,7 +66,8 @@ export default function MarkdownHelp() { </tr> <tr> <td className="text-top"> - 1. first item<br /> + 1. first item + <br /> 1. second item </td> <td className="markdown text-top"> @@ -102,11 +103,15 @@ export default function MarkdownHelp() { </tr> <tr> <td className="text-top"> - ``<br /> - // code on multiple lines<br /> + `` + {/* eslint-disable-next-line react/jsx-no-comment-textnodes */} + <br /> + // code on multiple lines + <br /> {'public void foo() {'} <br /> - {'// do some logic here'} + + {'// do some logic here'} <br /> {'}'} <br /> @@ -120,15 +125,20 @@ export default function MarkdownHelp() { </tr> <tr> <td className="text-top"> - Standard text<br /> - > Blockquoted text<br /> - > that spans multiple lines<br /> + Standard text + <br /> + > Blockquoted text + <br /> + > that spans multiple lines + <br /> </td> <td className="markdown text-top"> <p>Standard text</p> <blockquote> - Blockquoted text<br /> - that spans multiple lines<br /> + Blockquoted text + <br /> + that spans multiple lines + <br /> </blockquote> </td> </tr> diff --git a/server/sonar-web/src/main/js/app/components/StartupModal.tsx b/server/sonar-web/src/main/js/app/components/StartupModal.tsx index 7930a9b7f21..9383ec2539e 100644 --- a/server/sonar-web/src/main/js/app/components/StartupModal.tsx +++ b/server/sonar-web/src/main/js/app/components/StartupModal.tsx @@ -106,7 +106,7 @@ export class StartupModal extends React.PureComponent<Props, State> { this.props.skipOnboardingAction(); return { automatic: false, modal: undefined }; } - return undefined; + return null; }); }; @@ -115,7 +115,7 @@ export class StartupModal extends React.PureComponent<Props, State> { if (state.modal === ModalKey.license) { return { automatic: false, modal: undefined }; } - return undefined; + return null; }); }; @@ -223,6 +223,7 @@ const mapStateToProps = (state: any): StateProps => ({ const mapDispatchToProps: DispatchProps = { skipOnboardingAction }; -export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - StartupModal -); +export default connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(StartupModal); diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx index 21cf0bd5bed..909c6a5d1d4 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx +++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import * as PropTypes from 'prop-types'; // eslint-disable-next-line import/no-extraneous-dependencies -import suggestionsJson from 'Docs/EmbedDocsSuggestions.json'; +import * as suggestionsJson from 'Docs/EmbedDocsSuggestions.json'; import { SuggestionsContext } from './SuggestionsContext'; import { isSonarCloud } from '../../../helpers/system'; diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx index c7ca9442a89..2092c80a14d 100644 --- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx +++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx @@ -25,10 +25,8 @@ import { isSonarCloud } from '../../../../helpers/system'; jest.mock( 'Docs/EmbedDocsSuggestions.json', () => ({ - default: { - pageA: [{ link: '/foo', text: 'Foo' }, { link: '/bar', text: 'Bar', scope: 'sonarcloud' }], - pageB: [{ link: '/qux', text: 'Qux' }] - } + pageA: [{ link: '/foo', text: 'Foo' }, { link: '/bar', text: 'Bar', scope: 'sonarcloud' }], + pageB: [{ link: '/qux', text: 'Qux' }] }), { virtual: true } ); diff --git a/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx b/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx index e24cb825b9b..c3c56057669 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/extensions/ExtensionContainer.tsx @@ -28,4 +28,7 @@ const mapStateToProps = (state: any) => ({ const mapDispatchToProps = { onFail: addGlobalErrorMessage }; -export default connect<any, any, any>(mapStateToProps, mapDispatchToProps)(Extension); +export default connect<any, any, any>( + mapStateToProps, + mapDispatchToProps +)(Extension); diff --git a/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx b/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx index d5875a4f851..c38e996c2a3 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx +++ b/server/sonar-web/src/main/js/app/components/extensions/OrganizationPageExtension.tsx @@ -80,6 +80,7 @@ const mapStateToProps = (state: any, ownProps: OwnProps) => ({ const mapDispatchToProps = { fetchOrganization }; -export default connect<StateToProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - OrganizationPageExtension -); +export default connect<StateToProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(OrganizationPageExtension); diff --git a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js index 1c584fc30ee..45c7a677a18 100644 --- a/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js +++ b/server/sonar-web/src/main/js/app/components/extensions/ProjectAdminPageExtension.js @@ -54,4 +54,7 @@ function ProjectAdminPageExtension(props /*: Props */) { const mapDispatchToProps = { onFail: addGlobalErrorMessage }; -export default connect(null, mapDispatchToProps)(ProjectAdminPageExtension); +export default connect( + null, + mapDispatchToProps +)(ProjectAdminPageExtension); diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx index 1accbd77863..31983bc3913 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx @@ -109,7 +109,7 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li> - <Link to={{ pathname: '/code', query: this.getQuery() }} activeClassName="active"> + <Link activeClassName="active" to={{ pathname: '/code', query: this.getQuery() }}> {this.isPortfolio() || this.isApplication() ? translate('view_projects.page') : translate('code.page')} @@ -128,8 +128,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li> <Link - to={{ pathname: '/project/activity', query: this.getQuery() }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/activity', query: this.getQuery() }}> {translate('project_activity.page')} </Link> </li> @@ -161,8 +161,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li> <Link - to={{ pathname: '/component_measures', query: this.getQuery() }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/component_measures', query: this.getQuery() }}> {translate('layout.measures')} </Link> </li> @@ -206,7 +206,7 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { <Dropdown overlay={this.renderSecurityReportsLink()} tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: isActive || open })} href="#" @@ -240,7 +240,7 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: isSettingsActive || open })} href="#" @@ -278,8 +278,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="settings"> <Link - to={{ pathname: '/project/settings', query: this.getQuery() }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/settings', query: this.getQuery() }}> {translate('project_settings.page')} </Link> </li> @@ -298,8 +298,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="branches"> <Link - to={{ pathname: '/project/branches', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/branches', query: { id: this.props.component.key } }}> {translate('project_branches.page')} </Link> </li> @@ -313,8 +313,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="profiles"> <Link - to={{ pathname: '/project/quality_profiles', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/quality_profiles', query: { id: this.props.component.key } }}> {translate('project_quality_profiles.page')} </Link> </li> @@ -328,8 +328,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="quality_gate"> <Link - to={{ pathname: '/project/quality_gate', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/quality_gate', query: { id: this.props.component.key } }}> {translate('project_quality_gate.page')} </Link> </li> @@ -343,8 +343,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="custom_measures"> <Link - to={{ pathname: '/custom_measures', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/custom_measures', query: { id: this.props.component.key } }}> {translate('custom_measures.page')} </Link> </li> @@ -358,8 +358,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="links"> <Link - to={{ pathname: '/project/links', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/links', query: { id: this.props.component.key } }}> {translate('project_links.page')} </Link> </li> @@ -373,8 +373,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="permissions"> <Link - to={{ pathname: '/project_roles', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project_roles', query: { id: this.props.component.key } }}> {translate('permissions.page')} </Link> </li> @@ -388,8 +388,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="background_tasks"> <Link - to={{ pathname: '/project/background_tasks', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/background_tasks', query: { id: this.props.component.key } }}> {translate('background_tasks.page')} </Link> </li> @@ -403,8 +403,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="update_key"> <Link - to={{ pathname: '/project/key', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/key', query: { id: this.props.component.key } }}> {translate('update_key.page')} </Link> </li> @@ -418,8 +418,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="webhooks"> <Link - to={{ pathname: '/project/webhooks', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/webhooks', query: { id: this.props.component.key } }}> {translate('webhooks.page')} </Link> </li> @@ -440,8 +440,8 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { return ( <li key="project_delete"> <Link - to={{ pathname: '/project/deletion', query: { id: this.props.component.key } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/project/deletion', query: { id: this.props.component.key } }}> {translate('deletion.page')} </Link> </li> @@ -481,7 +481,7 @@ export default class ComponentNavMenu extends React.PureComponent<Props> { tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: open })} href="#" diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx index ccb40acc1f6..6bb9590573a 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavMenu.tsx @@ -163,7 +163,7 @@ export default class GlobalNavMenu extends React.PureComponent<Props> { tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: open })} href="#" diff --git a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx index 58030362c11..629bdc20180 100644 --- a/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/global/GlobalNavPlus.tsx @@ -84,7 +84,7 @@ export default class GlobalNavPlus extends React.PureComponent<Props, State> { {({ onToggleClick, open }) => ( <> <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className="navbar-plus" href="#" diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx index d5571dd9248..82d644a9345 100644 --- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.tsx @@ -120,7 +120,7 @@ export default class SettingsNav extends React.PureComponent<Props> { tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: @@ -165,7 +165,7 @@ export default class SettingsNav extends React.PureComponent<Props> { tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: open || this.isProjectsActive() })} href="#" @@ -215,7 +215,7 @@ export default class SettingsNav extends React.PureComponent<Props> { tagName="li"> {({ onToggleClick, open }) => ( <a - aria-expanded={String(open)} + aria-expanded={open} aria-haspopup="true" className={classNames('dropdown-toggle', { active: open || this.isSecurityActive() })} href="#" diff --git a/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js b/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js index 5b46e9934cd..a05ea9b4e98 100644 --- a/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js +++ b/server/sonar-web/src/main/js/app/components/search/SearchShowMore.js @@ -54,7 +54,7 @@ export default class SearchShowMore extends React.PureComponent { const { loadingMore, qualifier, selected } = this.props; return ( - <li key={`more-${qualifier}`} className={classNames('menu-footer', { active: selected })}> + <li className={classNames('menu-footer', { active: selected })} key={`more-${qualifier}`}> <DeferredSpinner className="navbar-search-icon" loading={loadingMore === qualifier}> <a className={classNames({ 'cursor-not-allowed': !this.props.allowMore })} diff --git a/server/sonar-web/src/main/js/app/styles/components/boxed-group.css b/server/sonar-web/src/main/js/app/styles/components/boxed-group.css index 5a79c7f70e8..08e25e19aa9 100644 --- a/server/sonar-web/src/main/js/app/styles/components/boxed-group.css +++ b/server/sonar-web/src/main/js/app/styles/components/boxed-group.css @@ -64,8 +64,8 @@ } .boxed-group-list { - margin-top: - var(--gridSize); - margin-bottom: - var(--gridSize); + margin-top: -var(--gridSize); + margin-bottom: -var(--gridSize); } .boxed-group-list > li { diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js index 5221f845d5d..c1d319015f1 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutApp.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutApp.js @@ -219,4 +219,7 @@ const mapStateToProps = state => ({ const mapDispatchToProps = { fetchAboutPageSettings }; -export default connect(mapStateToProps, mapDispatchToProps)(AboutApp); +export default connect( + mapStateToProps, + mapDispatchToProps +)(AboutApp); diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js index 2d3a26dd89b..ded5a77736f 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutProjects.js @@ -37,7 +37,7 @@ export default function AboutProjects({ count, loading } /*: Props */) { {!loading && ( <div> <div> - <Link to="/projects" className="about-page-projects-link"> + <Link className="about-page-projects-link" to="/projects"> {formatMeasure(count, 'INT')} </Link> </div> diff --git a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js index 9d79e0c4b0f..42ad663a7ad 100644 --- a/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js +++ b/server/sonar-web/src/main/js/apps/about/components/AboutScanners.js @@ -55,11 +55,11 @@ export default function AboutScanners() { <p className="about-page-text">{translate('about_page.scanners.text')}</p> <div className="about-page-analyzers"> {scanners.map(scanner => ( - <a key={scanner.key} className="about-page-analyzer-box" href={scanner.link}> + <a className="about-page-analyzer-box" href={scanner.link} key={scanner.key}> <img - src={`${window.baseUrl}/images/scanner-logos/${scanner.key}.svg`} - height={60} alt={translate('about_page.scanners', scanner.key)} + height={60} + src={`${window.baseUrl}/images/scanner-logos/${scanner.key}.svg`} /> </a> ))} diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js index 31e5fb7a3c4..499df6ce3a2 100644 --- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js +++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js @@ -48,8 +48,8 @@ export default function EntryIssueTypes( <tr> <td className="about-page-issue-type-number"> <Link - to={getIssuesUrl({ resolved: 'false', types: 'BUG', s: 'CREATION_DATE' })} - className="about-page-issue-type-link"> + className="about-page-issue-type-link" + to={getIssuesUrl({ resolved: 'false', types: 'BUG', s: 'CREATION_DATE' })}> {formatMeasure(bugs, 'SHORT_INT')} </Link> </td> @@ -63,12 +63,12 @@ export default function EntryIssueTypes( <tr> <td className="about-page-issue-type-number"> <Link + className="about-page-issue-type-link" to={getIssuesUrl({ resolved: 'false', types: 'VULNERABILITY', s: 'CREATION_DATE' - })} - className="about-page-issue-type-link"> + })}> {formatMeasure(vulnerabilities, 'SHORT_INT')} </Link> </td> @@ -82,8 +82,8 @@ export default function EntryIssueTypes( <tr> <td className="about-page-issue-type-number"> <Link - to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL', s: 'CREATION_DATE' })} - className="about-page-issue-type-link"> + className="about-page-issue-type-link" + to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL', s: 'CREATION_DATE' })}> {formatMeasure(codeSmells, 'SHORT_INT')} </Link> </td> diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/AsAService.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/AsAService.tsx index 8c4938558db..fad4823c0e1 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/AsAService.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/AsAService.tsx @@ -36,8 +36,8 @@ export default function AsAService() { <img alt="" height="34" src={`${getBaseUrl()}/images/sonarcloud/as-a-service.svg`} /> <h1 className="sc-child-title">As a Service</h1> <p className="sc-child-lead"> - We fully operate the SonarQube base service, <br />which is hosted in Frankfurt, - Germany. + We fully operate the SonarQube base service, <br /> + which is hosted in Frankfurt, Germany. </p> <img alt="" diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/BranchAnalysis.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/BranchAnalysis.tsx index 49b8f302b1c..19c5f5dddd2 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/BranchAnalysis.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/BranchAnalysis.tsx @@ -35,11 +35,12 @@ export default function BranchAnalysis() { <div className="sc-child-header"> <img alt="" height="34" src={`${getBaseUrl()}/images/sonarcloud/branch-analysis.svg`} /> <h1 className="sc-child-title"> - Branch analysis & <br />pull request decoration + Branch analysis & <br /> + pull request decoration </h1> <p className="sc-child-lead"> - SonarCloud comes with a built-in feature to automatically analyze <br />project - branches and pull requests as soon as they get created. + SonarCloud comes with a built-in feature to automatically analyze <br /> + project branches and pull requests as soon as they get created. </p> </div> diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/Footer.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/Footer.tsx index 01efb8943f4..5dd6848f767 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/Footer.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/Footer.tsx @@ -137,14 +137,16 @@ export default function Footer() { rel="noopener noreferrer" target="_blank"> SonarSource SA - </a>. All rights reserved. SonarCloud is a service operated by{' '} + </a> + . All rights reserved. SonarCloud is a service operated by{' '} <a className="sc-footer-link sc-footer-copy-link" href="https://www.sonarsource.com" rel="noopener noreferrer" target="_blank"> SonarSource - </a>, the company that develops and promotes open source{' '} + </a> + , the company that develops and promotes open source{' '} <a className="sc-footer-link sc-footer-copy-link" href="http://sonarqube.org" @@ -159,7 +161,8 @@ export default function Footer() { rel="noopener noreferrer" target="_blank"> SonarLint - </a>. + </a> + . </div> </div> </footer> diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/Home.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/Home.tsx index 629a1730dba..21f62fb4f5d 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/Home.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/Home.tsx @@ -33,8 +33,8 @@ export default function Home() { <div className="page page-limited sc-page"> <h1 className="sc-page-title">Continuous Code Quality Online</h1> <p className="sc-page-subtitle"> - Analyze the quality of your source code to detect bugs, vulnerabilities <br />and code - smells throughout the development process. + Analyze the quality of your source code to detect bugs, vulnerabilities <br /> + and code smells throughout the development process. </p> <ul className="sc-features-list"> @@ -91,8 +91,8 @@ export default function Home() { <div className="sc-narrow-container text-center"> <h2 className="sc-feature-title">Explore open source projects on SonarCloud</h2> <p className="sc-feature-description"> - SonarCloud offers free analysis for open source projects. <br />It is public and open - to anyone who wants to browse the service. + SonarCloud offers free analysis for open source projects. <br /> + It is public and open to anyone who wants to browse the service. </p> </div> diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/Pricing.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/Pricing.tsx index 3943b5eced5..8340323d357 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/Pricing.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/Pricing.tsx @@ -33,7 +33,8 @@ export default function Pricing() { <h3 className="sc-pricing-title">Private Projects</h3> <span className="sc-pricing-small">14 days free trial</span> <strong> - From <span className="sc-pricing-price">10€</span>/mo + From <span className="sc-pricing-price">10€</span> + /mo </strong> <Link className="sc-news-link" to="/documentation/sonarcloud-pricing"> see prices diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/SQHome.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/SQHome.tsx index 7d9067e3a0d..1b0bfe98092 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/SQHome.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/SQHome.tsx @@ -52,12 +52,14 @@ function Jumbotron() { <div className="sc-sq-jumbotron"> <div className="sc-sq-jumbotron-left"> <h1 className="sc-sq-jumbotron-title"> - Use SonarQube<br /> + Use SonarQube + <br /> <span className="sc-sq-jumbotron-title-orange">as a Service</span> </h1> <div className="sc-sq-jumbotron-login"> {'—'} - <br />Log in or sign up with + <br /> + Log in or sign up with </div> <div> <a diff --git a/server/sonar-web/src/main/js/apps/about/sonarcloud/SonarLintIntegration.tsx b/server/sonar-web/src/main/js/apps/about/sonarcloud/SonarLintIntegration.tsx index 17fe58eee42..69a0bceabbe 100644 --- a/server/sonar-web/src/main/js/apps/about/sonarcloud/SonarLintIntegration.tsx +++ b/server/sonar-web/src/main/js/apps/about/sonarcloud/SonarLintIntegration.tsx @@ -44,8 +44,8 @@ export default function SonarLintIntegration() { <a className="sc-child-lead-link" href="https://www.sonarlint.org/"> SonarLint </a>{' '} - to provide developers maximum insight <br />in their IDEs on code quality and make - sure they do not introduce new issues. + to provide developers maximum insight <br /> + in their IDEs on code quality and make sure they do not introduce new issues. </p> <img alt="" diff --git a/server/sonar-web/src/main/js/apps/account/components/Account.js b/server/sonar-web/src/main/js/apps/account/components/Account.js index 0266a3efaf6..bb4e8645692 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Account.js +++ b/server/sonar-web/src/main/js/apps/account/components/Account.js @@ -50,7 +50,7 @@ class Account extends React.PureComponent { <header className="account-header"> <div className="account-container clearfix"> <UserCard user={currentUser} /> - <Nav user={currentUser} customOrganizations={this.props.customOrganizations} /> + <Nav customOrganizations={this.props.customOrganizations} user={currentUser} /> </div> </header> diff --git a/server/sonar-web/src/main/js/apps/account/components/Nav.js b/server/sonar-web/src/main/js/apps/account/components/Nav.js index d08adb2e20b..8688985c311 100644 --- a/server/sonar-web/src/main/js/apps/account/components/Nav.js +++ b/server/sonar-web/src/main/js/apps/account/components/Nav.js @@ -34,30 +34,30 @@ export default function Nav({ customOrganizations } /*: Props */) { <nav className="account-nav"> <NavBarTabs> <li> - <IndexLink to="/account/" activeClassName="active"> + <IndexLink activeClassName="active" to="/account/"> {translate('my_account.profile')} </IndexLink> </li> <li> - <Link to="/account/security/" activeClassName="active"> + <Link activeClassName="active" to="/account/security/"> {translate('my_account.security')} </Link> </li> <li> - <Link to="/account/notifications" activeClassName="active"> + <Link activeClassName="active" to="/account/notifications"> {translate('my_account.notifications')} </Link> </li> {!customOrganizations && ( <li> - <Link to="/account/projects/" activeClassName="active"> + <Link activeClassName="active" to="/account/projects/"> {translate('my_account.projects')} </Link> </li> )} {customOrganizations && ( <li> - <Link to="/account/organizations" activeClassName="active"> + <Link activeClassName="active" to="/account/organizations"> {translate('my_account.organizations')} </Link> </li> diff --git a/server/sonar-web/src/main/js/apps/account/components/UserCard.js b/server/sonar-web/src/main/js/apps/account/components/UserCard.js index c5299f13bb9..a67a2ef2eb0 100644 --- a/server/sonar-web/src/main/js/apps/account/components/UserCard.js +++ b/server/sonar-web/src/main/js/apps/account/components/UserCard.js @@ -31,10 +31,10 @@ export default class UserCard extends React.PureComponent { return ( <div className="account-user"> - <div id="avatar" className="pull-left account-user-avatar"> + <div className="pull-left account-user-avatar" id="avatar"> <Avatar hash={user.avatar} name={user.name} size={60} /> </div> - <h1 id="name" className="pull-left"> + <h1 className="pull-left" id="name"> {user.name} </h1> </div> diff --git a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsContainer.tsx b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsContainer.tsx index 7c05e0f1616..08430793fcd 100644 --- a/server/sonar-web/src/main/js/apps/account/notifications/NotificationsContainer.tsx +++ b/server/sonar-web/src/main/js/apps/account/notifications/NotificationsContainer.tsx @@ -23,4 +23,7 @@ import { fetchOrganizations } from '../../../store/rootActions'; const mapDispatchToProps = { fetchOrganizations } as Pick<Props, 'fetchOrganizations'>; -export default connect(null, mapDispatchToProps)(Notifications); +export default connect( + null, + mapDispatchToProps +)(Notifications); diff --git a/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.tsx b/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.tsx index a6dca76e8aa..25636965522 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.tsx +++ b/server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.tsx @@ -246,4 +246,7 @@ class CreateOrganizationForm extends React.PureComponent<Props, State> { const mapDispatchToProps: DispatchProps = { createOrganization: createOrganization as any }; -export default connect(null, mapDispatchToProps)(CreateOrganizationForm); +export default connect( + null, + mapDispatchToProps +)(CreateOrganizationForm); diff --git a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx index 53010e8e63c..db53d626a83 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx +++ b/server/sonar-web/src/main/js/apps/account/organizations/OrganizationCard.tsx @@ -50,7 +50,7 @@ export default function OrganizationCard({ organization }: Props) { {!!organization.url && ( <div className="markdown spacer-top"> - <a href={organization.url} title={organization.url} rel="nofollow"> + <a href={organization.url} rel="nofollow" title={organization.url}> {organization.url} </a> </div> diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx index 9bf4071c8b0..c3768ee5e5c 100644 --- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx +++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.tsx @@ -120,4 +120,7 @@ const mapDispatchToProps = { fetchIfAnyoneCanCreateOrganizations: fetchIfAnyoneCanCreateOrganizations as any } as DispatchProps; -export default connect(mapStateToProps, mapDispatchToProps)(UserOrganizations); +export default connect( + mapStateToProps, + mapDispatchToProps +)(UserOrganizations); diff --git a/server/sonar-web/src/main/js/apps/account/profile/Profile.js b/server/sonar-web/src/main/js/apps/account/profile/Profile.js index aa4b8c0ed85..3b91c7649dc 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/Profile.js +++ b/server/sonar-web/src/main/js/apps/account/profile/Profile.js @@ -52,7 +52,7 @@ function Profile(props /*: Props */) { {!user.local && user.externalProvider !== 'sonarqube' && ( - <div id="identity-provider" className="spacer-bottom"> + <div className="spacer-bottom" id="identity-provider"> <UserExternalIdentity user={user} /> </div> )} @@ -68,7 +68,7 @@ function Profile(props /*: Props */) { <hr /> - <UserScmAccounts user={user} scmAccounts={user.scmAccounts} /> + <UserScmAccounts scmAccounts={user.scmAccounts} user={user} /> </div> </div> ); diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.js b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.js index 2148e50098f..8e0536fe3ac 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.js +++ b/server/sonar-web/src/main/js/apps/account/profile/UserExternalIdentity.js @@ -87,11 +87,11 @@ export default class UserExternalIdentity extends React.PureComponent { color: getTextColor(identityProvider.backgroundColor, theme.secondFontColor) }}> <img + alt={identityProvider.name} className="little-spacer-right" + height="14" src={window.baseUrl + identityProvider.iconPath} width="14" - height="14" - alt={identityProvider.name} />{' '} {user.externalIdentity} </div> diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js b/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js index c4816fb66cd..f81ba233119 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js +++ b/server/sonar-web/src/main/js/apps/account/profile/UserGroups.js @@ -34,7 +34,7 @@ export default class UserGroups extends React.PureComponent { <h2 className="spacer-bottom">{translate('my_profile.groups')}</h2> <ul id="groups"> {groups.map(group => ( - <li key={group} className="little-spacer-bottom" title={group}> + <li className="little-spacer-bottom" key={group} title={group}> {group} </li> ))} diff --git a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js index 324af5716a4..a306959eade 100644 --- a/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js +++ b/server/sonar-web/src/main/js/apps/account/profile/UserScmAccounts.js @@ -45,7 +45,7 @@ export default class UserScmAccounts extends React.PureComponent { )} {scmAccounts.map(scmAccount => ( - <li key={scmAccount} className="little-spacer-bottom" title={scmAccount}> + <li className="little-spacer-bottom" key={scmAccount} title={scmAccount}> {scmAccount} </li> ))} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/background-tasks-test.js b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/background-tasks-test.js index 2e10882d6b8..f4f686fd287 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/__tests__/background-tasks-test.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/__tests__/background-tasks-test.js @@ -81,21 +81,21 @@ describe('Stats', () => { describe('Pending', () => { it('should show zero pending', () => { const result = shallow( - <Stats pendingCount={0} onCancelAllPending={stub} onShowFailing={stub} /> + <Stats onCancelAllPending={stub} onShowFailing={stub} pendingCount={0} /> ); expect(result.find('.js-pending-count').text()).toContain('0'); }); it('should show 5 pending', () => { const result = shallow( - <Stats pendingCount={5} onCancelAllPending={stub} onShowFailing={stub} /> + <Stats onCancelAllPending={stub} onShowFailing={stub} pendingCount={5} /> ); expect(result.find('.js-pending-count').text()).toContain('5'); }); it('should not show cancel pending button', () => { const result = shallow( - <Stats pendingCount={0} onCancelAllPending={stub} onShowFailing={stub} /> + <Stats onCancelAllPending={stub} onShowFailing={stub} pendingCount={0} /> ); expect(result.find('.js-cancel-pending').length).toBe(0); }); @@ -104,9 +104,9 @@ describe('Stats', () => { const result = shallow( <Stats isSystemAdmin={true} - pendingCount={5} onCancelAllPending={stub} onShowFailing={stub} + pendingCount={5} /> ); expect(result.find('.js-cancel-pending').length).toBe(1); @@ -117,9 +117,9 @@ describe('Stats', () => { const result = shallow( <Stats isSystemAdmin={true} - pendingCount={5} onCancelAllPending={spy} onShowFailing={stub} + pendingCount={5} /> ); expect(spy).not.toBeCalled(); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js index 94090edd286..20329eafbaf 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js @@ -270,4 +270,7 @@ class BackgroundTasksApp extends React.PureComponent { const mapDispatchToProps = { fetchOrganizations }; -export default connect(null, mapDispatchToProps)(BackgroundTasksApp); +export default connect( + null, + mapDispatchToProps +)(BackgroundTasksApp); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx index 45f653857b0..7e66a3e007e 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/ScannerContext.tsx @@ -84,7 +84,7 @@ export default class ScannerContext extends React.PureComponent<Props, State> { </div> <div className="modal-foot"> - <a href="#" className="js-modal-close" onClick={this.handleCloseClick}> + <a className="js-modal-close" href="#" onClick={this.handleCloseClick}> {translate('close')} </a> </div> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx index 1ea9befbc89..21cdf7ec937 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Stacktrace.tsx @@ -100,7 +100,7 @@ export default class Stacktrace extends React.PureComponent<Props, State> { </div> <div className="modal-foot"> - <a href="#" className="js-modal-close" onClick={this.handleCloseClick}> + <a className="js-modal-close" href="#" onClick={this.handleCloseClick}> {translate('close')} </a> </div> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx index 3892a59cd0a..9b11cc91891 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx @@ -25,9 +25,9 @@ it('renders', () => { expect(shallow(<TaskDate />)).toMatchSnapshot(); expect(shallow(<TaskDate date="2017-01-01T00:00:00.000Z" />)).toMatchSnapshot(); expect( - shallow(<TaskDate date="2017-01-01T00:00:00.000Z" baseDate="2017-01-01T00:00:00.000Z" />) + shallow(<TaskDate baseDate="2017-01-01T00:00:00.000Z" date="2017-01-01T00:00:00.000Z" />) ).toMatchSnapshot(); expect( - shallow(<TaskDate date="2017-01-05T00:00:00.000Z" baseDate="2017-01-01T00:00:00.000Z" />) + shallow(<TaskDate baseDate="2017-01-01T00:00:00.000Z" date="2017-01-05T00:00:00.000Z" />) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx index 185dd6d8f34..9f03fb4348d 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx @@ -24,13 +24,13 @@ import TaskDay from '../TaskDay'; it('renders', () => { expect( shallow( - <TaskDay submittedAt="2017-01-02T00:00:00.000Z" prevSubmittedAt="2017-01-01T00:00:00.000Z" /> + <TaskDay prevSubmittedAt="2017-01-01T00:00:00.000Z" submittedAt="2017-01-02T00:00:00.000Z" /> ) ).toMatchSnapshot(); expect( shallow( - <TaskDay submittedAt="2017-01-01T00:00:00.000Z" prevSubmittedAt="2017-01-01T00:00:00.000Z" /> + <TaskDay prevSubmittedAt="2017-01-01T00:00:00.000Z" submittedAt="2017-01-01T00:00:00.000Z" /> ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/code/components/App.tsx b/server/sonar-web/src/main/js/apps/code/components/App.tsx index 56b2dcf6de5..f7a7354b0e6 100644 --- a/server/sonar-web/src/main/js/apps/code/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/App.tsx @@ -239,7 +239,7 @@ export default class App extends React.PureComponent<Props, State> { {sourceViewer === undefined && components !== undefined && ( - <ListFooter count={components.length} total={total} loadMore={this.handleLoadMore} /> + <ListFooter count={components.length} loadMore={this.handleLoadMore} total={total} /> )} {sourceViewer !== undefined && ( diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx index abeeacc511a..6315df5dcd3 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx @@ -176,7 +176,7 @@ export default class Search extends React.PureComponent<Props, State> { const isPortfolio = ['VW', 'SVW', 'APP'].includes(component.qualifier); return ( - <div id="code-search" className={containerClassName}> + <div className={containerClassName} id="code-search"> <SearchBox minLength={3} onChange={this.handleQueryChange} diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx index 19f179aca95..320c759103e 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/App.tsx @@ -467,12 +467,14 @@ export class App extends React.PureComponent<Props, State> { }); handleRuleDeactivate = (profile: string, rule: string) => - this.setState((state: State) => { + this.setState(state => { const { actives } = state; if (actives && actives[rule]) { - return { actives: { ...actives, [rule]: { ...actives[rule], [profile]: undefined } } }; + const newRule = { ...actives[rule] }; + delete newRule[profile]; + return { actives: { ...actives, [rule]: newRule } }; } - return {}; + return null; }); handleSearch = (searchQuery: string) => this.handleFilterChange({ searchQuery }); diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx index e3076a11b3f..309e99dcf1d 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx @@ -131,13 +131,10 @@ export default class CustomRuleFormModal extends React.PureComponent<Props, Stat handleNameChange = (event: React.SyntheticEvent<HTMLInputElement>) => { const { value: name } = event.currentTarget; - this.setState((state: State) => { - const change: Partial<State> = { name }; - if (!state.keyModifiedByUser) { - change.key = latinize(name).replace(/[^A-Za-z0-9]/g, '_'); - } - return change; - }); + this.setState(state => ({ + name, + key: state.keyModifiedByUser ? state.key : latinize(name).replace(/[^A-Za-z0-9]/g, '_') + })); }; handleKeyChange = (event: React.SyntheticEvent<HTMLInputElement>) => diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx index 0b07f5b597d..dcdc5b733dd 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetails.tsx @@ -104,14 +104,19 @@ export default class RuleDetails extends React.PureComponent<Props, State> { handleTagsChange = (tags: string[]) => { // optimistic update const oldTags = this.state.ruleDetails && this.state.ruleDetails.tags; - this.setState(state => ({ ruleDetails: { ...state.ruleDetails, tags } })); + this.setState( + state => (state.ruleDetails ? { ruleDetails: { ...state.ruleDetails, tags } } : null) + ); updateRule({ key: this.props.ruleKey, organization: this.props.organization, tags: tags.join() }).catch(() => { if (this.mounted) { - this.setState(state => ({ ruleDetails: { ...state.ruleDetails, tags: oldTags } })); + this.setState( + state => + state.ruleDetails ? { ruleDetails: { ...state.ruleDetails, tags: oldTags } } : null + ); } }); }; diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.js b/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.js index 54d63a4dddd..b02d379358c 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/AppContainer.js @@ -74,4 +74,7 @@ const fetchMeasures = ( const mapDispatchToProps = { fetchMeasures, fetchMetrics }; -export default connect(mapStateToProps, mapDispatchToProps)(withRouter(App)); +export default connect( + mapStateToProps, + mapDispatchToProps +)(withRouter(App)); diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js index 7709a31d257..fbc87441a60 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/Breadcrumbs.js @@ -104,11 +104,11 @@ export default class Breadcrumbs extends React.PureComponent { <div className={this.props.className}> {breadcrumbs.map(component => ( <Breadcrumb - key={component.key} canBrowse={component.key !== lastItem.key} component={component} - isLast={component.key === lastItem.key} handleSelect={this.props.handleSelect} + isLast={component.key === lastItem.key} + key={component.key} /> ))} </div> diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js index e3843c8bcd0..8777d0fca7e 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContent.js @@ -306,15 +306,15 @@ export default class MeasureContent extends React.PureComponent { isLoggedIn && ( <MeasureFavoriteContainer branchLike={branchLike} - component={component.key} className="measure-favorite spacer-right" + component={component.key} /> )} {!isFile && ( <MeasureViewSelect className="measure-view-select" - metric={metric} handleViewChange={this.props.updateView} + metric={metric} view={view} /> )} diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.js index 54d1e975031..160bf1d74b6 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureContentContainer.js @@ -134,8 +134,8 @@ export default class MeasureContentContainer extends React.PureComponent { className={this.props.className} component={this.state.component} currentUser={this.props.currentUser} - loading={this.state.loading.measure || this.state.loading.components} leakPeriod={this.props.leakPeriod} + loading={this.state.loading.measure || this.state.loading.components} measure={this.state.measure} metric={this.props.metric} metrics={this.props.metrics} diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.js index 9eacba92a32..627913abc1c 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureFavoriteContainer.js @@ -97,4 +97,7 @@ const mapDispatchToProps = { } }; -export default connect(mapStateToProps, mapDispatchToProps)(MeasureFavoriteContainer); +export default connect( + mapStateToProps, + mapDispatchToProps +)(MeasureFavoriteContainer); diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.js index 0cc8795a154..e8fb726ef9f 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureViewSelect.js @@ -89,11 +89,11 @@ export default class MeasureViewSelect extends React.PureComponent { autoBlur={true} className={this.props.className} clearable={false} + onChange={this.handleChange} + options={this.getOptions()} searchable={false} value={this.props.view} valueRenderer={this.renderValue} - options={this.getOptions()} - onChange={this.handleChange} /> ); } diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.js b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.js index 07618142a7e..cd4c0298fb8 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/Breadcrumb-test.js @@ -31,8 +31,8 @@ it('should show the last element without clickable link', () => { name: 'Foo', qualifier: 'TRK' }} - isLast={true} handleSelect={() => {}} + isLast={true} /> ) ).toMatchSnapshot(); @@ -48,8 +48,8 @@ it('should correctly show a middle element', () => { name: 'Foo', qualifier: 'TRK' }} - isLast={false} handleSelect={() => {}} + isLast={false} /> ) ).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.js b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.js index 115ade51760..48b39433226 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/__tests__/MeasureViewSelect-test.js @@ -24,7 +24,7 @@ import MeasureViewSelect from '../MeasureViewSelect'; it('should display correctly with treemap option', () => { expect( shallow( - <MeasureViewSelect metric={{ type: 'PERCENT' }} handleViewChange={() => {}} view="tree" /> + <MeasureViewSelect handleViewChange={() => {}} metric={{ type: 'PERCENT' }} view="tree" /> ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.js index 8e7d69452a7..da55b93966d 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/MeasureCell.js @@ -40,7 +40,7 @@ export default function MeasureCell({ component, measure, metric } /*: Props */) return ( <td className="thin nowrap text-right"> <span id={`component-measures-component-measure-${component.key}-${metric.key}`}> - <Measure value={value} metricKey={metric.key} metricType={metric.type} /> + <Measure metricKey={metric.key} metricType={metric.type} value={value} /> </span> </td> ); diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js index 6a79f5e3d56..ce1735a02ca 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/TreeMapView.js @@ -162,8 +162,8 @@ export default class TreeMapView extends React.PureComponent { return ( <ColorGradientLegend className="measure-details-treemap-legend" - colorScale={colorScale} colorNA={theme.secondFontColor} + colorScale={colorScale} direction={metric.direction} height={20} width={200} diff --git a/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.js b/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.js index 93d7ff58493..70953357687 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.js +++ b/server/sonar-web/src/main/js/apps/component-measures/sidebar/FacetMeasureValue.js @@ -27,23 +27,23 @@ export default function FacetMeasureValue({ measure } /*: { measure: MeasureEnha if (isDiffMetric(measure.metric.key)) { return ( <div - id={`measure-${measure.metric.key}-leak`} - className="domain-measures-value domain-measures-leak"> + className="domain-measures-value domain-measures-leak" + id={`measure-${measure.metric.key}-leak`}> <Measure - value={measure.leak} metricKey={measure.metric.key} metricType={measure.metric.type} + value={measure.leak} /> </div> ); } return ( - <div id={`measure-${measure.metric.key}-value`} className="domain-measures-value"> + <div className="domain-measures-value" id={`measure-${measure.metric.key}-value`}> <Measure - value={measure.value} metricKey={measure.metric.key} metricType={measure.metric.type} + value={measure.value} /> </div> ); diff --git a/server/sonar-web/src/main/js/apps/explore/Explore.tsx b/server/sonar-web/src/main/js/apps/explore/Explore.tsx index 967796f4317..eb132497a6a 100644 --- a/server/sonar-web/src/main/js/apps/explore/Explore.tsx +++ b/server/sonar-web/src/main/js/apps/explore/Explore.tsx @@ -31,21 +31,21 @@ interface Props { export default function Explore(props: Props) { return ( <div id="explore"> - <ContextNavBar id="explore-navigation" height={theme.contextNavHeightRaw}> + <ContextNavBar height={theme.contextNavHeightRaw} id="explore-navigation"> <header className="navbar-context-header"> <h1>{translate('explore')}</h1> </header> <NavBarTabs> <li> - <Link to="/explore/projects" activeClassName="active"> + <Link activeClassName="active" to="/explore/projects"> {translate('projects.page')} </Link> </li> <li> <Link - to={{ pathname: '/explore/issues', query: { resolved: 'false' } }} - activeClassName="active"> + activeClassName="active" + to={{ pathname: '/explore/issues', query: { resolved: 'false' } }}> {translate('issues.page')} </Link> </li> diff --git a/server/sonar-web/src/main/js/apps/groups/components/List.tsx b/server/sonar-web/src/main/js/apps/groups/components/List.tsx index bac8da1aa30..1971e243c15 100644 --- a/server/sonar-web/src/main/js/apps/groups/components/List.tsx +++ b/server/sonar-web/src/main/js/apps/groups/components/List.tsx @@ -35,7 +35,7 @@ interface Props { export default function List(props: Props) { return ( <div className="boxed-group boxed-group-inner"> - <table id="groups-list" className="data zebra zebra-hover"> + <table className="data zebra zebra-hover" id="groups-list"> <thead> <tr> <th /> diff --git a/server/sonar-web/src/main/js/apps/groups/components/__tests__/__snapshots__/EditMembers-test.tsx.snap b/server/sonar-web/src/main/js/apps/groups/components/__tests__/__snapshots__/EditMembers-test.tsx.snap index 4af0e007372..3e3b73245bb 100644 --- a/server/sonar-web/src/main/js/apps/groups/components/__tests__/__snapshots__/EditMembers-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/groups/components/__tests__/__snapshots__/EditMembers-test.tsx.snap @@ -45,7 +45,7 @@ exports[`should edit members 1`] = ` "clipRule": "evenodd", "fillRule": "evenodd", "strokeLinejoin": "round", - "strokeMiterlimit": "1.41421", + "strokeMiterlimit": 1.41421, } } version="1.1" @@ -116,7 +116,7 @@ exports[`should edit members 2`] = ` "clipRule": "evenodd", "fillRule": "evenodd", "strokeLinejoin": "round", - "strokeMiterlimit": "1.41421", + "strokeMiterlimit": 1.41421, } } version="1.1" @@ -393,7 +393,7 @@ exports[`should edit members 2`] = ` "clipRule": "evenodd", "fillRule": "evenodd", "strokeLinejoin": "round", - "strokeMiterlimit": "1.41421", + "strokeMiterlimit": 1.41421, } } version="1.1" @@ -525,7 +525,7 @@ exports[`should edit members 3`] = ` "clipRule": "evenodd", "fillRule": "evenodd", "strokeLinejoin": "round", - "strokeMiterlimit": "1.41421", + "strokeMiterlimit": 1.41421, } } version="1.1" diff --git a/server/sonar-web/src/main/js/apps/issues/actions.ts b/server/sonar-web/src/main/js/apps/issues/actions.ts index 90a6897177f..76da57eb2fe 100644 --- a/server/sonar-web/src/main/js/apps/issues/actions.ts +++ b/server/sonar-web/src/main/js/apps/issues/actions.ts @@ -20,7 +20,7 @@ import { State } from './components/App'; import { allLocationsEmpty } from './utils'; -export function enableLocationsNavigator(state: State): Partial<State> | undefined { +export function enableLocationsNavigator(state: State) { const { openIssue, selectedLocationIndex } = state; if (openIssue && (openIssue.secondaryLocations.length > 0 || openIssue.flows.length > 0)) { const selectedFlowIndex = @@ -36,15 +36,15 @@ export function enableLocationsNavigator(state: State): Partial<State> | undefin }; } } - return undefined; + return null; } -export function disableLocationsNavigator(): Partial<State> { +export function disableLocationsNavigator() { return { locationsNavigator: false }; } export function selectLocation(nextIndex: number | undefined) { - return (state: State): Partial<State> | undefined => { + return (state: State) => { const { selectedLocationIndex: index, openIssue } = state; if (openIssue) { if (!state.locationsNavigator) { @@ -59,11 +59,11 @@ export function selectLocation(nextIndex: number | undefined) { }; } } - return undefined; + return null; }; } -export function selectNextLocation(state: State): Partial<State> | undefined { +export function selectNextLocation(state: State) { const { selectedFlowIndex, selectedLocationIndex: index, openIssue } = state; if (openIssue) { const locations = @@ -79,10 +79,10 @@ export function selectNextLocation(state: State): Partial<State> | undefined { selectedLocationIndex: index !== undefined && index < lastLocationIdx ? index + 1 : index }; } - return undefined; + return null; } -export function selectPreviousLocation(state: State): Partial<State> | undefined { +export function selectPreviousLocation(state: State) { const { selectedFlowIndex, selectedLocationIndex: index, openIssue } = state; if (openIssue) { if (index === -1) { @@ -95,16 +95,16 @@ export function selectPreviousLocation(state: State): Partial<State> | undefined } return { selectedLocationIndex: index !== undefined && index > 0 ? index - 1 : index }; } - return undefined; + return null; } export function selectFlow(nextIndex?: number) { - return (): Partial<State> => { + return () => { return { selectedFlowIndex: nextIndex, selectedLocationIndex: 0 }; }; } -export function selectNextFlow(state: State): Partial<State> | undefined { +export function selectNextFlow(state: State) { const { openIssue, selectedFlowIndex } = state; if ( openIssue && @@ -113,13 +113,13 @@ export function selectNextFlow(state: State): Partial<State> | undefined { ) { return { selectedFlowIndex: selectedFlowIndex + 1, selectedLocationIndex: 0 }; } - return undefined; + return null; } -export function selectPreviousFlow(state: State): Partial<State> | undefined { +export function selectPreviousFlow(state: State) { const { openIssue, selectedFlowIndex } = state; if (openIssue && selectedFlowIndex !== undefined && selectedFlowIndex > 0) { return { selectedFlowIndex: selectedFlowIndex - 1, selectedLocationIndex: 0 }; } - return undefined; + return null; } diff --git a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx index 683a016303f..a2c5a09d56a 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx @@ -93,6 +93,7 @@ interface OwnProps { myIssues?: boolean; } -export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - lazyLoad(() => import('./App')) -); +export default connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(lazyLoad(() => import('./App'))); diff --git a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx index 65f14bb1b24..c8201f79b0e 100644 --- a/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx +++ b/server/sonar-web/src/main/js/apps/issues/conciseIssuesList/ConciseIssueBox.tsx @@ -59,7 +59,9 @@ export default class ConciseIssueBox extends React.PureComponent<Props> { const locations = selectedFlowIndex !== undefined ? flows[selectedFlowIndex] - : flows.length > 0 ? flows[0] : secondaryLocations; + : flows.length > 0 + ? flows[0] + : secondaryLocations; if (!locations || locations.length < 15) { // if there are no locations, or there are just few diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx index 938163782e3..1e50dda69d8 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginAvailable.tsx @@ -71,7 +71,7 @@ export default function PluginAvailable({ plugin, readOnly, refreshPending, stat </td> {!readOnly && ( - <PluginStatus plugin={plugin} status={status} refreshPending={refreshPending} /> + <PluginStatus plugin={plugin} refreshPending={refreshPending} status={status} /> )} </tr> ); diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx index 2d6faf4975d..c0fdbd7fe4f 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginInstalled.tsx @@ -59,7 +59,7 @@ export default function PluginInstalled({ plugin, readOnly, refreshPending, stat </td> {!readOnly && ( - <PluginStatus plugin={plugin} status={status} refreshPending={refreshPending} /> + <PluginStatus plugin={plugin} refreshPending={refreshPending} status={status} /> )} </tr> ); diff --git a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx index 1bbb18782f2..0a2ce739b5e 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx +++ b/server/sonar-web/src/main/js/apps/marketplace/components/PluginUpdateItem.tsx @@ -52,7 +52,7 @@ export default class PluginUpdateItem extends React.PureComponent<Props, State> render() { const { release, update } = this.props; return ( - <li key={release.version} className="display-flex-row little-spacer-bottom"> + <li className="display-flex-row little-spacer-bottom" key={release.version}> <div className="pull-left spacer-right"> {update.status === 'COMPATIBLE' ? ( <span className="js-update-version badge badge-success">{release.version}</span> diff --git a/server/sonar-web/src/main/js/apps/marketplace/utils.ts b/server/sonar-web/src/main/js/apps/marketplace/utils.ts index 0d80dc953af..ac04e962c24 100644 --- a/server/sonar-web/src/main/js/apps/marketplace/utils.ts +++ b/server/sonar-web/src/main/js/apps/marketplace/utils.ts @@ -113,14 +113,17 @@ export function isPluginPending(plugin: Plugin): plugin is PluginPending { } export const DEFAULT_FILTER = 'all'; -export const parseQuery = memoize((urlQuery: RawQuery): Query => ({ - filter: parseAsString(urlQuery['filter']) || DEFAULT_FILTER, - search: parseAsString(urlQuery['search']) -})); - -export const serializeQuery = memoize((query: Query): RawQuery => - cleanQuery({ - filter: query.filter === DEFAULT_FILTER ? undefined : serializeString(query.filter), - search: query.search ? serializeString(query.search) : undefined +export const parseQuery = memoize( + (urlQuery: RawQuery): Query => ({ + filter: parseAsString(urlQuery['filter']) || DEFAULT_FILTER, + search: parseAsString(urlQuery['search']) }) ); + +export const serializeQuery = memoize( + (query: Query): RawQuery => + cleanQuery({ + filter: query.filter === DEFAULT_FILTER ? undefined : serializeString(query.filter), + search: query.search ? serializeString(query.search) : undefined + }) +); diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx index 4625032fcdd..c1aac8ef5d6 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx @@ -128,6 +128,7 @@ export class OrganizationDelete extends React.PureComponent<Props, State> { const mapDispatchToProps: DispatchToProps = { deleteOrganization: deleteOrganization as any }; -export default connect<null, DispatchToProps, OwnProps>(null, mapDispatchToProps)( - OrganizationDelete -); +export default connect<null, DispatchToProps, OwnProps>( + null, + mapDispatchToProps +)(OrganizationDelete); diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx index af96e5ec02f..a81cbe614d3 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationEdit.tsx @@ -197,4 +197,7 @@ export class OrganizationEdit extends React.PureComponent<Props, State> { const mapDispatchToProps = { updateOrganization: updateOrganization as any }; -export default connect<{}, DispatchProps, OwnProps>(null, mapDispatchToProps)(OrganizationEdit); +export default connect<{}, DispatchProps, OwnProps>( + null, + mapDispatchToProps +)(OrganizationEdit); diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembersContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembersContainer.tsx index cbc1d9d0d98..01226a51009 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembersContainer.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationMembersContainer.tsx @@ -43,7 +43,7 @@ interface OwnProps { interface StateProps { memberLogins: string[]; members: OrganizationMember[]; - organization?: Organization; + organization: Organization; organizationGroups: Group[]; status: { loading?: boolean; total?: number; pageIndex?: number; query?: string }; } @@ -68,7 +68,7 @@ const mapStateToProps = (state: any, ownProps: OwnProps): StateProps => { return { memberLogins, members: getUsersByLogins(state, memberLogins), - organization: getOrganizationByKey(state, organizationKey), + organization: getOrganizationByKey(state, organizationKey)!, organizationGroups: getOrganizationGroupsByKey(state, organizationKey), status: getOrganizationMembersState(state, organizationKey) }; @@ -83,6 +83,7 @@ const mapDispatchToProps = { updateOrganizationMemberGroups }; -export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - OrganizationMembers -); +export default connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(OrganizationMembers); diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx index 44daa37abea..41981090047 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx @@ -118,6 +118,7 @@ const mapStateToProps = (state: any, ownProps: OwnProps) => ({ const mapDispatchToProps = { fetchOrganization: fetchOrganization as any }; -export default connect<StateProps, DispatchToProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - OrganizationPage -); +export default connect<StateProps, DispatchToProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(OrganizationPage); diff --git a/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx b/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx index 915316ce2fc..3b4eac183be 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx +++ b/server/sonar-web/src/main/js/apps/overview/events/Analysis.tsx @@ -51,7 +51,9 @@ export default function Analysis({ analysis, ...props }: Props) { {sortedEvents.length > 0 ? ( <div className="overview-activity-events"> - {sortedEvents.map(event => <Event event={event} key={event.key} />)} + {sortedEvents.map(event => ( + <Event event={event} key={event.key} /> + ))} </div> ) : ( <span className="note">{translate('project_activity.analyzed', qualifier)}</span> diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.tsx index 4d6c5748748..f533a2bd828 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.tsx +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaKey.tsx @@ -31,7 +31,7 @@ export default function MetaKey({ componentKey, qualifier }: Props) { <> <h4 className="overview-meta-header">{translate('overview.project_key', qualifier)}</h4> <div className="display-flex-center"> - <input className="overview-key" type="text" value={componentKey} readOnly={true} /> + <input className="overview-key" readOnly={true} type="text" value={componentKey} /> <ClipboardButton className="little-spacer-left" copyValue={componentKey} /> </div> </> diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx index d9db8d5b150..5afa32a08ae 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaLinks.tsx @@ -74,7 +74,9 @@ export default class MetaLinks extends React.PureComponent<Props, State> { <div className="overview-meta-card"> <h4 className="overview-meta-header">{translate('overview.external_links')}</h4> <ul className="overview-meta-list"> - {orderedLinks.map(link => <MetaLink key={link.id} link={link} />)} + {orderedLinks.map(link => ( + <MetaLink key={link.id} link={link} /> + ))} </ul> </div> ); diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.tsx index 9d8ca5a8000..73de7662404 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.tsx +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaOrganizationKey.tsx @@ -30,7 +30,7 @@ export default function MetaOrganizationKey({ organization }: Props) { <> <h4 className="overview-meta-header big-spacer-top">{translate('organization_key')}</h4> <div className="display-flex-center"> - <input className="overview-key" type="text" value={organization} readOnly={true} /> + <input className="overview-key" readOnly={true} type="text" value={organization} /> <ClipboardButton className="little-spacer-left" copyValue={organization} /> </div> </> diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx index 243a5765d77..f1b25609103 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaSize.tsx @@ -68,7 +68,7 @@ export default class MetaSize extends React.PureComponent<Props> { this.props.component.qualifier === 'TRK' ? 'overview-meta-size-lang-dist' : 'big-spacer-top'; return languageDistribution ? ( - <div id="overview-language-distribution" className={className}> + <div className={className} id="overview-language-distribution"> <LanguageDistributionContainer distribution={languageDistribution.value} width={160} /> </div> ) : null; diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx index ecd6133cecb..91cba327f51 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/ApplicationQualityGate.tsx @@ -103,15 +103,13 @@ export default class ApplicationQualityGate extends React.PureComponent<Props, S <div className="overview-quality-gate-conditions-list clearfix" id="overview-quality-gate-conditions-list"> - {projects - .filter(project => project.status !== 'OK') - .map(project => ( - <ApplicationQualityGateProject - key={project.key} - metrics={metrics} - project={project} - /> - ))} + {projects.filter(project => project.status !== 'OK').map(project => ( + <ApplicationQualityGateProject + key={project.key} + metrics={metrics} + project={project} + /> + ))} </div> )} </div> diff --git a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js index 8ff4cb04044..7e2d6d3772e 100644 --- a/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js +++ b/server/sonar-web/src/main/js/apps/overview/qualityGate/QualityGateCondition.js @@ -114,7 +114,7 @@ export default class QualityGateCondition extends React.PureComponent { }; return RATING_METRICS_MAPPING[metricKey] ? ( - <Link to={this.getUrlForType(...RATING_METRICS_MAPPING[metricKey])} className={className}> + <Link className={className} to={this.getUrlForType(...RATING_METRICS_MAPPING[metricKey])}> {children} </Link> ) : ( @@ -153,15 +153,15 @@ export default class QualityGateCondition extends React.PureComponent { <div className="overview-quality-gate-condition-value"> <Measure decimals={decimals} - value={actual} metricKey={measure.metric.key} metricType={measure.metric.type} + value={actual} /> </div> <div> <div className="overview-quality-gate-condition-metric"> - <IssueTypeIcon query={metric.key} className="little-spacer-right" /> + <IssueTypeIcon className="little-spacer-right" query={metric.key} /> {metric.name} </div> {!isDiff && diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/App.js b/server/sonar-web/src/main/js/apps/permission-templates/components/App.js index df020fbe8a4..d36592db6be 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/App.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/App.js @@ -80,8 +80,8 @@ export default class App extends React.PureComponent { return ( <Template organization={this.props.organization} - template={template} refresh={this.requestPermissions} + template={template} topQualifiers={this.props.topQualifiers} /> ); @@ -91,11 +91,11 @@ export default class App extends React.PureComponent { return ( <Home organization={this.props.organization} - topQualifiers={this.props.topQualifiers} permissions={this.state.permissions} permissionTemplates={this.state.permissionTemplates} ready={this.state.ready} refresh={this.requestPermissions} + topQualifiers={this.props.topQualifiers} /> ); } @@ -106,8 +106,8 @@ export default class App extends React.PureComponent { <div> <Suggestions suggestions="permission_templates" /> <OrganizationHelmet - title={translate('permission_templates.page')} organization={this.props.organization} + title={translate('permission_templates.page')} /> {id && this.renderTemplate(id)} diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Home.js b/server/sonar-web/src/main/js/apps/permission-templates/components/Home.js index 046bdd984a2..3cf1b539834 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Home.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Home.js @@ -47,10 +47,10 @@ export default class Home extends React.PureComponent { <List organization={this.props.organization} - permissionTemplates={this.props.permissionTemplates} permissions={this.props.permissions} - topQualifiers={this.props.topQualifiers} + permissionTemplates={this.props.permissionTemplates} refresh={this.props.refresh} + topQualifiers={this.props.topQualifiers} /> </div> ); diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/List.js b/server/sonar-web/src/main/js/apps/permission-templates/components/List.js index 290cd1e908f..fdc2ef38b3d 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/List.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/List.js @@ -38,14 +38,14 @@ export default class List extends React.PureComponent { key={p.id} organization={this.props.organization} permissionTemplate={p} - topQualifiers={this.props.topQualifiers} refresh={this.props.refresh} + topQualifiers={this.props.topQualifiers} /> )); return ( <div className="boxed-group boxed-group-inner"> - <table id="permission-templates" className="data zebra permissions-table"> + <table className="data zebra permissions-table" id="permission-templates"> <ListHeader organization={this.props.organization} permissions={this.props.permissions} /> <tbody>{permissionTemplates}</tbody> </table> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js b/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js index 9b3d0c530ce..96ac8ffe556 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/ListItem.js @@ -51,8 +51,8 @@ export default class ListItem extends React.PureComponent { <ActionsCell organization={this.props.organization} permissionTemplate={this.props.permissionTemplate} - topQualifiers={this.props.topQualifiers} refresh={this.props.refresh} + topQualifiers={this.props.topQualifiers} /> </td> </tr> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js b/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js index e7a1ebcb900..afeae1c6a09 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/NameCell.js @@ -45,8 +45,8 @@ export default class NameCell extends React.PureComponent { {t.defaultFor.length > 0 && ( <div className="spacer-top js-defaults"> <Defaults - permissionTemplate={this.props.permissionTemplate} organization={organization} + permissionTemplate={this.props.permissionTemplate} /> </div> )} diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js index 0b3923be0a8..8370a72b902 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateDetails.js @@ -34,7 +34,7 @@ export default class TemplateDetails extends React.PureComponent { <div className="big-spacer-bottom"> {template.defaultFor.length > 0 && ( <div className="spacer-top js-defaults"> - <Defaults permissionTemplate={template} organization={this.props.organization} /> + <Defaults organization={this.props.organization} permissionTemplate={template} /> </div> )} diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js index 9998758b75b..127600700a4 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/TemplateHeader.js @@ -40,9 +40,9 @@ export default class TemplateHeader extends React.PureComponent { : '/permission_templates'; return ( - <header id="project-permissions-header" className="page-header"> + <header className="page-header" id="project-permissions-header"> <div className="note spacer-bottom"> - <Link to={pathname} className="text-muted"> + <Link className="text-muted" to={pathname}> {translate('permission_templates.page')} </Link> </div> @@ -53,11 +53,11 @@ export default class TemplateHeader extends React.PureComponent { <div className="pull-right"> <ActionsCell + fromDetails={true} organization={this.props.organization} permissionTemplate={this.props.template} - topQualifiers={this.props.topQualifiers} refresh={this.props.refresh} - fromDetails={true} + topQualifiers={this.props.topQualifiers} /> </div> </header> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.js b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.js index 0dab8b12ede..ed819e648b3 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.js +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Defaults-test.js @@ -42,13 +42,13 @@ it('should render several qualifiers', () => { it('should render several qualifiers for default organization', () => { const sample = { ...SAMPLE, defaultFor: ['TRK', 'VW'] }; const organization = { isDefault: true }; - const output = shallow(<Defaults permissionTemplate={sample} organization={organization} />); + const output = shallow(<Defaults organization={organization} permissionTemplate={sample} />); expect(output).toMatchSnapshot(); }); it('should render only projects for custom organization', () => { const sample = { ...SAMPLE, defaultFor: ['TRK', 'VW'] }; const organization = { isDefault: false }; - const output = shallow(<Defaults permissionTemplate={sample} organization={organization} />); + const output = shallow(<Defaults organization={organization} permissionTemplate={sample} />); expect(output).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/App.js b/server/sonar-web/src/main/js/apps/permissions/project/components/App.js index dc5888fcd08..c39d78e3d30 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/App.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/App.js @@ -339,8 +339,8 @@ export default class App extends React.PureComponent { <PageHeader component={this.props.component} - loading={this.state.loading} loadHolders={this.loadHolders} + loading={this.state.loading} /> <PageError /> <div> diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/AppContainer.js b/server/sonar-web/src/main/js/apps/permissions/project/components/AppContainer.js index f022c5ea7b1..b95e406649f 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/AppContainer.js +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/AppContainer.js @@ -30,4 +30,7 @@ const mapDispatchToProps = dispatch => ({ onRequestFail: onFail(dispatch) }); -export default connect(mapStateToProps, mapDispatchToProps)(App); +export default connect( + mapStateToProps, + mapDispatchToProps +)(App); diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx index 5e9b873b841..e12f6f7edc1 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/App.tsx @@ -224,6 +224,7 @@ const mapStateToProps = (state: any): StateToProps => ({ metrics: getMetrics(state) }); -export default connect<StateToProps, DispatchToProps, Props>(mapStateToProps, mapDispatchToProps)( - App -); +export default connect<StateToProps, DispatchToProps, Props>( + mapStateToProps, + mapDispatchToProps +)(App); diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/MainRating.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/MainRating.tsx index 3a6b5971893..2b177dde32f 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/MainRating.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/MainRating.tsx @@ -30,7 +30,7 @@ interface Props { export default function MainRating({ component, metric, value }: Props) { return ( - <Link to={getMeasureTreemapUrl(component, metric)} className="portfolio-box-rating"> + <Link className="portfolio-box-rating" to={getMeasureTreemapUrl(component, metric)}> <Rating value={value} /> </Link> ); diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx index dc805cf0433..8ec942f2e6e 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/ReleasabilityBox.tsx @@ -42,8 +42,8 @@ export default function ReleasabilityBox({ component, measures }: Props) { {rating && ( <Link - to={getComponentDrilldownUrl({ componentKey: component, metric: 'alert_status' })} - className="portfolio-box-rating"> + className="portfolio-box-rating" + to={getComponentDrilldownUrl({ componentKey: component, metric: 'alert_status' })}> <Rating value={rating} /> </Link> )} diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx index 478cd3d8608..1331d80fc43 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/Report.tsx @@ -92,9 +92,9 @@ export default class Report extends React.PureComponent<Props, State> { <div className="spacer-top"> <a className="button js-report-download" + download={component.name + ' - Executive Report.pdf'} href={getReportUrl(component.key)} - target="_blank" - download={component.name + ' - Executive Report.pdf'}> + target="_blank"> {translate('report.print')} </a> </div> diff --git a/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx b/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx index 89752754338..46db61f7c14 100644 --- a/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx +++ b/server/sonar-web/src/main/js/apps/portfolio/components/WorstProjects.tsx @@ -74,8 +74,8 @@ export default function WorstProjects({ component, subComponents, total }: Props <tr key={component.key}> <td> <Link - to={getProjectUrl(component.refKey || component.key)} - className="link-with-icon"> + className="link-with-icon" + to={getProjectUrl(component.refKey || component.key)}> <QualifierIcon qualifier={component.qualifier} /> {component.name} </Link> </td> @@ -98,7 +98,7 @@ export default function WorstProjects({ component, subComponents, total }: Props formatMeasure(count, 'INT'), formatMeasure(total, 'INT') )} - <Link to={projectsPageUrl} className="spacer-left"> + <Link className="spacer-left" to={projectsPageUrl}> {translate('show_more')} </Link> </footer> @@ -117,15 +117,15 @@ function renderCell(measures: { [key: string]: string | undefined }, metric: str function renderNcloc(measures: { [key: string]: string | undefined }, maxLoc: number) { const ncloc = Number(measures['ncloc'] || 0); - const barWidth = maxLoc > 0 ? Math.max(1, Math.round(ncloc / maxLoc * 50)) : 0; + const barWidth = maxLoc > 0 ? Math.max(1, Math.round((ncloc / maxLoc) * 50)) : 0; return ( <td className="text-right"> <span className="note"> <Measure metricKey="ncloc" metricType="SHORT_INT" value={measures['ncloc']} /> </span> {maxLoc > 0 && ( - <svg width="50" height="16" className="spacer-left"> - <rect className="bar-chart-bar" x="0" y="3" width={barWidth} height="10" /> + <svg className="spacer-left" height="16" width="50"> + <rect className="bar-chart-bar" height="10" width={barWidth} x="0" y="3" /> </svg> )} </td> diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js index cf6ffdb2d9a..9919f4b8604 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/BulkUpdate.js @@ -127,10 +127,10 @@ class BulkUpdate extends React.PureComponent { {results != null && ( <BulkUpdateResults - results={results} - replace={replace} by={by} onConfirm={this.handleConfirm.bind(this)} + replace={replace} + results={results} /> )} </div> @@ -138,8 +138,11 @@ class BulkUpdate extends React.PureComponent { } } -export default connect(null, { - addGlobalErrorMessage, - addGlobalSuccessMessage, - closeAllGlobalMessages -})(BulkUpdate); +export default connect( + null, + { + addGlobalErrorMessage, + addGlobalSuccessMessage, + closeAllGlobalMessages + } +)(BulkUpdate); diff --git a/server/sonar-web/src/main/js/apps/project-admin/key/Key.js b/server/sonar-web/src/main/js/apps/project-admin/key/Key.js index d1688ed106e..2d272a903ad 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/key/Key.js +++ b/server/sonar-web/src/main/js/apps/project-admin/key/Key.js @@ -144,10 +144,13 @@ const mapStateToProps = (state, ownProps) => ({ modules: getProjectAdminProjectModules(state, ownProps.location.query.id) }); -export default connect(mapStateToProps, { - fetchProjectModules, - changeKey, - addGlobalErrorMessage, - addGlobalSuccessMessage, - closeAllGlobalMessages -})(Key); +export default connect( + mapStateToProps, + { + fetchProjectModules, + changeKey, + addGlobalErrorMessage, + addGlobalSuccessMessage, + closeAllGlobalMessages + } +)(Key); diff --git a/server/sonar-web/src/main/js/apps/project-admin/links/Links.js b/server/sonar-web/src/main/js/apps/project-admin/links/Links.js index fa77e03c6b8..15227725c0d 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/links/Links.js +++ b/server/sonar-web/src/main/js/apps/project-admin/links/Links.js @@ -60,8 +60,11 @@ const mapStateToProps = (state, ownProps) => ({ links: getProjectAdminProjectLinks(state, ownProps.location.query.id) }); -export default connect(mapStateToProps, { - fetchProjectLinks, - createProjectLink, - deleteProjectLink -})(Links); +export default connect( + mapStateToProps, + { + fetchProjectLinks, + createProjectLink, + deleteProjectLink + } +)(Links); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js index 535529ccc18..c9bb46571d3 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphHistory.js @@ -82,7 +82,7 @@ export default class GraphHistory extends React.PureComponent { return ( <div className="project-activity-graph-container"> {this.props.isCustom ? ( - <GraphsLegendCustom series={series} removeMetric={this.props.removeCustomMetric} /> + <GraphsLegendCustom removeMetric={this.props.removeCustomMetric} series={series} /> ) : ( <GraphsLegendStatic series={series} /> )} @@ -92,10 +92,9 @@ export default class GraphHistory extends React.PureComponent { <div> <AdvancedTimeline endDate={this.props.graphEndDate} + formatYTick={this.formatValue} height={height} - width={width} interpolate="linear" - formatYTick={this.formatValue} leakPeriodDate={this.props.leakPeriodDate} metricType={this.props.metricsType} selectedDate={selectedDate} @@ -105,6 +104,7 @@ export default class GraphHistory extends React.PureComponent { updateSelectedDate={this.props.updateSelectedDate} updateTooltip={this.updateTooltip} updateZoom={this.props.updateGraphZoom} + width={width} /> {selectedDate != null && tooltipXPos != null && ( diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js index 989b2ea690b..8bedfa774e4 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsHistory.js @@ -142,12 +142,12 @@ export default class GraphsHistory extends React.PureComponent { <div className="project-activity-graphs"> {this.props.graphs.map((series, idx) => ( <GraphHistory - key={idx} events={events} graph={graph} graphEndDate={this.props.graphEndDate} graphStartDate={this.props.graphStartDate} isCustom={isCustom} + key={idx} leakPeriodDate={this.props.leakPeriodDate} measuresHistory={this.props.measuresHistory} metricsType={getSeriesMetricType(series)} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js index bead6826b4f..166477120c2 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsLegendCustom.js @@ -41,9 +41,9 @@ export default function GraphsLegendCustom({ removeMetric, series } /*: Props */ <GraphsLegendItem metric={serie.name} name={serie.translatedName} + removeMetric={removeMetric} showWarning={!hasData} style={idx.toString()} - removeMetric={removeMetric} /> ); if (!hasData) { diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js index da1b227fa23..9d05d9c95f6 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContent.js @@ -33,7 +33,7 @@ type Props = { export default function GraphsTooltipsContent({ name, style, translatedName, value } /*: Props */) { return ( - <tr key={name} className="project-activity-graph-tooltip-line"> + <tr className="project-activity-graph-tooltip-line" key={name}> <td className="thin"> <ChartLegendIcon className={classNames('spacer-right line-chart-legend', 'line-chart-legend-' + style)} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js index 4334b38efaa..ea2889a67db 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentCoverage.js @@ -53,8 +53,8 @@ export default function GraphsTooltipsContentCoverage( {uncoveredValue && ( <tr className="project-activity-graph-tooltip-line"> <td - colSpan="2" - className="project-activity-graph-tooltip-value text-right spacer-right thin"> + className="project-activity-graph-tooltip-value text-right spacer-right thin" + colSpan="2"> {formatMeasure(uncoveredValue, 'SHORT_INT')} </td> <td>{translate('metric.uncovered_lines.name')}</td> @@ -63,8 +63,8 @@ export default function GraphsTooltipsContentCoverage( {coverageValue && ( <tr className="project-activity-graph-tooltip-line"> <td - colSpan="2" - className="project-activity-graph-tooltip-value text-right spacer-right thin"> + className="project-activity-graph-tooltip-value text-right spacer-right thin" + colSpan="2"> {formatMeasure(coverageValue, 'PERCENT')} </td> <td>{translate('metric.coverage.name')}</td> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js index 36305c85368..d07405ed649 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentDuplication.js @@ -55,8 +55,8 @@ export default function GraphsTooltipsContentDuplication( )} <tr className="project-activity-graph-tooltip-line"> <td - colSpan="2" - className="project-activity-graph-tooltip-value text-right spacer-right thin"> + className="project-activity-graph-tooltip-value text-right spacer-right thin" + colSpan="2"> {formatMeasure(duplicationDensityValue, 'PERCENT')} </td> <td>{translate('metric.duplicated_lines_density.name')}</td> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js index 48d8a840aee..9a9fd699678 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentEvents.js @@ -44,7 +44,7 @@ export default function GraphsTooltipsContentEvents({ addSeparator, events } /*: <td colSpan="3"> <span>{translate('events')}:</span> {events.map(event => ( - <span key={event.key} className="spacer-left"> + <span className="spacer-left" key={event.key}> <ProjectEventIcon className={'project-activity-event-icon ' + event.category} /> </span> ))} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js index 0934fa40d1e..11aa433612b 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsTooltipsContentIssues.js @@ -50,7 +50,7 @@ export default function GraphsTooltipsContentIssues(props /*: Props */) { } const ratingValue = rating.history[props.tooltipIdx].value; return ( - <tr key={props.name} className="project-activity-graph-tooltip-issues-line"> + <tr className="project-activity-graph-tooltip-issues-line" key={props.name}> <td className="thin"> <ChartLegendIcon className={classNames( diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js index 1cf79296c10..5f646a05273 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/GraphsZoom.js @@ -51,7 +51,6 @@ export default function GraphsZoom(props /*: Props */) { <ZoomTimeLine endDate={props.graphEndDate} height={64} - width={width} interpolate="linear" leakPeriodDate={props.leakPeriodDate} metricType={props.metricsType} @@ -60,6 +59,7 @@ export default function GraphsZoom(props /*: Props */) { showAreas={props.showAreas} startDate={props.graphStartDate} updateZoom={props.updateGraphZoom} + width={width} /> )} </AutoSizer> diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js index 9d0b7f38956..9b39fdc783d 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js @@ -189,8 +189,8 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { {version.version && ( <div className={classNames('project-activity-version-badge', { first: idx === 0 })}> <Tooltip - overlay={`${translate('version')} ${version.version}`} - mouseEnterDelay={0.5}> + mouseEnterDelay={0.5} + overlay={`${translate('version')} ${version.version}`}> <span className="badge">{version.version}</span> </Tooltip> </div> @@ -198,9 +198,9 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { <ul className="project-activity-days-list"> {days.map(day => ( <li - key={day} className="project-activity-day" - data-day={toShortNotSoISOString(Number(day))}> + data-day={toShortNotSoISOString(Number(day))} + key={day}> <div className="project-activity-date"> <DateFormatter date={Number(day)} long={true} /> </div> @@ -212,8 +212,8 @@ export default class ProjectActivityAnalysesList extends React.PureComponent { addVersion={this.props.addVersion} analysis={analysis} canAdmin={this.props.canAdmin} - canDeleteAnalyses={this.props.canDeleteAnalyses} canCreateVersion={this.props.project.qualifier === 'TRK'} + canDeleteAnalyses={this.props.canDeleteAnalyses} changeEvent={this.props.changeEvent} deleteAnalysis={this.props.deleteAnalysis} deleteEvent={this.props.deleteEvent} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js index 567853ebe55..e2d931038e4 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js @@ -61,7 +61,7 @@ export default function ProjectActivityApp(props /*: Props */) { (configuration ? configuration.showHistory : false); const canDeleteAnalyses = configuration ? configuration.showHistory : false; return ( - <div id="project-activity" className="page page-limited"> + <div className="page page-limited" id="project-activity"> <Suggestions suggestions="project_activity" /> <Helmet title={translate('project_activity.page')} /> @@ -78,12 +78,12 @@ export default function ProjectActivityApp(props /*: Props */) { <ProjectActivityAnalysesList addCustomEvent={props.addCustomEvent} addVersion={props.addVersion} - analysesLoading={props.analysesLoading} analyses={analyses} + analysesLoading={props.analysesLoading} canAdmin={canAdmin} canDeleteAnalyses={canDeleteAnalyses} - className="boxed-group-inner" changeEvent={props.changeEvent} + className="boxed-group-inner" deleteAnalysis={props.deleteAnalysis} deleteEvent={props.deleteEvent} initializing={props.initializing} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.js index 927594cfc42..e5bbde9aae7 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFooter.js @@ -36,5 +36,5 @@ export default function ProjectActivityPageFooter( if (!paging || analyses.length === 0) { return null; } - return <ListFooter count={analyses.length} total={paging.total} loadMore={fetchMoreActivity} />; + return <ListFooter count={analyses.length} loadMore={fetchMoreActivity} total={paging.total} />; } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.js index 85b0305515b..9ad7d3f98f7 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageHeader.js @@ -57,21 +57,21 @@ export default class ProjectActivityPageHeader extends React.PureComponent { {!['VW', 'SVW'].includes(this.props.project.qualifier) && ( <Select className="input-medium pull-left big-spacer-right" - placeholder={translate('project_activity.filter_events') + '...'} clearable={true} + onChange={this.handleCategoryChange} + optionComponent={ProjectActivityEventSelectOption} + options={this.options} + placeholder={translate('project_activity.filter_events') + '...'} searchable={false} value={this.props.category} - optionComponent={ProjectActivityEventSelectOption} valueComponent={ProjectActivityEventSelectValue} - options={this.options} - onChange={this.handleCategoryChange} /> )} <ProjectActivityDateInput className="pull-left" from={this.props.from} - to={this.props.to} onChange={this.props.updateQuery} + to={this.props.to} /> </header> ); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsLegendItem-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsLegendItem-test.tsx index 80d6c9bd861..f92da80a7ff 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsLegendItem-test.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/GraphsLegendItem-test.tsx @@ -32,8 +32,8 @@ it('should render correctly an actionable legend', () => { className="myclass" metric="foo" name="Foo" - style="1" removeMetric={() => {}} + style="1" /> ) ).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityDateInput-test.js b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityDateInput-test.js index de9f2696f1c..b9e93f16b76 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityDateInput-test.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityDateInput-test.js @@ -27,8 +27,8 @@ it('should render correctly the date inputs', () => { shallowWithIntl( <ProjectActivityDateInput from={parseDate('2016-10-27T12:21:15+0000')} - to={parseDate('2016-12-27T12:21:15+0000')} onChange={() => {}} + to={parseDate('2016-12-27T12:21:15+0000')} /> ) ).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx index 61c9e133c4c..487ec48c432 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LongBranchesPattern.tsx @@ -89,8 +89,8 @@ export default class LongBranchesPattern extends React.PureComponent<Props, Stat <EditButton className="button-small spacer-left" onClick={this.handleChangeClick} /> {this.state.formOpen && ( <LongBranchesPatternForm - onClose={this.closeForm} onChange={this.handleChange} + onClose={this.closeForm} project={this.props.project} setting={setting} /> diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx index 381e56d4fd1..9cd66cea2cf 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/App.tsx @@ -131,8 +131,8 @@ export default class QualityProfiles extends React.PureComponent<Props, State> { profiles && ( <Table allProfiles={allProfiles} - profiles={profiles} onChangeProfile={this.handleChangeProfile} + profiles={profiles} /> ) )} diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx index d430f983921..4d31caa9edd 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/ProfileRow.tsx @@ -90,8 +90,8 @@ export default class ProfileRow extends React.PureComponent<Props, State> { optionRenderer={this.renderProfileName} options={options} style={{ width: 300 }} - valueRenderer={this.renderProfileName} value={profile.key} + valueRenderer={this.renderProfileName} /> ); } diff --git a/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx b/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx index 27862e2ae5d..1563e159755 100644 --- a/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx +++ b/server/sonar-web/src/main/js/apps/projectQualityProfiles/Table.tsx @@ -37,9 +37,9 @@ export default function Table(props: Props) { const profileRows = orderedProfiles.map(profile => ( <ProfileRow key={profile.language} - profile={profile} - possibleProfiles={profilesByLanguage[profile.language]} onChangeProfile={props.onChangeProfile} + possibleProfiles={profilesByLanguage[profile.language]} + profile={profile} /> )); diff --git a/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilterContainer.tsx b/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilterContainer.tsx index 9314497e953..a869603b9ba 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilterContainer.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/FavoriteFilterContainer.tsx @@ -17,7 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { connect } from 'react-redux'; import FavoriteFilter from './FavoriteFilter'; -import { withCurrentUser } from '../../../store/withCurrentUser'; +import { getCurrentUser } from '../../../store/rootReducer'; -export default withCurrentUser(FavoriteFilter); +function mapStateToProps(state: any) { + return { currentUser: getCurrentUser(state) }; +} + +export default connect(mapStateToProps)(FavoriteFilter); diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PerspectiveSelect-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PerspectiveSelect-test.tsx index 0e65862014a..bf55319fd00 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/PerspectiveSelect-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/PerspectiveSelect-test.tsx @@ -36,7 +36,7 @@ it('should render with coverage selected', () => { it('should handle perspective change correctly', () => { const onChange = jest.fn(); const instance = shallow( - <PerspectiveSelect view="visualizations" visualization="coverage" onChange={onChange} /> + <PerspectiveSelect onChange={onChange} view="visualizations" visualization="coverage" /> ).instance() as PerspectiveSelect; instance.handleChange({ label: 'overall', value: 'overall', type: 'view' }); instance.handleChange({ label: 'leak', value: 'leak', type: 'view' }); diff --git a/server/sonar-web/src/main/js/apps/projects/create/CreateProjectPage.tsx b/server/sonar-web/src/main/js/apps/projects/create/CreateProjectPage.tsx index fd86a11afee..41a518401c7 100644 --- a/server/sonar-web/src/main/js/apps/projects/create/CreateProjectPage.tsx +++ b/server/sonar-web/src/main/js/apps/projects/create/CreateProjectPage.tsx @@ -51,9 +51,7 @@ interface DispatchProps { skipOnboardingAction: () => void; } -interface Props extends OwnProps, StateProps, DispatchProps { - currentUser: LoggedInUser; -} +type Props = StateProps & DispatchProps & OwnProps; interface State { identityProvider?: IdentityProvider; @@ -101,7 +99,7 @@ export class CreateProjectPage extends React.PureComponent<Props, State> { }; canAutoCreate = ({ currentUser } = this.props) => { - return ['bitbucket', 'github'].includes(currentUser.externalProvider || ''); + return ['bitbucket', 'github'].includes((currentUser as LoggedInUser).externalProvider || ''); }; fetchIdentityProviders = () => { @@ -110,7 +108,8 @@ export class CreateProjectPage extends React.PureComponent<Props, State> { if (this.mounted) { this.setState({ identityProvider: identityProviders.find( - identityProvider => identityProvider.key === this.props.currentUser.externalProvider + identityProvider => + identityProvider.key === (this.props.currentUser as LoggedInUser).externalProvider ), loading: false }); @@ -143,6 +142,11 @@ export class CreateProjectPage extends React.PureComponent<Props, State> { render() { const { currentUser } = this.props; + + if (!isLoggedIn(currentUser)) { + return null; + } + const { identityProvider, loading } = this.state; const displayManual = parseQuery(this.props.location.query).manual; const header = translate('onboarding.create_project.header'); @@ -208,14 +212,13 @@ export class CreateProjectPage extends React.PureComponent<Props, State> { } } -const mapStateToProps = (state: any): StateProps => { - return { - currentUser: getCurrentUser(state) - }; -}; +const mapStateToProps = (state: any): StateProps => ({ + currentUser: getCurrentUser(state) +}); const mapDispatchToProps: DispatchProps = { addGlobalErrorMessage, skipOnboardingAction }; -export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - CreateProjectPage -); +export default connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(CreateProjectPage); diff --git a/server/sonar-web/src/main/js/apps/projects/create/ManualProjectCreate.tsx b/server/sonar-web/src/main/js/apps/projects/create/ManualProjectCreate.tsx index d1df2b59ec0..299dc7676e0 100644 --- a/server/sonar-web/src/main/js/apps/projects/create/ManualProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/projects/create/ManualProjectCreate.tsx @@ -222,6 +222,7 @@ const mapStateToProps = (state: any): StateProps => { userOrganizations: getMyOrganizations(state) }; }; -export default connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - ManualProjectCreate -); +export default connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(ManualProjectCreate); diff --git a/server/sonar-web/src/main/js/apps/projects/create/utils.ts b/server/sonar-web/src/main/js/apps/projects/create/utils.ts index 4963cfc5ebc..64a746fc61c 100644 --- a/server/sonar-web/src/main/js/apps/projects/create/utils.ts +++ b/server/sonar-web/src/main/js/apps/projects/create/utils.ts @@ -31,15 +31,18 @@ export interface Query { manual: boolean; } -export const parseQuery = memoize((urlQuery: RawQuery): Query => { - return { - error: parseAsOptionalString(urlQuery['error']), - manual: parseAsBoolean(urlQuery['manual'], false) - }; -}); +export const parseQuery = memoize( + (urlQuery: RawQuery): Query => { + return { + error: parseAsOptionalString(urlQuery['error']), + manual: parseAsBoolean(urlQuery['manual'], false) + }; + } +); -export const serializeQuery = memoize((query: Query): RawQuery => - cleanQuery({ - manual: serializeOptionalBoolean(query.manual || undefined) - }) +export const serializeQuery = memoize( + (query: Query): RawQuery => + cleanQuery({ + manual: serializeOptionalBoolean(query.manual || undefined) + }) ); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.tsx index c2a1936e85d..e76a506d58f 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/CoverageFilter.tsx @@ -42,20 +42,20 @@ export default function CoverageFilter(props: Props) { return ( <Filter + className={props.className} facet={props.facet} + getFacetValueForOption={getFacetValueForOption} + header={<FilterHeader name={translate('metric_domain.Coverage')} />} + highlightUnder={1} + highlightUnderMax={5} maxFacetValue={props.maxFacetValue} onQueryChange={props.onQueryChange} - value={props.value} - property={property} - className={props.className} options={[1, 2, 3, 4, 5, 6]} + organization={props.organization} + property={property} query={props.query} renderOption={renderOption} - organization={props.organization} - getFacetValueForOption={getFacetValueForOption} - highlightUnder={1} - highlightUnderMax={5} - header={<FilterHeader name={translate('metric_domain.Coverage')} />} + value={props.value} /> ); } @@ -70,9 +70,9 @@ function renderOption(option: number, selected: boolean) { <span> {option < 6 && ( <CoverageRating - value={getCoverageRatingAverageValue(option)} - size="small" muted={!selected} + size="small" + value={getCoverageRatingAverageValue(option)} /> )} <span className="spacer-left"> diff --git a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx index 82c3ab42114..36e8840f3ee 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/DuplicationsFilter.tsx @@ -44,20 +44,20 @@ export default function DuplicationsFilter(props: Props) { const { property = 'duplications' } = props; return ( <Filter + className={props.className} facet={props.facet} + getFacetValueForOption={getFacetValueForOption} + header={<FilterHeader name={translate('metric_domain.Duplications')} />} + highlightUnder={1} + highlightUnderMax={5} maxFacetValue={props.maxFacetValue} onQueryChange={props.onQueryChange} - value={props.value} - property={property} - className={props.className} options={[1, 2, 3, 4, 5, 6]} + organization={props.organization} + property={property} query={props.query} renderOption={renderOption} - organization={props.organization} - getFacetValueForOption={getFacetValueForOption} - highlightUnder={1} - highlightUnderMax={5} - header={<FilterHeader name={translate('metric_domain.Duplications')} />} + value={props.value} /> ); } @@ -72,9 +72,9 @@ function renderOption(option: number, selected: boolean) { <span> {option < 6 && ( <DuplicationsRating - value={getDuplicationsRatingAverageValue(option)} - size="small" muted={!selected} + size="small" + value={getDuplicationsRatingAverageValue(option)} /> )} <span className="spacer-left"> diff --git a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx index 50a9fa718e0..7c980fa4566 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/Filter.tsx @@ -97,7 +97,7 @@ export default class Filter extends React.PureComponent<Props> { <div className="projects-facet-bar"> <div className="projects-facet-bar-inner" - style={{ width: facetValue / this.props.maxFacetValue * 60 }} + style={{ width: (facetValue / this.props.maxFacetValue) * 60 }} /> </div> ); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx index 06be03f8cc6..4e4a15042a4 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/IssuesFilter.tsx @@ -41,23 +41,23 @@ interface Props { export default function IssuesFilter(props: Props) { return ( <Filter - facet={props.facet} - maxFacetValue={props.maxFacetValue} - onQueryChange={props.onQueryChange} - value={props.value} - property={props.property} className={props.className} - options={[1, 2, 3, 4, 5]} - query={props.query} - renderOption={renderOption} - organization={props.organization} + facet={props.facet} getFacetValueForOption={getFacetValueForOption} - highlightUnder={1} header={ <FilterHeader name={translate('metric_domain', props.name)}> {props.headerDetail} </FilterHeader> } + highlightUnder={1} + maxFacetValue={props.maxFacetValue} + onQueryChange={props.onQueryChange} + options={[1, 2, 3, 4, 5]} + organization={props.organization} + property={props.property} + query={props.query} + renderOption={renderOption} + value={props.value} /> ); } @@ -69,7 +69,7 @@ function getFacetValueForOption(facet: Facet, option: number) { function renderOption(option: number, selected: boolean) { return ( <span> - <Rating value={option} small={true} muted={!selected} /> + <Rating muted={!selected} small={true} value={option} /> </span> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx index 1c39277af7d..2481e0b6986 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.tsx @@ -59,8 +59,8 @@ export default class LanguagesFilter extends React.Component<Props> { renderOption = (option: string) => ( <SearchableFilterOption - optionKey={option} option={getLanguageByKey(this.props.languages, option)} + optionKey={option} /> ); @@ -69,26 +69,26 @@ export default class LanguagesFilter extends React.Component<Props> { return ( <Filter - onQueryChange={this.props.onQueryChange} - property={property} - options={this.getSortedOptions(this.props.facet)} - query={this.props.query} - renderOption={this.renderOption} - value={this.props.value} facet={this.props.facet} - maxFacetValue={this.props.maxFacetValue} - organization={this.props.organization} - getFacetValueForOption={this.getFacetValueForOption} - header={<FilterHeader name={translate('projects.facets.languages')} />} footer={ <SearchableFilterFooter onQueryChange={this.props.onQueryChange} - organization={this.props.organization} options={this.getSearchOptions()} + organization={this.props.organization} property={property} query={this.props.query} /> } + getFacetValueForOption={this.getFacetValueForOption} + header={<FilterHeader name={translate('projects.facets.languages')} />} + maxFacetValue={this.props.maxFacetValue} + onQueryChange={this.props.onQueryChange} + options={this.getSortedOptions(this.props.facet)} + organization={this.props.organization} + property={property} + query={this.props.query} + renderOption={this.renderOption} + value={this.props.value} /> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/NewCoverageFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/NewCoverageFilter.tsx index 4ea87c71bb3..860901a5929 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/NewCoverageFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/NewCoverageFilter.tsx @@ -21,5 +21,5 @@ import * as React from 'react'; import CoverageFilter, { Props } from './CoverageFilter'; export default function NewCoverageFilter(props: Props) { - return <CoverageFilter {...props} property="new_coverage" className="leak-facet-box" />; + return <CoverageFilter {...props} className="leak-facet-box" property="new_coverage" />; } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/NewDuplicationsFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/NewDuplicationsFilter.tsx index 684612da89e..c15766b0c68 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/NewDuplicationsFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/NewDuplicationsFilter.tsx @@ -21,5 +21,5 @@ import * as React from 'react'; import DuplicationsFilter, { Props } from './DuplicationsFilter'; export default function NewDuplicationsFilter(props: Props) { - return <DuplicationsFilter {...props} property="new_duplications" className="leak-facet-box" />; + return <DuplicationsFilter {...props} className="leak-facet-box" property="new_duplications" />; } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.tsx index a8141038de6..468f0cb5375 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/NewLinesFilter.tsx @@ -41,19 +41,19 @@ export default function NewLinesFilter(props: Props) { return ( <Filter + className="leak-facet-box" facet={props.facet} + getFacetValueForOption={getFacetValueForOption} + header={<FilterHeader name={translate('projects.facets.new_lines')} />} + highlightUnder={1} maxFacetValue={props.maxFacetValue} onQueryChange={props.onQueryChange} - value={props.value} - property={property} - className="leak-facet-box" options={[1, 2, 3, 4, 5]} + organization={props.organization} + property={property} query={props.query} renderOption={renderOption} - organization={props.organization} - getFacetValueForOption={getFacetValueForOption} - highlightUnder={1} - header={<FilterHeader name={translate('projects.facets.new_lines')} />} + value={props.value} /> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx index cffd2ccb8f2..072116972fe 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/QualityGateFilter.tsx @@ -39,16 +39,16 @@ export default function QualityGateFilter(props: Props) { return ( <Filter facet={props.facet} + getFacetValueForOption={getFacetValueForOption} + header={<FilterHeader name={translate('projects.facets.quality_gate')} />} maxFacetValue={props.maxFacetValue} onQueryChange={props.onQueryChange} - value={props.value} - property="gate" options={['OK', 'WARN', 'ERROR']} + organization={props.organization} + property="gate" query={props.query} renderOption={renderOption} - organization={props.organization} - getFacetValueForOption={getFacetValueForOption} - header={<FilterHeader name={translate('projects.facets.quality_gate')} />} + value={props.value} /> ); } @@ -58,5 +58,5 @@ function getFacetValueForOption(facet: Facet, option: string) { } function renderOption(option: string, selected: boolean) { - return <Level level={option} small={true} muted={!selected} />; + return <Level level={option} muted={!selected} small={true} />; } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.tsx index 570c5722028..ec70339a005 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/SizeFilter.tsx @@ -42,19 +42,19 @@ export default function SizeFilter(props: Props) { return ( <Filter + className={props.className} facet={props.facet} + getFacetValueForOption={getFacetValueForOption} + header={<FilterHeader name={translate('metric_domain.Size')} />} + highlightUnder={1} maxFacetValue={props.maxFacetValue} onQueryChange={props.onQueryChange} - value={props.value} - property={property} - className={props.className} options={[1, 2, 3, 4, 5]} + organization={props.organization} + property={property} query={props.query} renderOption={renderOption} - organization={props.organization} - getFacetValueForOption={getFacetValueForOption} - highlightUnder={1} - header={<FilterHeader name={translate('metric_domain.Size')} />} + value={props.value} /> ); } @@ -67,7 +67,7 @@ function getFacetValueForOption(facet: Facet, option: number) { function renderOption(option: number, selected: boolean) { return ( <span> - <SizeRating value={getSizeRatingAverageValue(option)} small={true} muted={!selected} /> + <SizeRating muted={!selected} small={true} value={getSizeRatingAverageValue(option)} /> <span className="spacer-left">{getSizeRatingLabel(option)}</span> </span> ); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx index e8337514883..3227f92daf2 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.tsx @@ -105,29 +105,29 @@ export default class TagsFilter extends React.PureComponent<Props, State> { return ( <Filter - onQueryChange={this.props.onQueryChange} - property={property} - options={this.getSortedOptions(this.props.facet)} - query={this.props.query} - renderOption={this.renderOption} - value={this.props.value} facet={this.props.facet} - maxFacetValue={this.props.maxFacetValue} - organization={this.props.organization} - getFacetValueForOption={this.getFacetValueForOption} - header={<FilterHeader name={translate('projects.facets.tags')} />} footer={ <SearchableFilterFooter - onQueryChange={this.props.onQueryChange} isLoading={this.state.isLoading} onInputChange={this.handleSearch} onOpen={this.handleSearch} - organization={this.props.organization} + onQueryChange={this.props.onQueryChange} options={this.getSearchOptions()} + organization={this.props.organization} property={property} query={this.props.query} /> } + getFacetValueForOption={this.getFacetValueForOption} + header={<FilterHeader name={translate('projects.facets.tags')} />} + maxFacetValue={this.props.maxFacetValue} + onQueryChange={this.props.onQueryChange} + options={this.getSortedOptions(this.props.facet)} + organization={this.props.organization} + property={property} + query={this.props.query} + renderOption={this.renderOption} + value={this.props.value} /> ); } diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx index c9b1faa82e0..4bc227b9949 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/SearchableFilterFooter-test.tsx @@ -31,9 +31,9 @@ it('should render items without the ones in the facet', () => { const wrapper = shallow( <SearchableFilterFooter onQueryChange={jest.fn()} + options={options} property="languages" query={{ languages: ['java'] }} - options={options} />, { context: { router: { push: jest.fn() } } } ); @@ -45,9 +45,9 @@ it('should render items without the ones in the facet', () => { const wrapper = shallow( <SearchableFilterFooter onQueryChange={onQueryChange} + options={options} property="languages" query={{ languages: ['java'] }} - options={options} />, { context: { router: { push: jest.fn() } } } ); diff --git a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/TagsFilter-test.tsx b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/TagsFilter-test.tsx index d7f4ee801ec..b924d7fba44 100644 --- a/server/sonar-web/src/main/js/apps/projects/filters/__tests__/TagsFilter-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/filters/__tests__/TagsFilter-test.tsx @@ -26,7 +26,7 @@ const tagsFacet = { lang: 4, sonar: 3, csharp: 1 }; it('should render the tags without the ones in the facet', () => { const wrapper = shallow( - <TagsFilter onQueryChange={jest.fn()} query={{ tags: null }} facet={tagsFacet} /> + <TagsFilter facet={tagsFacet} onQueryChange={jest.fn()} query={{ tags: null }} /> ); expect(wrapper).toMatchSnapshot(); wrapper.setState({ tags }); @@ -36,10 +36,10 @@ it('should render the tags without the ones in the facet', () => { it('should render the tags facet with the selected tags', () => { const wrapper = shallow( <TagsFilter + facet={tagsFacet} onQueryChange={jest.fn()} query={{ tags: ['lang', 'sonar'] }} value={['lang', 'sonar']} - facet={tagsFacet} /> ); expect(wrapper).toMatchSnapshot(); @@ -49,10 +49,10 @@ it('should render the tags facet with the selected tags', () => { it('should render maximum 10 tags in the searchbox results', () => { const wrapper = shallow( <TagsFilter + facet={{ ...tagsFacet, ad: 1 }} onQueryChange={jest.fn()} query={{ languages: ['java', 'ad'] }} value={['java', 'ad']} - facet={{ ...tagsFacet, ad: 1 }} /> ); wrapper.setState({ tags: [...tags, 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'ag', 'ah', 'ai'] }); diff --git a/server/sonar-web/src/main/js/apps/projects/utils.ts b/server/sonar-web/src/main/js/apps/projects/utils.ts index 753e245be49..474b8d89e8e 100644 --- a/server/sonar-web/src/main/js/apps/projects/utils.ts +++ b/server/sonar-web/src/main/js/apps/projects/utils.ts @@ -360,7 +360,7 @@ function format(periods: Array<{ value: number; label: string }>) { } export function formatDuration(value: number) { - if(value < ONE_MINUTE) { + if (value < ONE_MINUTE) { return translate('duration.seconds'); } const years = Math.floor(value / ONE_YEAR); diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx index 9004f091ac8..30f543f096d 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/AppContainer.tsx @@ -102,5 +102,8 @@ const mapDispatchToProps = (dispatch: Function) => ({ }); export default forSingleOrganization( - connect<StateProps, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)(AppContainer) + connect<StateProps, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps + )(AppContainer) ); diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx index 483d4bfcf0b..d22d36f9c7d 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsApp.tsx @@ -96,7 +96,7 @@ export class DetailsApp extends React.PureComponent<Props, State> { handleAddCondition = (condition: Condition) => { this.setState(({ qualityGate }) => { if (!qualityGate) { - return undefined; + return null; } return { qualityGate: addCondition(qualityGate, condition) }; }); @@ -105,7 +105,7 @@ export class DetailsApp extends React.PureComponent<Props, State> { handleSaveCondition = (newCondition: Condition, oldCondition: Condition) => { this.setState(({ qualityGate }) => { if (!qualityGate) { - return undefined; + return null; } return { qualityGate: replaceCondition(qualityGate, newCondition, oldCondition) }; }); @@ -114,7 +114,7 @@ export class DetailsApp extends React.PureComponent<Props, State> { handleRemoveCondition = (condition: Condition) => { this.setState(({ qualityGate }) => { if (!qualityGate) { - return undefined; + return null; } return { qualityGate: deleteCondition(qualityGate, condition) }; }); @@ -123,7 +123,7 @@ export class DetailsApp extends React.PureComponent<Props, State> { handleSetDefault = () => { this.setState(({ qualityGate }) => { if (!qualityGate) { - return undefined; + return null; } this.props.onSetDefault(qualityGate); const newQualityGate: QualityGate = { diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx index 2c9ab530964..f03ac029d86 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/changelog/Changelog.tsx @@ -59,7 +59,7 @@ export default function Changelog(props: Props) { const className = 'js-profile-changelog-event ' + (isEvenRow ? 'even' : 'odd'); return ( - <tr key={index} className={className}> + <tr className={className} key={index}> <td className="thin nowrap">{!isBulkChange && <DateTimeFormatter date={event.date} />}</td> <td className="thin nowrap"> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx index f461c668672..bb3fa09aa81 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonContainer.tsx @@ -116,10 +116,10 @@ export default class ComparisonContainer extends React.PureComponent<Props, Stat <div className="boxed-group boxed-group-inner js-profile-comparison"> <header> <ComparisonForm - withKey={withKey} + onCompare={this.handleCompare} profile={profile} profiles={profiles} - onCompare={this.handleCompare} + withKey={withKey} /> {this.state.loading && <i className="spinner spacer-left" />} @@ -132,12 +132,12 @@ export default class ComparisonContainer extends React.PureComponent<Props, Stat modified != null && ( <div className="spacer-top"> <ComparisonResults - left={left} - right={right} inLeft={inLeft} inRight={inRight} + left={left} modified={modified} organization={this.props.organization} + right={right} /> </div> )} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx index c2900d499ca..5cbba2b10cc 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonForm.tsx @@ -44,12 +44,12 @@ export default class ComparisonForm extends React.PureComponent<Props> { <div className="display-inline-block"> <label className="spacer-right">{translate('quality_profiles.compare_with')}</label> <Select - value={withKey} - options={options} - placeholder={translate('select_verb')} - clearable={false} className="input-large" + clearable={false} onChange={this.handleChange.bind(this)} + options={options} + placeholder={translate('select_verb')} + value={withKey} /> </div> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx index fc475311f68..b4938f4cf1b 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/ComparisonResults.tsx @@ -57,7 +57,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { return ( <ul> {Object.keys(params).map(key => ( - <li key={key} className="spacer-top"> + <li className="spacer-top" key={key}> <code> {key} {': '} @@ -88,7 +88,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { <td> </td> </tr> {this.props.inLeft.map(rule => ( - <tr key={`left-${rule.key}`} className="js-comparison-in-left"> + <tr className="js-comparison-in-left" key={`left-${rule.key}`}> <td>{this.renderRule(rule, rule.severity)}</td> <td> </td> </tr> @@ -116,7 +116,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { </td> </tr> {this.props.inRight.map(rule => ( - <tr key={`right-${rule.key}`} className="js-comparison-in-right"> + <tr className="js-comparison-in-right" key={`right-${rule.key}`}> <td> </td> <td>{this.renderRule(rule, rule.severity)}</td> </tr> @@ -132,7 +132,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { return ( <> <tr> - <td colSpan={2} className="text-center"> + <td className="text-center" colSpan={2}> <h6> {translateWithParameters( 'quality_profiles.x_rules_have_different_configuration', @@ -150,7 +150,7 @@ export default class ComparisonResults extends React.PureComponent<Props> { </td> </tr> {this.props.modified.map(rule => ( - <tr key={`modified-${rule.key}`} className="js-comparison-modified"> + <tr className="js-comparison-modified" key={`modified-${rule.key}`}> <td> {this.renderRule(rule, rule.left.severity)} {this.renderParameters(rule.left.params)} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx index 9399a905167..74a3797e25a 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonForm-test.tsx @@ -32,10 +32,10 @@ it('should render Select with right options', () => { const output = shallow( <ComparisonForm - withKey="another" + onCompare={() => true} profile={profile} profiles={profiles} - onCompare={() => true} + withKey="another" /> ).find('Select'); expect(output.length).toBe(1); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx index 02c86c35088..6ae04a58e37 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/compare/__tests__/ComparisonResults-test.tsx @@ -26,12 +26,12 @@ import ComparisonEmpty from '../ComparisonEmpty'; it('should render ComparisonEmpty', () => { const output = shallow( <ComparisonResults - left={{ name: 'left' }} - right={{ name: 'right' }} inLeft={[]} inRight={[]} + left={{ name: 'left' }} modified={[]} organization={null} + right={{ name: 'right' }} /> ); expect(output.is(ComparisonEmpty)).toBe(true); @@ -60,12 +60,12 @@ it('should compare', () => { const output = shallow( <ComparisonResults - left={{ name: 'left' }} - right={{ name: 'right' }} inLeft={inLeft} inRight={inRight} + left={{ name: 'left' }} modified={modified} organization={null} + right={{ name: 'right' }} /> ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/AppContainer.tsx index 1da66735a8c..417c54699d6 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/AppContainer.tsx @@ -45,5 +45,8 @@ const mapDispatchToProps = (dispatch: any) => ({ }); export default forSingleOrganization( - connect<StateProps, DispatchProps>(mapStateToProps, mapDispatchToProps)(App) + connect<StateProps, DispatchProps>( + mapStateToProps, + mapDispatchToProps + )(App) ); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx index f55b48206df..bbefe239932 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx +++ b/server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileNotFound.tsx @@ -30,7 +30,7 @@ export default function ProfileNotFound(props: Props) { return ( <div className="quality-profile-not-found"> <div className="note spacer-bottom"> - <IndexLink to={getProfilesPath(props.organization)} className="text-muted"> + <IndexLink className="text-muted" to={getProfilesPath(props.organization)}> {translate('quality_profiles.page')} </IndexLink> </div> diff --git a/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx b/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx index baf38997a15..e1099044232 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/EmailAlreadyExists.tsx @@ -85,9 +85,9 @@ export default class EmailAlreadyExists extends React.PureComponent<Props, State <img alt={identityProvider.name} className="little-spacer-right" + height="14" src={getBaseUrl() + identityProvider.iconPath} width="14" - height="14" /> {login} </div> @@ -102,8 +102,8 @@ export default class EmailAlreadyExists extends React.PureComponent<Props, State const { query } = this.props.location; return ( - <div id="bd" className="page-wrapper-simple"> - <div id="nonav" className="page-simple"> + <div className="page-wrapper-simple" id="bd"> + <div className="page-simple" id="nonav"> <div className="big-spacer-bottom js-existing-account"> <p className="little-spacer-bottom"> <FormattedMessage diff --git a/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx b/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx index 31e0eb9bc60..ed4c7dacfe9 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/LoginContainer.tsx @@ -116,6 +116,7 @@ class LoginContainer extends React.PureComponent<Props, State> { const mapStateToProps = null; const mapDispatchToProps = { doLogin: doLogin as any }; -export default connect<{}, DispatchToProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - LoginContainer -); +export default connect<{}, DispatchToProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(LoginContainer); diff --git a/server/sonar-web/src/main/js/apps/sessions/components/Logout.tsx b/server/sonar-web/src/main/js/apps/sessions/components/Logout.tsx index 8a07c646df8..ceaafa0988f 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/Logout.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/Logout.tsx @@ -54,4 +54,7 @@ const mapStateToProps = () => ({}); const mapDispatchToProps = { doLogout }; -export default connect(mapStateToProps, mapDispatchToProps)(Logout as any); +export default connect( + mapStateToProps, + mapDispatchToProps +)(Logout as any); diff --git a/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx b/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx index cace6275846..048f0d27516 100644 --- a/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx +++ b/server/sonar-web/src/main/js/apps/sessions/components/UpdateLogin.tsx @@ -85,9 +85,9 @@ export default class UpdateLogin extends React.PureComponent<Props, State> { <img alt={identityProvider.name} className="little-spacer-right" + height="14" src={getBaseUrl() + identityProvider.iconPath} width="14" - height="14" /> {login} </div> @@ -102,8 +102,8 @@ export default class UpdateLogin extends React.PureComponent<Props, State> { const { query } = this.props.location; return ( - <div id="bd" className="page-wrapper-simple"> - <div id="nonav" className="page-simple"> + <div className="page-wrapper-simple" id="bd"> + <div className="page-simple" id="nonav"> <div className="big-spacer-bottom js-provider-name"> <p className="little-spacer-bottom"> <FormattedMessage diff --git a/server/sonar-web/src/main/js/apps/settings/components/App.js b/server/sonar-web/src/main/js/apps/settings/components/App.js index 21f8d383e5d..378494100f6 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/App.js +++ b/server/sonar-web/src/main/js/apps/settings/components/App.js @@ -69,7 +69,7 @@ export default class App extends React.PureComponent { const selectedCategory = query.category || this.props.defaultCategory; return ( - <div id="settings-page" className="page page-limited"> + <div className="page page-limited" id="settings-page"> <Suggestions suggestions="settings" /> <Helmet title={translate('settings.page')} /> @@ -79,12 +79,12 @@ export default class App extends React.PureComponent { <div className="side-tabs-side"> <AllCategoriesList component={this.props.component} - selectedCategory={selectedCategory} defaultCategory={this.props.defaultCategory} + selectedCategory={selectedCategory} /> </div> <div className="side-tabs-main"> - <CategoryDefinitionsList component={this.props.component} category={selectedCategory} /> + <CategoryDefinitionsList category={selectedCategory} component={this.props.component} /> {selectedCategory === 'exclusions' && <WildcardsHelp />} </div> </div> diff --git a/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js b/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js index 71a01f026a4..d2d4f003e7a 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js +++ b/server/sonar-web/src/main/js/apps/settings/components/AppContainer.js @@ -28,4 +28,7 @@ const mapStateToProps = state => ({ const mapdispatchToProps = { fetchSettings }; -export default connect(mapStateToProps, mapdispatchToProps)(App); +export default connect( + mapStateToProps, + mapdispatchToProps +)(App); diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js index 3cff69cff00..8b61e566c2e 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/CategoriesList.js @@ -59,7 +59,7 @@ export default class CategoriesList extends React.PureComponent { const pathname = this.props.component ? '/project/settings' : '/settings'; return ( - <IndexLink to={{ pathname, query }} className={className} title={category.name}> + <IndexLink className={className} title={category.name} to={{ pathname, query }}> {category.name} </IndexLink> ); @@ -74,7 +74,9 @@ export default class CategoriesList extends React.PureComponent { return ( <ul className="side-tabs-menu"> - {sortedCategories.map(category => <li key={category.key}>{this.renderLink(category)}</li>)} + {sortedCategories.map(category => ( + <li key={category.key}>{this.renderLink(category)}</li> + ))} </ul> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js index 8f380a5de6d..630ce8bbc98 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/CategoryDefinitionsList.js @@ -33,4 +33,7 @@ const mapStateToProps = (state, ownProps) => ({ const mapDispatchToProps = { fetchValues }; -export default connect(mapStateToProps, mapDispatchToProps)(SubCategoryDefinitionsList); +export default connect( + mapStateToProps, + mapDispatchToProps +)(SubCategoryDefinitionsList); diff --git a/server/sonar-web/src/main/js/apps/settings/components/Definition.js b/server/sonar-web/src/main/js/apps/settings/components/Definition.js index ab25a45251b..668c22c6377 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/Definition.js +++ b/server/sonar-web/src/main/js/apps/settings/components/Definition.js @@ -222,11 +222,14 @@ const mapStateToProps = (state, ownProps) => ({ validationMessage: getSettingsAppValidationMessage(state, ownProps.setting.definition.key) }); -export default connect(mapStateToProps, { - changeValue, - saveValue, - resetValue, - passValidation, - cancelChange, - checkValue -})(Definition); +export default connect( + mapStateToProps, + { + changeValue, + saveValue, + resetValue, + passValidation, + cancelChange, + checkValue + } +)(Definition); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js index 25404abd729..1a7cb685cdb 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForBoolean.js @@ -35,7 +35,7 @@ export default class InputForBoolean extends React.PureComponent { return ( <div className="display-inline-block text-top"> - <Toggle name={this.props.name} value={displayedValue} onChange={this.props.onChange} /> + <Toggle name={this.props.name} onChange={this.props.onChange} value={displayedValue} /> {!hasValue && <span className="spacer-left note">{translate('settings.not_set')}</span>} </div> diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.js index 3df0a656c4c..15173960462 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForSingleSelectList.js @@ -40,12 +40,12 @@ export default class InputForSingleSelectList extends React.PureComponent { return ( <Select - name={this.props.name} className="settings-large-input" - options={options} clearable={false} - value={this.props.value} + name={this.props.name} onChange={option => this.handleInputChange(option)} + options={options} + value={this.props.value} /> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForText.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForText.js index b725fe2653c..7193e8a118d 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForText.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/InputForText.js @@ -30,11 +30,11 @@ export default class InputForText extends React.PureComponent { render() { return ( <textarea - name={this.props.name} className="settings-large-input text-top" + name={this.props.name} + onChange={e => this.handleInputChange(e)} rows="5" value={this.props.value || ''} - onChange={e => this.handleInputChange(e)} /> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js index dae49df28e0..47ddb1945e7 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/MultiValueInput.js @@ -58,11 +58,11 @@ export default class MultiValueInput extends React.PureComponent { renderInput(value, index, isLast) { return ( - <li key={index} className="spacer-bottom"> + <li className="spacer-bottom" key={index}> <PrimitiveInput + onChange={this.handleSingleInputChange.bind(this, index)} setting={this.prepareSetting()} value={value} - onChange={this.handleSingleInputChange.bind(this, index)} /> {!isLast && ( diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.js index a1c956831f6..327031a34e8 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PrimitiveInput.js @@ -54,11 +54,11 @@ export default class PrimitiveInput extends React.PureComponent { if (definition.type === types.TYPE_SINGLE_SELECT_LIST) { return ( <InputForSingleSelectList - name={name} - value={value} isDefault={isDefaultOrInherited(setting)} - options={definition.options} + name={name} onChange={onChange} + options={definition.options} + value={value} {...other} /> ); @@ -67,10 +67,10 @@ export default class PrimitiveInput extends React.PureComponent { const InputComponent = typeMapping[definition.type] || InputForString; return ( <InputComponent - name={name} - value={value} isDefault={isDefaultOrInherited(setting)} + name={name} onChange={onChange} + value={value} {...other} /> ); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js index e7e4425226a..62f86adf2a9 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/PropertySetInput.js @@ -61,9 +61,9 @@ export default class PropertySetInput extends React.PureComponent { <td key={field.key}> <PrimitiveInput name={this.getFieldName(field)} + onChange={this.handleInputChange.bind(this, index, field.key)} setting={{ definition: field, value: fieldValues[field.key] }} value={fieldValues[field.key]} - onChange={this.handleInputChange.bind(this, index, field.key)} /> </td> ))} diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/SimpleInput.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/SimpleInput.js index b523acb93ab..c2a38bc8bbc 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/SimpleInput.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/SimpleInput.js @@ -50,12 +50,12 @@ export default class SimpleInput extends React.PureComponent { render() { return ( <input - name={this.props.name} className={this.props.className + ' text-top'} - type={this.props.type} - value={this.props.value || ''} + name={this.props.name} onChange={this.handleInputChange} onKeyDown={this.handleKeyDown} + type={this.props.type} + value={this.props.value || ''} /> ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.js index 720192841c9..5877a37a652 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/Input-test.js @@ -28,7 +28,7 @@ import { TYPE_STRING, TYPE_PROPERTY_SET } from '../../../constants'; it('should render PrimitiveInput', () => { const setting = { definition: { key: 'example', type: TYPE_STRING } }; const onChange = jest.fn(); - const input = shallow(<Input setting={setting} value="foo" onChange={onChange} />).find( + const input = shallow(<Input onChange={onChange} setting={setting} value="foo" />).find( PrimitiveInput ); expect(input.length).toBe(1); @@ -41,7 +41,7 @@ it('should render MultiValueInput', () => { const setting = { definition: { key: 'example', type: TYPE_STRING, multiValues: true } }; const value = ['foo', 'bar']; const onChange = jest.fn(); - const input = shallow(<Input setting={setting} value={value} onChange={onChange} />).find( + const input = shallow(<Input onChange={onChange} setting={setting} value={value} />).find( MultiValueInput ); expect(input.length).toBe(1); @@ -54,7 +54,7 @@ it('should render PropertySetInput', () => { const setting = { definition: { key: 'example', type: TYPE_PROPERTY_SET, fields: [] } }; const value = [{ foo: 'bar' }]; const onChange = jest.fn(); - const input = shallow(<Input setting={setting} value={value} onChange={onChange} />).find( + const input = shallow(<Input onChange={onChange} setting={setting} value={value} />).find( PropertySetInput ); expect(input.length).toBe(1); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForBoolean-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForBoolean-test.js index d41e16499e3..95b3809b449 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForBoolean-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForBoolean-test.js @@ -25,7 +25,7 @@ import Toggle from '../../../../../components/controls/Toggle'; it('should render Toggle', () => { const onChange = jest.fn(); const toggle = shallow( - <InputForBoolean name="foo" value={true} isDefault={false} onChange={onChange} /> + <InputForBoolean isDefault={false} name="foo" onChange={onChange} value={true} /> ).find(Toggle); expect(toggle.length).toBe(1); expect(toggle.prop('name')).toBe('foo'); @@ -35,7 +35,7 @@ it('should render Toggle', () => { it('should render Toggle without value', () => { const onChange = jest.fn(); - const input = shallow(<InputForBoolean name="foo" isDefault={false} onChange={onChange} />); + const input = shallow(<InputForBoolean isDefault={false} name="foo" onChange={onChange} />); const toggle = input.find(Toggle); expect(toggle.length).toBe(1); expect(toggle.prop('name')).toBe('foo'); @@ -47,7 +47,7 @@ it('should render Toggle without value', () => { it('should call onChange', () => { const onChange = jest.fn(); const input = shallow( - <InputForBoolean name="foo" value={true} isDefault={false} onChange={onChange} /> + <InputForBoolean isDefault={false} name="foo" onChange={onChange} value={true} /> ); const toggle = input.find(Toggle); expect(toggle.length).toBe(1); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForNumber-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForNumber-test.js index c614256196a..4745ce34095 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForNumber-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForNumber-test.js @@ -25,7 +25,7 @@ import SimpleInput from '../SimpleInput'; it('should render SimpleInput', () => { const onChange = jest.fn(); const simpleInput = shallow( - <InputForNumber name="foo" value={17} isDefault={false} onChange={onChange} /> + <InputForNumber isDefault={false} name="foo" onChange={onChange} value={17} /> ).find(SimpleInput); expect(simpleInput.length).toBe(1); expect(simpleInput.prop('name')).toBe('foo'); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.js index 25bcf056722..e3c17c02f6a 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForSingleSelectList-test.js @@ -25,11 +25,11 @@ it('should render Select', () => { const onChange = jest.fn(); const select = shallow( <InputForSingleSelectList - name="foo" - value="bar" - options={['foo', 'bar', 'baz']} isDefault={false} + name="foo" onChange={onChange} + options={['foo', 'bar', 'baz']} + value="bar" /> ).find('Select'); expect(select.length).toBe(1); @@ -47,11 +47,11 @@ it('should call onChange', () => { const onChange = jest.fn(); const select = shallow( <InputForSingleSelectList - name="foo" - value="bar" - options={['foo', 'bar', 'baz']} isDefault={false} + name="foo" onChange={onChange} + options={['foo', 'bar', 'baz']} + value="bar" /> ).find('Select'); expect(select.length).toBe(1); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForString-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForString-test.js index 7cb444c2dd1..01f312c49f8 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForString-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForString-test.js @@ -25,7 +25,7 @@ import SimpleInput from '../SimpleInput'; it('should render SimpleInput', () => { const onChange = jest.fn(); const simpleInput = shallow( - <InputForString name="foo" value="bar" isDefault={false} onChange={onChange} /> + <InputForString isDefault={false} name="foo" onChange={onChange} value="bar" /> ).find(SimpleInput); expect(simpleInput.length).toBe(1); expect(simpleInput.prop('name')).toBe('foo'); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForText-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForText-test.js index 34d944cd0a5..387873b0cd9 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForText-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/InputForText-test.js @@ -25,7 +25,7 @@ import { change } from '../../../../../helpers/testUtils'; it('should render textarea', () => { const onChange = jest.fn(); const textarea = shallow( - <InputForText name="foo" value="bar" isDefault={false} onChange={onChange} /> + <InputForText isDefault={false} name="foo" onChange={onChange} value="bar" /> ).find('textarea'); expect(textarea.length).toBe(1); expect(textarea.prop('name')).toBe('foo'); @@ -36,7 +36,7 @@ it('should render textarea', () => { it('should call onChange', () => { const onChange = jest.fn(); const textarea = shallow( - <InputForText name="foo" value="bar" isDefault={false} onChange={onChange} /> + <InputForText isDefault={false} name="foo" onChange={onChange} value="bar" /> ).find('textarea'); expect(textarea.length).toBe(1); expect(textarea.prop('onChange')).toBeTruthy(); diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js index 94c0df554ab..b8a777db0f3 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/MultiValueInput-test.js @@ -34,7 +34,7 @@ const assertValues = (inputs, values) => { it('should render one value', () => { const multiValueInput = shallow( - <MultiValueInput setting={{ definition }} value={['foo']} onChange={jest.fn()} /> + <MultiValueInput onChange={jest.fn()} setting={{ definition }} value={['foo']} /> ); const stringInputs = multiValueInput.find(PrimitiveInput); expect(stringInputs.length).toBe(1 + 1); @@ -43,7 +43,7 @@ it('should render one value', () => { it('should render several values', () => { const multiValueInput = shallow( - <MultiValueInput setting={{ definition }} value={['foo', 'bar', 'baz']} onChange={jest.fn()} /> + <MultiValueInput onChange={jest.fn()} setting={{ definition }} value={['foo', 'bar', 'baz']} /> ); const stringInputs = multiValueInput.find(PrimitiveInput); expect(stringInputs.length).toBe(3 + 1); @@ -53,7 +53,7 @@ it('should render several values', () => { it('should remove value', () => { const onChange = jest.fn(); const multiValueInput = shallow( - <MultiValueInput setting={{ definition }} value={['foo', 'bar', 'baz']} onChange={onChange} /> + <MultiValueInput onChange={onChange} setting={{ definition }} value={['foo', 'bar', 'baz']} /> ); click(multiValueInput.find('.js-remove-value').at(1)); expect(onChange).toBeCalledWith(['foo', 'baz']); @@ -62,7 +62,7 @@ it('should remove value', () => { it('should change existing value', () => { const onChange = jest.fn(); const multiValueInput = shallow( - <MultiValueInput setting={{ definition }} value={['foo', 'bar', 'baz']} onChange={onChange} /> + <MultiValueInput onChange={onChange} setting={{ definition }} value={['foo', 'bar', 'baz']} /> ); multiValueInput .find(PrimitiveInput) @@ -74,7 +74,7 @@ it('should change existing value', () => { it('should add new value', () => { const onChange = jest.fn(); const multiValueInput = shallow( - <MultiValueInput setting={{ definition }} value={['foo']} onChange={onChange} /> + <MultiValueInput onChange={onChange} setting={{ definition }} value={['foo']} /> ); multiValueInput .find(PrimitiveInput) diff --git a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/SimpleInput-test.js b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/SimpleInput-test.js index 42973678530..35f2c967252 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/SimpleInput-test.js +++ b/server/sonar-web/src/main/js/apps/settings/components/inputs/__tests__/SimpleInput-test.js @@ -26,12 +26,12 @@ it('should render input', () => { const onChange = jest.fn(); const input = shallow( <SimpleInput - type="text" className="input-large" - name="foo" - value="bar" isDefault={false} + name="foo" onChange={onChange} + type="text" + value="bar" /> ).find('input'); expect(input.length).toBe(1); @@ -46,12 +46,12 @@ it('should call onChange', () => { const onChange = jest.fn(); const input = shallow( <SimpleInput - type="text" className="input-large" - name="foo" - value="bar" isDefault={false} + name="foo" onChange={onChange} + type="text" + value="bar" /> ).find('input'); expect(input.length).toBe(1); diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js index 5885ca220b0..89f918dd457 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js +++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionApp.js @@ -43,7 +43,7 @@ export default class EncryptionApp extends React.PureComponent { render() { return ( - <div id="encryption-page" className="page page-limited"> + <div className="page page-limited" id="encryption-page"> <Helmet title={translate('property.category.security.encryption')} /> <header className="page-header"> <h1 className="page-title">{translate('property.category.security.encryption')}</h1> @@ -53,8 +53,8 @@ export default class EncryptionApp extends React.PureComponent { {!this.props.loading && !this.props.secretKeyAvailable && ( <GenerateSecretKeyForm - secretKey={this.props.secretKey} generateSecretKey={this.props.generateSecretKey} + secretKey={this.props.secretKey} /> )} diff --git a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionAppContainer.js b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionAppContainer.js index 95c90a3f2f2..80c24b3527f 100644 --- a/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionAppContainer.js +++ b/server/sonar-web/src/main/js/apps/settings/encryption/EncryptionAppContainer.js @@ -27,9 +27,12 @@ import { } from '../store/encryptionPage/actions'; import { getSettingsAppEncryptionState } from '../../../store/rootReducer'; -export default connect(state => getSettingsAppEncryptionState(state), { - checkSecretKey, - generateSecretKey, - encryptValue, - startGeneration -})(EncryptionApp); +export default connect( + state => getSettingsAppEncryptionState(state), + { + checkSecretKey, + generateSecretKey, + encryptValue, + startGeneration + } +)(EncryptionApp); diff --git a/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx b/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx index 1d7ae6d3f8c..e6df1fa0c2c 100644 --- a/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/ClusterSysInfos.tsx @@ -56,9 +56,9 @@ export default function ClusterSysInfos({ expandedCards, sysInfoData, toggleCard </li> {sortBy(getAppNodes(sysInfoData), getNodeName).map(node => ( <HealthCard - key={getNodeName(node)} health={getHealth(node)} healthCauses={getHealthCauses(node)} + key={getNodeName(node)} name={getNodeName(node)} onClick={toggleCard} open={expandedCards.includes(getNodeName(node))} @@ -68,9 +68,9 @@ export default function ClusterSysInfos({ expandedCards, sysInfoData, toggleCard <li className="note system-info-health-title">{translate('system.search_nodes_title')}</li> {sortBy(getSearchNodes(sysInfoData), getNodeName).map(node => ( <HealthCard - key={getNodeName(node)} health={getHealth(node)} healthCauses={getHealthCauses(node)} + key={getNodeName(node)} name={getNodeName(node)} onClick={toggleCard} open={expandedCards.includes(getNodeName(node))} diff --git a/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx b/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx index 653a3841154..007e186d0d9 100644 --- a/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/PageHeader.tsx @@ -40,8 +40,8 @@ export default function PageHeader(props: Props) { canRestart={!props.isCluster} cluster={props.isCluster} logLevel={props.logLevel} - serverId={props.serverId} onLogLevelChange={props.onLogLevelChange} + serverId={props.serverId} /> )} {props.loading && ( diff --git a/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx b/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx index 94cbc6b4dc4..85182ef72d2 100644 --- a/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/__tests__/PageHeader-test.tsx @@ -28,8 +28,8 @@ it('should render correctly', () => { isCluster={true} loading={false} logLevel="INFO" - showActions={true} onLogLevelChange={() => {}} + showActions={true} /> ) ).toMatchSnapshot(); @@ -42,8 +42,8 @@ it('should show a loading spinner and no actions', () => { isCluster={true} loading={true} logLevel="INFO" - showActions={false} onLogLevelChange={() => {}} + showActions={false} /> ) ).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx index f042eed7de3..8b621c3d4a6 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthCard.tsx @@ -76,7 +76,7 @@ export default function HealthCard({ title={name}> {showFields && <Section items={mainSection} />} {showSections && - map(sections, (section, name) => <Section key={name} items={section} name={name} />)} + map(sections, (section, name) => <Section items={section} key={name} name={name} />)} </BoxedGroupAccordion> ); } diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthItem.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthItem.tsx index 5bea29aae5c..bdb649e28fb 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/HealthItem.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/HealthItem.tsx @@ -42,7 +42,7 @@ export default function HealthItem({ biggerHealth, className, name, health, heal <div className={classNames('system-info-health-info', className)}> {hasHealthCauses && healthCauses!.map((cause, idx) => ( - <HealthCauseItem key={idx} className="spacer-right" health={health} healthCause={cause} /> + <HealthCauseItem className="spacer-right" health={health} healthCause={cause} key={idx} /> ))} {name ? ( <Tooltip overlay={translateWithParameters('system.current_health_of_x', name)}> diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthItem-test.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthItem-test.tsx index b0e0b9ee348..3e4cacff8ba 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthItem-test.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/HealthItem-test.tsx @@ -25,7 +25,7 @@ import { HealthType } from '../../../../../api/system'; it('should render correctly', () => { expect( shallow( - <HealthItem biggerHealth={true} name="Foo" health={HealthType.RED} healthCauses={['foo']} /> + <HealthItem biggerHealth={true} health={HealthType.RED} healthCauses={['foo']} name="Foo" /> ) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/Section-test.tsx b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/Section-test.tsx index 4e37df1258a..924823697cc 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/Section-test.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/Section-test.tsx @@ -23,7 +23,7 @@ import Section from '../Section'; it('should render correctly', () => { expect( - shallow(<Section name="foo" items={{ foo: 1, bar: 'Bar', baz: false }} />) + shallow(<Section items={{ foo: 1, bar: 'Bar', baz: false }} name="foo" />) ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap index ce4b5077ba0..6b61b4c785e 100644 --- a/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/info-items/__tests__/__snapshots__/SysInfoItem-test.tsx.snap @@ -136,7 +136,7 @@ Array [ "clipRule": "evenodd", "fillRule": "evenodd", "strokeLinejoin": "round", - "strokeMiterlimit": "1.41421", + "strokeMiterlimit": 1.41421, } } version="1.1" diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx index 4112b1be239..be2274f7037 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx @@ -54,10 +54,10 @@ export default class SystemUpgradeForm extends React.PureComponent<Props, State> {systemUpgrades.map((upgrades, idx) => ( <SystemUpgradeItem key={upgrades[upgrades.length - 1].version} + systemUpgrades={upgrades} type={ idx === 0 ? translate('system.latest_version') : translate('system.lts_version') } - systemUpgrades={upgrades} /> ))} </div> diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx index 7fd5d5121f0..24f01859547 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/SystemUpgradeItem-test.tsx @@ -54,6 +54,6 @@ it('should display correctly', () => { }); it('should display a badge', () => { - const wrapper = shallow(<SystemUpgradeItem type="LTS Version" systemUpgrades={UPGRADES} />); + const wrapper = shallow(<SystemUpgradeItem systemUpgrades={UPGRADES} type="LTS Version" />); expect(wrapper.find('h1').exists()).toBeTruthy(); }); diff --git a/server/sonar-web/src/main/js/apps/system/utils.ts b/server/sonar-web/src/main/js/apps/system/utils.ts index e24f796cd60..eb0b963bf6e 100644 --- a/server/sonar-web/src/main/js/apps/system/utils.ts +++ b/server/sonar-web/src/main/js/apps/system/utils.ts @@ -192,16 +192,19 @@ export function groupSections(sysInfoData: SysValueObject) { return { mainSection, sections }; } -export const parseQuery = memoize((urlQuery: RawQuery): Query => ({ - expandedCards: parseAsArray(urlQuery.expand, parseAsString) -})); - -export const serializeQuery = memoize((query: Query): RawQuery => - cleanQuery({ - expand: serializeStringArray(query.expandedCards) +export const parseQuery = memoize( + (urlQuery: RawQuery): Query => ({ + expandedCards: parseAsArray(urlQuery.expand, parseAsString) }) ); +export const serializeQuery = memoize( + (query: Query): RawQuery => + cleanQuery({ + expand: serializeStringArray(query.expandedCards) + }) +); + export function sortUpgrades(upgrades: SystemUpgrade[]): SystemUpgrade[] { return sortBy(upgrades, [ (upgrade: SystemUpgrade) => -Number(upgrade.version.split('.')[0]), diff --git a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx index d69e98ae561..cd5bc33f08c 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx +++ b/server/sonar-web/src/main/js/apps/tutorials/onboarding/OnboardingPage.tsx @@ -96,4 +96,7 @@ export class OnboardingPage extends React.PureComponent<DispatchProps, State> { const mapDispatchToProps: DispatchProps = { skipOnboardingAction }; -export default connect<{}, DispatchProps>(null, mapDispatchToProps)(OnboardingPage); +export default connect<{}, DispatchProps>( + null, + mapDispatchToProps +)(OnboardingPage); diff --git a/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboardingPage.tsx b/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboardingPage.tsx index 5d0978e41d9..e3e747805fc 100644 --- a/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboardingPage.tsx +++ b/server/sonar-web/src/main/js/apps/tutorials/projectOnboarding/ProjectOnboardingPage.tsx @@ -44,4 +44,7 @@ export class ProjectOnboardingPage extends React.PureComponent<DispatchProps> { const mapDispatchToProps: DispatchProps = { skipOnboarding }; -export default connect<{}, DispatchProps>(null, mapDispatchToProps)(ProjectOnboardingPage); +export default connect<{}, DispatchProps>( + null, + mapDispatchToProps +)(ProjectOnboardingPage); diff --git a/server/sonar-web/src/main/js/apps/users/Search.tsx b/server/sonar-web/src/main/js/apps/users/Search.tsx index 5df5684f10c..8ffb2ff98ff 100644 --- a/server/sonar-web/src/main/js/apps/users/Search.tsx +++ b/server/sonar-web/src/main/js/apps/users/Search.tsx @@ -36,7 +36,7 @@ export default class Search extends React.PureComponent<Props> { const { query } = this.props; return ( - <div id="users-search" className="panel panel-vertical bordered-bottom spacer-bottom"> + <div className="panel panel-vertical bordered-bottom spacer-bottom" id="users-search"> <SearchBox minLength={2} onChange={this.handleSearch} diff --git a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx index e0ea3203655..edefebb1086 100644 --- a/server/sonar-web/src/main/js/apps/users/UsersApp.tsx +++ b/server/sonar-web/src/main/js/apps/users/UsersApp.tsx @@ -124,7 +124,7 @@ export default class UsersApp extends React.PureComponent<Props, State> { const query = parseQuery(this.props.location.query); const { loading, paging, users } = this.state; return ( - <div id="users-page" className="page page-limited"> + <div className="page page-limited" id="users-page"> <Suggestions suggestions="users" /> <Helmet title={translate('users.page')} /> <Header loading={loading} onUpdateUsers={this.fetchUsers} /> @@ -140,9 +140,9 @@ export default class UsersApp extends React.PureComponent<Props, State> { {paging !== undefined && ( <ListFooter count={users.length} - total={paging.total} - ready={!loading} loadMore={this.fetchMoreUsers} + ready={!loading} + total={paging.total} /> )} </div> diff --git a/server/sonar-web/src/main/js/apps/users/UsersList.tsx b/server/sonar-web/src/main/js/apps/users/UsersList.tsx index de981b356f0..8888af81c51 100644 --- a/server/sonar-web/src/main/js/apps/users/UsersList.tsx +++ b/server/sonar-web/src/main/js/apps/users/UsersList.tsx @@ -41,7 +41,7 @@ export default function UsersList({ }: Props) { return ( <div className="boxed-group boxed-group-inner"> - <table id="users-list" className="data zebra"> + <table className="data zebra" id="users-list"> <thead> <tr> <th /> diff --git a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx index dceecaeafd1..53ab715e8da 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserGroups.tsx @@ -54,14 +54,14 @@ export default class UserGroups extends React.PureComponent<Props, State> { return ( <ul> {groups.slice(0, limit).map(group => ( - <li key={group} className="little-spacer-bottom"> + <li className="little-spacer-bottom" key={group}> {group} </li> ))} {groups.length > GROUPS_LIMIT && this.state.showMore && groups.slice(limit).map(group => ( - <li key={group} className="little-spacer-bottom"> + <li className="little-spacer-bottom" key={group}> {group} </li> ))} diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx index 4848a05c853..33562848989 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserListItem.tsx @@ -62,7 +62,7 @@ export default class UserListItem extends React.PureComponent<Props, State> { </td> {!organizationsEnabled && ( <td> - <UserGroups groups={user.groups || []} user={user} onUpdateUsers={onUpdateUsers} /> + <UserGroups groups={user.groups || []} onUpdateUsers={onUpdateUsers} user={user} /> </td> )} <td> @@ -83,9 +83,9 @@ export default class UserListItem extends React.PureComponent<Props, State> { </td> {this.state.openTokenForm && ( <TokensFormModal - user={user} onClose={this.handleCloseTokensForm} updateTokensCount={this.props.updateTokensCount} + user={user} /> )} </tr> diff --git a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx index a609e1c9145..1d3ff144df0 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserListItemIdentity.tsx @@ -60,15 +60,15 @@ export function ExternalProvider({ identityProvider, user }: Props) { <div className="identity-provider" style={{ - 'background-color': identityProvider.backgroundColor, + backgroundColor: identityProvider.backgroundColor, color: getTextColor(identityProvider.backgroundColor, theme.secondFontColor) }}> <img alt={identityProvider.name} className="little-spacer-right" + height="14" src={getBaseUrl() + identityProvider.iconPath} width="14" - height="14" /> {user.externalIdentity} </div> diff --git a/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx b/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx index 07a6766077d..67938f2e702 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserScmAccounts.tsx @@ -44,14 +44,14 @@ export default class UserScmAccounts extends React.PureComponent<Props, State> { return ( <ul> {scmAccounts.slice(0, limit).map((scmAccount, idx) => ( - <li key={idx} className="little-spacer-bottom"> + <li className="little-spacer-bottom" key={idx}> {scmAccount} </li> ))} {scmAccounts.length > SCM_LIMIT && (this.state.showMore ? ( scmAccounts.slice(limit).map((scmAccount, idx) => ( - <li key={idx + limit} className="little-spacer-bottom"> + <li className="little-spacer-bottom" key={idx + limit}> {scmAccount} </li> )) diff --git a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx index 7fb84c7f497..9628b48edc4 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UsersSelectSearch.tsx @@ -103,19 +103,19 @@ export default class UsersSelectSearch extends React.PureComponent<Props, State> <Select autoFocus={this.props.autoFocus} className="Select-big" - options={this.state.searchResult} + clearable={false} isLoading={this.state.isLoading} - optionComponent={UsersSelectSearchOption} - valueComponent={UsersSelectSearchValue} + labelKey="name" + noResultsText={noResult} onChange={this.props.handleValueChange} onInputChange={this.handleInputChange} - value={this.props.selectedUser} + optionComponent={UsersSelectSearchOption} + options={this.state.searchResult} placeholder="" - noResultsText={noResult} - labelKey="name" - valueKey="login" - clearable={false} searchable={true} + value={this.props.selectedUser} + valueComponent={UsersSelectSearchValue} + valueKey="login" /> ); } diff --git a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx index 26210e9dfc7..87973ed58e4 100644 --- a/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/__tests__/UsersSelectSearch-test.tsx @@ -41,10 +41,10 @@ describe('UsersSelectSearch', () => { const onSearch = jest.fn(() => Promise.resolve(users)); const wrapper = shallow( <UsersSelectSearch - selectedUser={selectedUser} excludedUsers={excludedUsers} handleValueChange={jest.fn()} searchUsers={onSearch} + selectedUser={selectedUser} /> ); expect(wrapper).toMatchSnapshot(); @@ -57,7 +57,7 @@ describe('UsersSelectSearch', () => { describe('UsersSelectSearchOption', () => { it('should render correctly without all parameters', () => { const wrapper = shallow( - <UsersSelectSearchOption option={selectedUser} onFocus={jest.fn()} onSelect={jest.fn()}> + <UsersSelectSearchOption onFocus={jest.fn()} onSelect={jest.fn()} option={selectedUser}> {selectedUser.name} </UsersSelectSearchOption> ); @@ -66,7 +66,7 @@ describe('UsersSelectSearchOption', () => { it('should render correctly with email instead of hash', () => { const wrapper = shallow( - <UsersSelectSearchOption option={users[0]} onFocus={jest.fn()} onSelect={jest.fn()}> + <UsersSelectSearchOption onFocus={jest.fn()} onSelect={jest.fn()} option={users[0]}> {users[0].name} </UsersSelectSearchOption> ); diff --git a/server/sonar-web/src/main/js/apps/users/utils.ts b/server/sonar-web/src/main/js/apps/users/utils.ts index 937c46eadc1..abb0fcc3d78 100644 --- a/server/sonar-web/src/main/js/apps/users/utils.ts +++ b/server/sonar-web/src/main/js/apps/users/utils.ts @@ -24,12 +24,15 @@ export interface Query { search: string; } -export const parseQuery = memoize((urlQuery: RawQuery): Query => ({ - search: parseAsString(urlQuery['search']) -})); - -export const serializeQuery = memoize((query: Query): RawQuery => - cleanQuery({ - search: query.search ? serializeString(query.search) : undefined +export const parseQuery = memoize( + (urlQuery: RawQuery): Query => ({ + search: parseAsString(urlQuery['search']) }) ); + +export const serializeQuery = memoize( + (query: Query): RawQuery => + cleanQuery({ + search: query.search ? serializeString(query.search) : undefined + }) +); diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx index b59e8cb07a8..9d205e3b5f6 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Action.tsx @@ -130,16 +130,18 @@ export default class Action extends React.PureComponent<Props, State> { const actionKey = getActionKey(domain.path, action.key); return ( - <div id={actionKey} className="boxed-group"> + <div className="boxed-group" id={actionKey}> <header className="web-api-action-header boxed-group-header"> <Link - to={{ pathname: '/web_api/' + actionKey }} - className="spacer-right link-no-underline"> + className="spacer-right link-no-underline" + to={{ pathname: '/web_api/' + actionKey }}> <LinkIcon /> </Link> <h3 className="web-api-action-title"> - {verb} {actionKey} + {verb} + + {actionKey} </h3> {action.internal && ( @@ -179,7 +181,7 @@ export default class Action extends React.PureComponent<Props, State> { )} {showResponse && - action.hasResponseExample && <ResponseExample domain={domain} action={action} />} + action.hasResponseExample && <ResponseExample action={action} domain={domain} />} {showChangelog && <ActionChangelog changelog={action.changelog} />} </div> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx b/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx index f02cd0d7ff2..47e57ec9ebc 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/ActionChangelog.tsx @@ -28,7 +28,7 @@ export default function ActionChangelog({ changelog }: Props) { return ( <ul className="big-spacer-top"> {changelog.map((item, index) => ( - <li key={index} className="spacer-top"> + <li className="spacer-top" key={index}> <span className="spacer-right badge">{item.version}</span> {item.description} </li> diff --git a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx index 9a433edfc74..1b5f8995549 100644 --- a/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx +++ b/server/sonar-web/src/main/js/apps/web-api/components/Params.tsx @@ -90,7 +90,7 @@ export default function Params({ params, showDeprecated, showInternal }: Props) <h4>{translate('api_documentation.possible_values')}</h4> <ul className="list-styled"> {param.possibleValues.map(value => ( - <li key={value} className="little-spacer-top"> + <li className="little-spacer-top" key={value}> <code>{value}</code> </li> ))} diff --git a/server/sonar-web/src/main/js/apps/web-api/utils.ts b/server/sonar-web/src/main/js/apps/web-api/utils.ts index dceaf980e70..0fabf35af39 100644 --- a/server/sonar-web/src/main/js/apps/web-api/utils.ts +++ b/server/sonar-web/src/main/js/apps/web-api/utils.ts @@ -64,16 +64,19 @@ export const isDomainPathActive = (path: string, splat: string) => { return true; }; -export const parseQuery = memoize((urlQuery: RawQuery): Query => ({ - search: parseAsString(urlQuery['query']), - deprecated: parseAsOptionalBoolean(urlQuery['deprecated']) || false, - internal: parseAsOptionalBoolean(urlQuery['internal']) || false -})); - -export const serializeQuery = memoize((query: Query): RawQuery => - cleanQuery({ - query: query.search ? serializeString(query.search) : undefined, - deprecated: query.deprecated || undefined, - internal: query.internal || undefined +export const parseQuery = memoize( + (urlQuery: RawQuery): Query => ({ + search: parseAsString(urlQuery['query']), + deprecated: parseAsOptionalBoolean(urlQuery['deprecated']) || false, + internal: parseAsOptionalBoolean(urlQuery['internal']) || false }) ); + +export const serializeQuery = memoize( + (query: Query): RawQuery => + cleanQuery({ + query: query.search ? serializeString(query.search) : undefined, + deprecated: query.deprecated || undefined, + internal: query.internal || undefined + }) +); diff --git a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx index 5e5366e70f6..c1622381057 100644 --- a/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx +++ b/server/sonar-web/src/main/js/apps/webhooks/components/DeliveriesForm.tsx @@ -97,7 +97,9 @@ export default class DeliveriesForm extends React.PureComponent<Props, State> { <h2>{header}</h2> </header> <div className="modal-body modal-container"> - {deliveries.map(delivery => <DeliveryAccordion delivery={delivery} key={delivery.id} />)} + {deliveries.map(delivery => ( + <DeliveryAccordion delivery={delivery} key={delivery.id} /> + ))} <div className="text-center"> <DeferredSpinner loading={loading} /> </div> diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx index 2e0a1c2daf8..5e6a563abf2 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewer.tsx @@ -47,6 +47,7 @@ const mapDispatchToProps: DispatchProps = { onReceiveComponent }; type OwnProps = Omit<Props, keyof DispatchProps>; -export default connect<null, DispatchProps, OwnProps>(mapStateToProps, mapDispatchToProps)( - lazyLoad(() => import(/* webpackPrefetch: true */ './SourceViewerBase')) -); +export default connect<null, DispatchProps, OwnProps>( + mapStateToProps, + mapDispatchToProps +)(lazyLoad(() => import(/* webpackPrefetch: true */ './SourceViewerBase'))); diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx index 826cd8781a8..c403c76d948 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.tsx @@ -501,18 +501,16 @@ export default class SourceViewerBase extends React.PureComponent<Props, State> }).then( r => { if (this.mounted) { - this.setState(() => { - const changes: Partial<State> = { - displayDuplications: true, - duplications: r.duplications, - duplicationsByLine: duplicationsByLine(r.duplications), - duplicatedFiles: r.files - }; - if (r.duplications.length === 1) { - changes.linePopup = { index: 0, line: line.line, name: 'duplications' }; - } - return changes; - }); + this.setState(state => ({ + displayDuplications: true, + duplications: r.duplications, + duplicationsByLine: duplicationsByLine(r.duplications), + duplicatedFiles: r.files, + linePopup: + r.duplications.length === 1 + ? { index: 0, line: line.line, name: 'duplications' } + : state.linePopup + })); } }, () => { diff --git a/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx b/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx index 88e0809d4af..9c35f78e269 100644 --- a/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx +++ b/server/sonar-web/src/main/js/components/SourceViewer/components/CoveragePopup.tsx @@ -152,7 +152,10 @@ export default class CoveragePopup extends React.PureComponent<Props, State> { <TestStatusIcon className="spacer-right" status={testCase.status} /> <div className="display-inline-block text-ellipsis">{testCase.name}</div> {testCase.status !== 'SKIPPED' && ( - <span className="spacer-left note">{testCase.durationInMs}ms</span> + <span className="spacer-left note"> + {testCase.durationInMs} + ms + </span> )} </li> ))} diff --git a/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js b/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js index dc21bfe550a..7ff162330c6 100644 --- a/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js +++ b/server/sonar-web/src/main/js/components/charts/AdvancedTimeline.js @@ -230,7 +230,9 @@ export default class AdvancedTimeline extends React.PureComponent { const parentBbox = this.getMouseOverlayPos(evt.target); const mouseXPos = (evt.pageX - parentBbox.left) / parentBbox.width; const xRange = xScale.range(); - const speed = evt.deltaMode ? 25 / evt.deltaMode * this.props.zoomSpeed : this.props.zoomSpeed; + const speed = evt.deltaMode + ? (25 / evt.deltaMode) * this.props.zoomSpeed + : this.props.zoomSpeed; const leftPos = xRange[0] - Math.round(speed * evt.deltaY * mouseXPos); const rightPos = xRange[1] + Math.round(speed * evt.deltaY * (1 - mouseXPos)); const startDate = leftPos > maxXRange[0] ? xScale.invert(leftPos) : null; diff --git a/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.tsx b/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.tsx index 5edfc0f5253..54d44d78a53 100644 --- a/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.tsx +++ b/server/sonar-web/src/main/js/components/charts/ColorBoxLegend.tsx @@ -28,7 +28,7 @@ interface Props { colorNA?: string; colorScale: | ScaleOrdinal<string, string> // used for LEVEL type - | ScaleLinear<number, string | number>; // used for RATING or PERCENT type + | ScaleLinear<string, string | number>; // used for RATING or PERCENT type metricType: string; } diff --git a/server/sonar-web/src/main/js/components/charts/Histogram.tsx b/server/sonar-web/src/main/js/components/charts/Histogram.tsx index 8c5728bb43c..dccb146812a 100644 --- a/server/sonar-web/src/main/js/components/charts/Histogram.tsx +++ b/server/sonar-web/src/main/js/components/charts/Histogram.tsx @@ -49,7 +49,7 @@ export default class Histogram extends React.PureComponent<Props> { const x = xScale.range()[0] + (alignTicks ? padding[3] : 0); const y = Math.round(yScale(index)! + yScale.bandwidth() / 2); - return <rect className="bar-chart-bar" x={x} y={y} width={width} height={BAR_HEIGHT} />; + return <rect className="bar-chart-bar" height={BAR_HEIGHT} width={width} x={x} y={y} />; } renderValue(d: number, index: number, xScale: XScale, yScale: YScale) { @@ -66,7 +66,7 @@ export default class Histogram extends React.PureComponent<Props> { return ( <Tooltip overlay={this.props.yTooltips && this.props.yTooltips[index]}> - <text className="bar-chart-tick histogram-value" x={x} y={y} dx="1em" dy="0.3em"> + <text className="bar-chart-tick histogram-value" dx="1em" dy="0.3em" x={x} y={y}> {value} </text> </Tooltip> @@ -89,10 +89,10 @@ export default class Histogram extends React.PureComponent<Props> { return ( <text className={'bar-chart-tick ' + historyTickClass} - x={x} - y={y} dx={alignTicks ? 0 : '-1em'} - dy="0.3em"> + dy="0.3em" + x={x} + y={y}> {tick} </text> ); @@ -128,7 +128,7 @@ export default class Histogram extends React.PureComponent<Props> { .rangeRound([0, availableHeight]); return ( - <svg className="bar-chart" width={this.props.width} height={this.props.height}> + <svg className="bar-chart" height={this.props.height} width={this.props.width}> <g transform={`translate(${this.props.alignTicks ? 4 : padding[3]}, ${padding[0]})`}> {this.renderBars(xScale, yScale)} </g> diff --git a/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx b/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx index e520abdc4a4..457bc24c4ea 100644 --- a/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx +++ b/server/sonar-web/src/main/js/components/charts/LanguageDistribution.tsx @@ -50,10 +50,10 @@ export default function LanguageDistribution(props: Props) { bars={data} height={distribution.length * 25} padding={[0, 60, 0, 80]} + width={props.width} yTicks={yTicks} yTooltips={yTooltips} yValues={yValues} - width={props.width} /> ); diff --git a/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js b/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js index e2cee003b15..a79b1c52e1d 100644 --- a/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js +++ b/server/sonar-web/src/main/js/components/charts/ZoomTimeLine.js @@ -219,7 +219,7 @@ export default class ZoomTimeLine extends React.PureComponent { const nextTick = index + 1 < ticks.length ? ticks[index + 1] : xScale.domain()[1]; const x = (xScale(tick) + xScale(nextTick)) / 2; return ( - <text key={index} className="chart-zoom-tick" x={x} y={y} dy="1.3em"> + <text className="chart-zoom-tick" dy="1.3em" key={index} x={x} y={y}> {format(tick)} </text> ); @@ -235,11 +235,11 @@ export default class ZoomTimeLine extends React.PureComponent { const yRange = yScale.range(); return ( <rect + fill={theme.leakColor} + height={yRange[0] - yRange[yRange.length - 1]} + width={xScale.range()[1] - xScale(this.props.leakPeriodDate)} x={xScale(this.props.leakPeriodDate)} y={yRange[yRange.length - 1]} - width={xScale.range()[1] - xScale(this.props.leakPeriodDate)} - height={yRange[0] - yRange[yRange.length - 1]} - fill={theme.leakColor} /> ); }; @@ -256,9 +256,9 @@ export default class ZoomTimeLine extends React.PureComponent { <g> {this.props.series.map((serie, idx) => ( <path - key={serie.name} className={classNames('line-chart-path', 'line-chart-path-' + idx)} d={lineGenerator(serie.data)} + key={serie.name} /> ))} </g> @@ -278,9 +278,9 @@ export default class ZoomTimeLine extends React.PureComponent { <g> {this.props.series.map((serie, idx) => ( <path - key={serie.name} className={classNames('line-chart-area', 'line-chart-area-' + idx)} d={areaGenerator(serie.data)} + key={serie.name} /> ))} </g> @@ -300,7 +300,6 @@ export default class ZoomTimeLine extends React.PureComponent { <Draggable axis="x" bounds={{ left: options.xDim[0], right: options.xDim[1] }} - position={{ x: options.xPos, y: 0 }} onDrag={this.handleSelectionHandleDrag( options.xScale, options.fixedPos, @@ -313,13 +312,14 @@ export default class ZoomTimeLine extends React.PureComponent { options.fixedPos, options.xDim, options.direction - )}> + )} + position={{ x: options.xPos, y: 0 }}> <rect className="zoom-selection-handle" - x={-3} - y={options.yDim[1]} height={options.yDim[0] - options.yDim[1] + 1} width={6} + x={-3} + y={options.yDim[1]} /> </Draggable> ); @@ -341,31 +341,31 @@ export default class ZoomTimeLine extends React.PureComponent { return ( <g className="chart-zoom"> <DraggableCore - onStart={this.handleNewZoomDragStart(xDim)} onDrag={this.handleNewZoomDrag(xScale, xDim)} + onStart={this.handleNewZoomDragStart(xDim)} onStop={this.handleNewZoomDragEnd(xScale, xDim)}> <rect className="zoom-overlay" - x={xDim[0]} - y={yDim[1]} height={yDim[0] - yDim[1]} width={xDim[1] - xDim[0]} + x={xDim[0]} + y={yDim[1]} /> </DraggableCore> {showZoomArea && ( <Draggable axis="x" bounds={{ left: xDim[0], right: Math.floor(xDim[1] - zoomBoxWidth) }} - position={{ x: xArray[0], y: 0 }} onDrag={this.handleSelectionDrag(xScale, zoomBoxWidth, xDim, true)} - onStop={this.handleSelectionDrag(xScale, zoomBoxWidth, xDim)}> + onStop={this.handleSelectionDrag(xScale, zoomBoxWidth, xDim)} + position={{ x: xArray[0], y: 0 }}> <rect className="zoom-selection" - x={0} - y={yDim[1]} height={yDim[0] - yDim[1] + 1} - width={zoomBoxWidth} onDoubleClick={this.handleDoubleClick(xScale, xDim)} + width={zoomBoxWidth} + x={0} + y={yDim[1]} /> </Draggable> )} @@ -399,7 +399,7 @@ export default class ZoomTimeLine extends React.PureComponent { const { xScale, yScale } = this.getScales(); return ( - <svg className="line-chart " width={this.props.width} height={this.props.height}> + <svg className="line-chart " height={this.props.height} width={this.props.width}> <g transform={`translate(${this.props.padding[3]}, ${this.props.padding[0] + 2})`}> {this.renderLeak(xScale, yScale)} {this.renderBaseLine(xScale, yScale)} diff --git a/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx b/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx index 3d0fa938273..575e9da65f5 100644 --- a/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx +++ b/server/sonar-web/src/main/js/components/charts/__tests__/Histogram-test.tsx @@ -31,8 +31,8 @@ it('renders with yValues', () => { <Histogram bars={[100, 75, 150]} height={75} - yValues={['100.0', '75.0', '150.0']} width={100} + yValues={['100.0', '75.0', '150.0']} /> ) ).toMatchSnapshot(); @@ -44,9 +44,9 @@ it('renders with yValues and yTicks', () => { <Histogram bars={[100, 75, 150]} height={75} + width={100} yTicks={['a', 'b', 'c']} yValues={['100.0', '75.0', '150.0']} - width={100} /> ) ).toMatchSnapshot(); @@ -58,10 +58,10 @@ it('renders with yValues, yTicks and yTooltips', () => { <Histogram bars={[100, 75, 150]} height={75} + width={100} yTicks={['a', 'b', 'c']} yTooltips={['a - 100', 'b - 75', 'c - 150']} yValues={['100.0', '75.0', '150.0']} - width={100} /> ) ).toMatchSnapshot(); diff --git a/server/sonar-web/src/main/js/components/common/MarkdownTips.tsx b/server/sonar-web/src/main/js/components/common/MarkdownTips.tsx index 93755541652..d205f1d56a4 100644 --- a/server/sonar-web/src/main/js/components/common/MarkdownTips.tsx +++ b/server/sonar-web/src/main/js/components/common/MarkdownTips.tsx @@ -35,7 +35,11 @@ export default class MarkdownTips extends React.PureComponent { </a> {':'} <span className="spacer-left">*{translate('bold')}*</span> - <span className="spacer-left">``{translate('code')}``</span> + <span className="spacer-left"> + `` + {translate('code')} + `` + </span> <span className="spacer-left">* {translate('bulleted_point')}</span> </div> ); diff --git a/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx b/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx index c479082670e..f9f5b25d8e3 100644 --- a/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx +++ b/server/sonar-web/src/main/js/components/common/OrganizationAvatar.tsx @@ -38,7 +38,7 @@ export default function OrganizationAvatar({ organization, small }: Props) { 'is-small': small })}> {organization.avatar ? ( - <img className="rounded" src={organization.avatar} alt={organization.name} /> + <img alt={organization.name} className="rounded" src={organization.avatar} /> ) : ( <GenericAvatar name={organization.name} size={small ? 15 : 30} /> )} diff --git a/server/sonar-web/src/main/js/components/common/SelectListItem.js b/server/sonar-web/src/main/js/components/common/SelectListItem.js index 309564a9b5d..6e2ec4d6646 100644 --- a/server/sonar-web/src/main/js/components/common/SelectListItem.js +++ b/server/sonar-web/src/main/js/components/common/SelectListItem.js @@ -57,11 +57,11 @@ export default class SelectListItem extends React.PureComponent { return ( <li> <a - href="#" className={classNames({ active: this.props.active === this.props.item })} + href="#" onClick={this.handleSelect} - onMouseOver={this.handleHover} - onFocus={this.handleHover}> + onFocus={this.handleHover} + onMouseOver={this.handleHover}> {children} </a> </li> diff --git a/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx index 8956e411a50..aa54b80ef33 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx +++ b/server/sonar-web/src/main/js/components/common/__tests__/CodeSnippet-test.tsx @@ -23,10 +23,10 @@ import CodeSnippet from '../CodeSnippet'; it('renders correctly', () => { expect(mount(<CodeSnippet snippet={'foo\nbar'} />)).toMatchSnapshot(); - expect(mount(<CodeSnippet snippet={'foo\nbar'} noCopy={true} />)).toMatchSnapshot(); + expect(mount(<CodeSnippet noCopy={true} snippet={'foo\nbar'} />)).toMatchSnapshot(); }); it('renders correctly with array snippet', () => { expect(mount(<CodeSnippet snippet={['foo', 'bar']} />)).toMatchSnapshot(); - expect(mount(<CodeSnippet snippet={['foo', 'bar']} isOneLine={true} />)).toMatchSnapshot(); + expect(mount(<CodeSnippet isOneLine={true} snippet={['foo', 'bar']} />)).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js b/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js index 892d3226d1b..29832878a31 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js +++ b/server/sonar-web/src/main/js/components/common/__tests__/SelectList-test.js @@ -28,8 +28,8 @@ it('should render correctly without children', () => { expect( shallow( <SelectList - items={['item', 'seconditem', 'third']} currentItem="seconditem" + items={['item', 'seconditem', 'third']} onSelect={onSelect} /> ) @@ -41,10 +41,11 @@ it('should render correctly with children', () => { const items = ['item', 'seconditem', 'third']; expect( shallow( - <SelectList items={items} currentItem="seconditem" onSelect={onSelect}> + <SelectList currentItem="seconditem" items={items} onSelect={onSelect}> {items.map(item => ( - <SelectListItem key={item} item={item}> - <i className="myicon" />item + <SelectListItem item={item} key={item}> + <i className="myicon" /> + item </SelectListItem> ))} </SelectList> @@ -56,10 +57,11 @@ it('should correclty handle user actions', () => { const onSelect = jest.fn(); const items = ['item', 'seconditem', 'third']; const list = mount( - <SelectList items={items} currentItem="seconditem" onSelect={onSelect}> + <SelectList currentItem="seconditem" items={items} onSelect={onSelect}> {items.map(item => ( - <SelectListItem key={item} item={item}> - <i className="myicon" />item + <SelectListItem item={item} key={item}> + <i className="myicon" /> + item </SelectListItem> ))} </SelectList> diff --git a/server/sonar-web/src/main/js/components/controls/FavoriteContainer.ts b/server/sonar-web/src/main/js/components/controls/FavoriteContainer.ts index 5d8d59db663..8d9da47f1a3 100644 --- a/server/sonar-web/src/main/js/components/controls/FavoriteContainer.ts +++ b/server/sonar-web/src/main/js/components/controls/FavoriteContainer.ts @@ -52,4 +52,7 @@ const mapDispatchToProps = (dispatch: Function, ownProps: any) => ({ removeFavorite: () => dispatch(removeFavorite(ownProps.componentKey)) }); -export default connect(mapStateToProps, mapDispatchToProps)(FavoriteBaseStateless); +export default connect( + mapStateToProps, + mapDispatchToProps +)(FavoriteBaseStateless); diff --git a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx index 3c1ec66c76a..d71cec022b5 100644 --- a/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx +++ b/server/sonar-web/src/main/js/components/controls/HomePageSelect.tsx @@ -87,4 +87,7 @@ const mapStateToProps = (state: any): StateProps => ({ const mapDispatchToProps: DispatchProps = { setHomePage }; -export default connect(mapStateToProps, mapDispatchToProps)(HomePageSelect); +export default connect( + mapStateToProps, + mapDispatchToProps +)(HomePageSelect); diff --git a/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx b/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx index 3bc54c83285..33689460fde 100644 --- a/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx +++ b/server/sonar-web/src/main/js/components/controls/RadioToggle.tsx @@ -53,13 +53,13 @@ export default class RadioToggle extends React.PureComponent<Props> { return ( <li key={option.value}> <input - type="radio" + checked={checked} disabled={option.disabled} - name={this.props.name} - value={option.value} id={htmlId} - checked={checked} + name={this.props.name} onChange={this.handleChange} + type="radio" + value={option.value} /> <Tooltip overlay={option.tooltip || undefined}> <label htmlFor={htmlId}>{option.label}</label> diff --git a/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx b/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx index fe437c24b86..b31f8e1ed75 100644 --- a/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx +++ b/server/sonar-web/src/main/js/components/controls/ReloadButton.tsx @@ -37,10 +37,10 @@ export default class ReloadButton extends React.PureComponent<Props> { }; renderIcon = () => ( - <svg width="18" height="24" viewBox="0 0 18 24"> + <svg height="24" viewBox="0 0 18 24" width="18"> <path - fill={theme.secondFontColor} d="M16.6454 8.1084c-.3-.5-.9-.7-1.4-.4-.5.3-.7.9-.4 1.4.9 1.6 1.1 3.4.6 5.1-.5 1.7-1.7 3.2-3.2 4-3.3 1.8-7.4.6-9.1-2.7-1.8-3.1-.8-6.9 2.1-8.8v3.3h2v-7h-7v2h3.9c-3.7 2.5-5 7.5-2.8 11.4 1.6 3 4.6 4.6 7.7 4.6 1.4 0 2.8-.3 4.2-1.1 2-1.1 3.5-3 4.2-5.2.6-2.2.3-4.6-.8-6.6z" + fill={theme.secondFontColor} /> </svg> ); diff --git a/server/sonar-web/src/main/js/components/controls/ScreenPositionFixer.tsx b/server/sonar-web/src/main/js/components/controls/ScreenPositionFixer.tsx index ebf28cf924a..4e381937004 100644 --- a/server/sonar-web/src/main/js/components/controls/ScreenPositionFixer.tsx +++ b/server/sonar-web/src/main/js/components/controls/ScreenPositionFixer.tsx @@ -80,26 +80,26 @@ export default class ScreenPositionFixer extends React.Component<Props, Fixes> { position = () => { // eslint-disable-next-line react/no-find-dom-node const node = findDOMNode(this); - - const { width, height, left, top } = node.getBoundingClientRect(); - - const { clientHeight, clientWidth } = document.body; - - let leftFix = 0; - if (left < EDGE_MARGIN) { - leftFix = EDGE_MARGIN - left; - } else if (left + width > clientWidth - EDGE_MARGIN) { - leftFix = clientWidth - EDGE_MARGIN - left - width; + if (node && node instanceof Element) { + const { width, height, left, top } = node.getBoundingClientRect(); + const { clientHeight, clientWidth } = document.body; + + let leftFix = 0; + if (left < EDGE_MARGIN) { + leftFix = EDGE_MARGIN - left; + } else if (left + width > clientWidth - EDGE_MARGIN) { + leftFix = clientWidth - EDGE_MARGIN - left - width; + } + + let topFix = 0; + if (top < EDGE_MARGIN) { + topFix = EDGE_MARGIN - top; + } else if (top + height > clientHeight - EDGE_MARGIN) { + topFix = clientHeight - EDGE_MARGIN - top - height; + } + + this.setState({ leftFix, topFix }); } - - let topFix = 0; - if (top < EDGE_MARGIN) { - topFix = EDGE_MARGIN - top; - } else if (top + height > clientHeight - EDGE_MARGIN) { - topFix = clientHeight - EDGE_MARGIN - top - height; - } - - this.setState({ leftFix, topFix }); }; render() { diff --git a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx index 17a017881b7..9e25efbdb5c 100644 --- a/server/sonar-web/src/main/js/components/controls/Tooltip.tsx +++ b/server/sonar-web/src/main/js/components/controls/Tooltip.tsx @@ -157,7 +157,7 @@ export class TooltipInner extends React.Component<Props, State> { // eslint-disable-next-line react/no-find-dom-node const toggleNode = findDOMNode(this); - if (toggleNode && this.tooltipNode) { + if (toggleNode && toggleNode instanceof Element && this.tooltipNode) { const toggleRect = toggleNode.getBoundingClientRect(); const tooltipRect = this.tooltipNode.getBoundingClientRect(); const { width, height } = tooltipRect; diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/FavoriteBase-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/FavoriteBase-test.tsx index 1e1640410d9..32118beae7c 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/FavoriteBase-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/FavoriteBase-test.tsx @@ -49,8 +49,8 @@ it('should remove favorite', () => { function renderFavoriteBase(props: Partial<Props> = {}) { return shallow( <FavoriteBase - favorite={true} addFavorite={jest.fn()} + favorite={true} qualifier="TRK" removeFavorite={jest.fn()} {...props} diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/RadioToggle-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/RadioToggle-test.tsx index 153e7556bc0..4aad9d7e3ac 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/RadioToggle-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/RadioToggle-test.tsx @@ -48,5 +48,5 @@ it('accepts advanced options fields', () => { function getSample(props?: any) { const options = [{ value: 'one', label: 'first' }, { value: 'two', label: 'second' }]; - return <RadioToggle options={options} name="sample" onCheck={() => true} {...props} />; + return <RadioToggle name="sample" onCheck={() => true} options={options} {...props} />; } diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx index 9e389326629..41fa47340bd 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/ScreenPositionFixer-test.tsx @@ -29,9 +29,7 @@ jest.mock('lodash', () => { }); jest.mock('react-dom', () => ({ - findDOMNode: jest.fn(() => ({ - getBoundingClientRect: () => ({ width: 0, height: 0, left: 0, top: 0 }) - })) + findDOMNode: jest.fn() })); beforeEach(() => { @@ -92,7 +90,7 @@ it('should re-position when window is resized', () => { function setNodeRect(rect: { width: number; height: number; left: number; top: number }) { const findDOMNode = require('react-dom').findDOMNode as jest.Mock<any>; - findDOMNode.mockImplementation(() => ({ - getBoundingClientRect: () => rect - })); + const element = document.createElement('div'); + Object.defineProperty(element, 'getBoundingClientRect', { value: () => rect }); + findDOMNode.mockReturnValue(element); } diff --git a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx index f3048542aa1..741736da349 100644 --- a/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx +++ b/server/sonar-web/src/main/js/components/controls/__tests__/ValidationModal-test.tsx @@ -40,15 +40,15 @@ function getWrapper(props = {}) { initialValues={{ field: 'foo' }} isInitialValid={true} onClose={jest.fn()} - validate={(values: Values) => ({ field: values.field.length < 2 && 'Too small' })} onSubmit={jest.fn(() => Promise.resolve())} + validate={(values: Values) => ({ field: values.field.length < 2 && 'Too small' })} {...props}> {(props: FormikProps<Values>) => ( <form onSubmit={props.handleSubmit}> <input - onChange={props.handleChange} - onBlur={props.handleBlur} name="field" + onBlur={props.handleBlur} + onChange={props.handleChange} type="text" value={props.values.field} /> diff --git a/server/sonar-web/src/main/js/components/docs/DocCollapsibleBlock.tsx b/server/sonar-web/src/main/js/components/docs/DocCollapsibleBlock.tsx index 47b8c96183d..081da9449ea 100644 --- a/server/sonar-web/src/main/js/components/docs/DocCollapsibleBlock.tsx +++ b/server/sonar-web/src/main/js/components/docs/DocCollapsibleBlock.tsx @@ -36,7 +36,7 @@ export default class DocCollapsibleBlock extends React.PureComponent<{}, State> renderTitle(children: any) { return ( <a - aria-expanded={String(this.state.open)} + aria-expanded={this.state.open} aria-haspopup={true} className="link-no-underline" href="#" diff --git a/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocCollapsibleBlock-test.tsx.snap b/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocCollapsibleBlock-test.tsx.snap index 763267113d6..67244fe808a 100644 --- a/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocCollapsibleBlock-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/docs/__tests__/__snapshots__/DocCollapsibleBlock-test.tsx.snap @@ -7,7 +7,7 @@ exports[`should render a collapsible block 1`] = ` className="collapse-container" > <a - aria-expanded="false" + aria-expanded={false} aria-haspopup={true} className="link-no-underline" href="#" @@ -27,7 +27,7 @@ exports[`should render a collapsible block 2`] = ` className="collapse-container" > <a - aria-expanded="true" + aria-expanded={true} aria-haspopup={true} className="link-no-underline" href="#" diff --git a/server/sonar-web/src/main/js/components/icons-components/DropdownIcon.tsx b/server/sonar-web/src/main/js/components/icons-components/DropdownIcon.tsx index 50990b4f72c..30ff382cf5c 100644 --- a/server/sonar-web/src/main/js/components/icons-components/DropdownIcon.tsx +++ b/server/sonar-web/src/main/js/components/icons-components/DropdownIcon.tsx @@ -36,7 +36,7 @@ export default function DropdownIcon({ height={size} style={turned ? { transform: 'rotate(180deg)' } : undefined} viewBox="0 0 7 16" - width={size / 16 * 7}> + width={(size / 16) * 7}> <path d="M7 6.469a.42.42 0 0 1-.13.307L3.808 9.84a.42.42 0 0 1-.308.13.42.42 0 0 1-.308-.13L.13 6.776A.42.42 0 0 1 0 6.47a.42.42 0 0 1 .13-.308.42.42 0 0 1 .307-.13h6.126a.42.42 0 0 1 .307.13.42.42 0 0 1 .13.308z" style={{ fill }} diff --git a/server/sonar-web/src/main/js/components/icons-components/Icon.tsx b/server/sonar-web/src/main/js/components/icons-components/Icon.tsx index 40a3f9ccdaa..25560e4eac8 100644 --- a/server/sonar-web/src/main/js/components/icons-components/Icon.tsx +++ b/server/sonar-web/src/main/js/components/icons-components/Icon.tsx @@ -55,7 +55,7 @@ export default function Icon({ fillRule: 'evenodd', clipRule: 'evenodd', strokeLinejoin: 'round', - strokeMiterlimit: '1.41421', + strokeMiterlimit: 1.41421, ...style }} version="1.1" diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js index 0edabcb727f..8371d6376b0 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueMessage-test.js @@ -25,9 +25,9 @@ it('should render with the message and a link to open the rule', () => { const element = shallow( <IssueMessage manualVulnerability={false} - rule="javascript:S1067" message="Reduce the number of conditional operators (4) used in the expression" organization="myorg" + rule="javascript:S1067" />, { context: { workspace: {} } } ); diff --git a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js index 38e804a1cd5..4a917cf1ead 100644 --- a/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js +++ b/server/sonar-web/src/main/js/components/issue/components/__tests__/IssueTitleBar-test.js @@ -50,8 +50,8 @@ it('should render the titlebar correctly', () => { const element = shallow( <IssueTitleBar branchLike={{ isMain: false, name: 'feature-1.0', type: 'SHORT' }} - issue={issue} currentPopup={null} + issue={issue} onFail={jest.fn()} togglePopup={jest.fn()} /> @@ -62,8 +62,8 @@ it('should render the titlebar correctly', () => { it('should render the titlebar with the filter', () => { const element = shallow( <IssueTitleBar - issue={issue} currentPopup={null} + issue={issue} onFail={jest.fn()} onFilter={jest.fn()} togglePopup={jest.fn()} diff --git a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js index 3c60cad23a2..a9ec681f27b 100644 --- a/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js +++ b/server/sonar-web/src/main/js/components/issue/popups/ChangelogPopup.js @@ -110,7 +110,9 @@ export default class ChangelogPopup extends React.PureComponent { {item.userName} </p> )} - {item.diffs.map(diff => <IssueChangelogDiff diff={diff} key={diff.key} />)} + {item.diffs.map(diff => ( + <IssueChangelogDiff diff={diff} key={diff.key} /> + ))} </td> </tr> ))} diff --git a/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js b/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js index 9f790afa5cf..b98fb9b22ff 100644 --- a/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js +++ b/server/sonar-web/src/main/js/components/preview-graph/PreviewGraph.js @@ -168,9 +168,7 @@ export default class PreviewGraph extends React.PureComponent { <div> <AdvancedTimeline endDate={null} - startDate={null} height={80} - width={width} hideGrid={true} hideXAxis={true} interpolate="linear" @@ -178,7 +176,9 @@ export default class PreviewGraph extends React.PureComponent { padding={GRAPH_PADDING} series={series} showAreas={['coverage', 'duplications'].includes(graph)} + startDate={null} updateTooltip={this.updateTooltip} + width={width} /> {selectedDate != null && tooltipXPos != null && @@ -210,8 +210,8 @@ export default class PreviewGraph extends React.PureComponent { <div className="overview-analysis-graph big-spacer-bottom spacer-top" onClick={this.handleClick} - tabIndex={0} - role="link"> + role="link" + tabIndex={0}> {this.renderTimeline()} </div> ); diff --git a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx index 8836780c7f9..8081a2c76d3 100644 --- a/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx +++ b/server/sonar-web/src/main/js/components/shared/DrilldownLink.tsx @@ -127,7 +127,7 @@ export default class DrilldownLink extends React.PureComponent<Props> { }); return ( - <Link to={url} className={this.props.className}> + <Link className={this.props.className} to={url}> {this.props.children} </Link> ); diff --git a/server/sonar-web/src/main/js/components/workspace/Workspace.tsx b/server/sonar-web/src/main/js/components/workspace/Workspace.tsx index ea0cc484b7f..3f35a5fdf9b 100644 --- a/server/sonar-web/src/main/js/components/workspace/Workspace.tsx +++ b/server/sonar-web/src/main/js/components/workspace/Workspace.tsx @@ -97,7 +97,7 @@ export default class Workspace extends React.PureComponent<{}, State> { }; openComponent = (component: ComponentDescriptor) => { - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ components: uniqBy([...state.components, component], component => component.key), open: { component: component.key } })); @@ -108,7 +108,7 @@ export default class Workspace extends React.PureComponent<{}, State> { }; openRule = (rule: RuleDescriptor) => { - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ open: { rule: rule.key }, rules: uniqBy([...state.rules, rule], rule => rule.key) })); @@ -119,7 +119,7 @@ export default class Workspace extends React.PureComponent<{}, State> { }; closeComponent = (componentKey: string) => { - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ components: state.components.filter(x => x.key !== componentKey), open: { ...state.open, @@ -129,7 +129,7 @@ export default class Workspace extends React.PureComponent<{}, State> { }; closeRule = (ruleKey: string) => { - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ rules: state.rules.filter(x => x.key !== ruleKey), open: { ...state.open, @@ -141,7 +141,7 @@ export default class Workspace extends React.PureComponent<{}, State> { handleComponentLoad = (details: { key: string; name: string; qualifier: string }) => { if (this.mounted) { const { key, name, qualifier } = details; - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ components: state.components.map( component => (component.key === key ? { ...component, name, qualifier } : component) ) @@ -152,7 +152,7 @@ export default class Workspace extends React.PureComponent<{}, State> { handleRuleLoad = (details: { key: string; name: string }) => { if (this.mounted) { const { key, name } = details; - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ rules: state.rules.map(rule => (rule.key === key ? { ...rule, name } : rule)) })); } @@ -173,7 +173,7 @@ export default class Workspace extends React.PureComponent<{}, State> { resize = (deltaY: number) => { const minHeight = window.innerHeight * MIN_HEIGHT; const maxHeight = window.innerHeight * MAX_HEIGHT; - this.setState((state: State): Partial<State> => ({ + this.setState((state: State) => ({ height: Math.min(maxHeight, Math.max(minHeight, state.height - deltaY)) })); }; diff --git a/server/sonar-web/src/main/js/helpers/cookies.ts b/server/sonar-web/src/main/js/helpers/cookies.ts index 9d6dabbe266..3c37516c6fd 100644 --- a/server/sonar-web/src/main/js/helpers/cookies.ts +++ b/server/sonar-web/src/main/js/helpers/cookies.ts @@ -19,15 +19,17 @@ */ import { memoize } from 'lodash'; -const parseCookies = memoize((documentCookie: string): { [key: string]: string } => { - const rawCookies = documentCookie.split('; '); - const cookies: { [key: string]: string } = {}; - rawCookies.forEach(candidate => { - const [key, value] = candidate.split('='); - cookies[key] = value; - }); - return cookies; -}); +const parseCookies = memoize( + (documentCookie: string): { [key: string]: string } => { + const rawCookies = documentCookie.split('; '); + const cookies: { [key: string]: string } = {}; + rawCookies.forEach(candidate => { + const [key, value] = candidate.split('='); + cookies[key] = value; + }); + return cookies; + } +); export function getCookie(name: string): string | undefined { return parseCookies(document.cookie)[name]; diff --git a/server/sonar-web/src/main/js/store/marketplace/actions.ts b/server/sonar-web/src/main/js/store/marketplace/actions.ts index 3f007ae52e1..5ac8d4d81eb 100644 --- a/server/sonar-web/src/main/js/store/marketplace/actions.ts +++ b/server/sonar-web/src/main/js/store/marketplace/actions.ts @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { Dispatch } from 'react-redux'; +import { Dispatch } from 'redux'; import { getPendingPlugins, PluginPendingResult } from '../../api/plugins'; interface SetPendingPluginsAction { diff --git a/server/sonar-web/src/main/js/store/utils/configureStore.js b/server/sonar-web/src/main/js/store/utils/configureStore.js index a41ada6d570..75bb516bfbe 100644 --- a/server/sonar-web/src/main/js/store/utils/configureStore.js +++ b/server/sonar-web/src/main/js/store/utils/configureStore.js @@ -30,7 +30,10 @@ if (process.env.NODE_ENV === 'development') { composed.push(window.devToolsExtension ? window.devToolsExtension() : f => f); } -const finalCreateStore = compose(applyMiddleware(...middlewares), ...composed)(createStore); +const finalCreateStore = compose( + applyMiddleware(...middlewares), + ...composed +)(createStore); export default function configureStore(rootReducer, initialState) { return finalCreateStore(rootReducer, initialState); diff --git a/server/sonar-web/src/main/js/store/withCurrentUser.tsx b/server/sonar-web/src/main/js/store/withCurrentUser.tsx deleted file mode 100644 index 6656a746931..00000000000 --- a/server/sonar-web/src/main/js/store/withCurrentUser.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { connect } from 'react-redux'; -import * as React from 'react'; -import { getCurrentUser } from './rootReducer'; -import { CurrentUser } from '../app/types'; - -interface StateProps { - currentUser: CurrentUser; -} - -export function withCurrentUser<P extends StateProps>(Component: React.ComponentClass<P>) { - function mapStateToProps(state: any): StateProps { - return { currentUser: getCurrentUser(state) }; - } - - return connect<StateProps>(mapStateToProps)(Component); -} |