]> source.dussan.org Git - sonarqube.git/commitdiff
Fix new flow typed issues
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 9 Jun 2017 13:02:20 +0000 (15:02 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Tue, 13 Jun 2017 13:11:07 +0000 (15:11 +0200)
34 files changed:
server/sonar-web/src/main/js/app/components/ProjectContainer.js
server/sonar-web/src/main/js/apps/account/organizations/CreateOrganizationForm.js
server/sonar-web/src/main/js/apps/background-tasks/components/DateFilter.js
server/sonar-web/src/main/js/apps/issues/components/App.js
server/sonar-web/src/main/js/apps/permissions/project/components/App.js
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddCustomEventForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddEventForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/AddVersionForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeCustomEventForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeEventForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/ChangeVersionForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveAnalysisForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveCustomEventForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveEventForm.js
server/sonar-web/src/main/js/apps/projectActivity/components/forms/RemoveVersionForm.js
server/sonar-web/src/main/js/apps/projects/filters/LanguagesFilter.js
server/sonar-web/src/main/js/apps/projects/filters/SearchableFilterFooter.js
server/sonar-web/src/main/js/apps/projects/filters/TagsFilter.js
server/sonar-web/src/main/js/apps/quality-profiles/components/ProfileContainer.js
server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
server/sonar-web/src/main/js/components/SourceViewer/SourceViewerCode.js
server/sonar-web/src/main/js/components/SourceViewer/components/Line.js
server/sonar-web/src/main/js/components/SourceViewer/components/LineDuplications.js
server/sonar-web/src/main/js/components/issue/IssueView.js
server/sonar-web/src/main/js/components/issue/components/IssueActionsBar.js
server/sonar-web/src/main/js/components/issue/components/IssueAssign.js
server/sonar-web/src/main/js/components/issue/components/IssueChangelog.js
server/sonar-web/src/main/js/components/issue/components/IssueSeverity.js
server/sonar-web/src/main/js/components/issue/components/IssueTags.js
server/sonar-web/src/main/js/components/issue/components/IssueTitleBar.js
server/sonar-web/src/main/js/components/issue/components/IssueTransition.js
server/sonar-web/src/main/js/components/issue/components/IssueType.js
server/sonar-web/src/main/js/components/issue/components/SimilarIssuesFilter.js

index 8df53c24ff356c54e3868cac764dec72fa81ce50..992aa695e7fd2328cb6fd6f51b1d2126ea218fa1 100644 (file)
@@ -30,7 +30,7 @@ import handleRequiredAuthorization from '../utils/handleRequiredAuthorization';
 
 class ProjectContainer extends React.PureComponent {
   props: {
-    addGlobalErrorMessage: () => void,
+    addGlobalErrorMessage: (message: string) => void,
     children?: React.Element<*>,
     location: {
       query: { id: string }
index d5f9835be622a22e1eb2b43c2e5421c31bff6800..180a5dfb65874adfcf203194cc37c8c9780adfb6 100644 (file)
@@ -40,7 +40,7 @@ class CreateOrganizationForm extends React.PureComponent {
   mounted: boolean;
   state: State;
   props: {
-    createOrganization: () => Promise<*>,
+    createOrganization: (fields: {}) => Promise<*>,
     router: { push: string => void }
   };
 
index 1d8111806498d13b66a649c6f8a444e06fb91948..e9d09a92772993e20db933c0ce48bbef7c910391 100644 (file)
@@ -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.
  */
-/* @flow */
+// @flow
 import $ from 'jquery';
 import moment from 'moment';
 import React, { Component } from 'react';
index 000622e20649198e07ed15fc00c11a38aac1ef20..144f2f2b68276712f8bd821742bb1a1ceca1362e 100644 (file)
@@ -63,10 +63,10 @@ import '../styles.css';
 export type Props = {
   component?: Component,
   currentUser: CurrentUser,
-  fetchIssues: () => Promise<*>,
+  fetchIssues: ({}) => Promise<*>,
   location: { pathname: string, query: { [string]: string } },
   onRequestFail: Error => void,
-  router: { push: () => void, replace: () => void }
+  router: { push: ({}) => void, replace: ({}) => void }
 };
 
 export type State = {
index 1d7a82ff6f5634d687d543523648d73c0ebe79a9..aba44835c1f30ca6f0a8cefaacd52aa2c7110062 100644 (file)
@@ -43,7 +43,7 @@ export type Props = {|
     qualifier: string,
     visibility: string
   },
-  onComponentChange: () => void,
+  onComponentChange: (changes: {}) => void,
   onRequestFail: Object => void
 |};
 
index f1972c57bc36e41c23d31dc2c4b4f1d8cfa114cb..fd9ac67fc9492fbd62be616e89a7895ae8d6b78c 100644 (file)
@@ -31,7 +31,7 @@ import './projectActivity.css';
 
 type Props = {
   location: { query: { id: string } },
-  fetchProjectActivity: (project: string) => void,
+  fetchProjectActivity: (project: string, filter: ?string) => void,
   project: { configuration?: { showHistory: boolean } }
 };
 
index 3dcea1662d46ceb9de14bb8570fe27acbc940dcf..9ff07425850b38cd043eee330c40961e74341195 100644 (file)
@@ -25,7 +25,7 @@ import AddEventForm from './AddEventForm';
 import type { Analysis } from '../../../../store/projectActivity/duck';
 
 type Props = {
-  addEvent: () => Promise<*>,
+  addEvent: (analysis: string, name: string, category?: string) => Promise<*>,
   analysis: Analysis
 };
 
index 2d0576c5705323da8ff197783fea9989a4a9caa2..759a60313df10ecbdc02fb066756633608d47b82 100644 (file)
@@ -24,7 +24,7 @@ import type { Analysis } from '../../../../store/projectActivity/duck';
 import { translate } from '../../../../helpers/l10n';
 
 type Props = {
-  addEvent: () => Promise<*>,
+  addEvent: (analysis: string, name: string, category?: string) => Promise<*>,
   analysis: Analysis,
   addEventButtonText: string
 };
index dd1c3e43990f4d1acfdf763bd380eaa44a122541..a415a6ec9e635d4bd3fbcd1c18cfc60456e465b1 100644 (file)
@@ -25,7 +25,7 @@ import AddEventForm from './AddEventForm';
 import type { Analysis } from '../../../../store/projectActivity/duck';
 
 type Props = {
-  addEvent: () => Promise<*>,
+  addEvent: (analysis: string, version: string) => Promise<*>,
   analysis: Analysis
 };
 
index 0d17f70cb2d0baef9a96e5bf09f924d4833a0574..0cbb7d0d6f561c55299690d6df4303a426ece142 100644 (file)
@@ -25,7 +25,7 @@ import { changeEvent } from '../../actions';
 import type { Event } from '../../../../store/projectActivity/duck';
 
 type Props = {
-  changeEvent: () => Promise<*>,
+  changeEvent: (event: string, name: string) => Promise<*>,
   event: Event,
   onClose: () => void
 };
index 3fcdd54cc2a0c3b269439b492382e222059fa647..240ad559c067cac2e0beba97683ae03e52530206 100644 (file)
@@ -24,7 +24,7 @@ import type { Event } from '../../../../store/projectActivity/duck';
 import { translate } from '../../../../helpers/l10n';
 
 type Props = {
-  changeEvent: () => Promise<*>,
+  changeEvent: (event: string, name: string) => Promise<*>,
   changeEventButtonText: string,
   event: Event,
   onClose: () => void
index db2f13ae4e87aa924ad40b57a9ce65decea950cf..8eb2192cafcd58ea89cdb12e3fa339df567c70e8 100644 (file)
@@ -25,7 +25,7 @@ import { changeEvent } from '../../actions';
 import type { Event } from '../../../../store/projectActivity/duck';
 
 type Props = {
-  changeEvent: () => Promise<*>,
+  changeEvent: (event: string, name: string) => Promise<*>,
   event: Event,
   onClose: () => void
 };
index 620d2980691e0b009e9aae53675b9fe9813fe676..ec3676d3ed8fd389bb97244d7b9720dcc87bf596 100644 (file)
@@ -27,7 +27,7 @@ import { deleteAnalysis } from '../../actions';
 
 type Props = {
   analysis: Analysis,
-  deleteAnalysis: () => Promise<*>,
+  deleteAnalysis: (project: string, analysis: string) => Promise<*>,
   project: string
 };
 
index 26d0ccc92342e86c3671dbe283c416de1d2dad44..6223957e45a61baac499975caa5740d8b13905b4 100644 (file)
@@ -27,7 +27,7 @@ import type { Event } from '../../../../store/projectActivity/duck';
 type Props = {
   analysis: string,
   event: Event,
-  deleteEvent: (string, string) => Promise<*>,
+  deleteEvent: (analysis: string, event: string) => Promise<*>,
   onClose: () => void
 };
 
index e251e23f507a1f399d85a9240ad85bfa541051ba..e17ed059e852972053931eec3394dbc5e010e9f2 100644 (file)
@@ -25,7 +25,7 @@ import { translate } from '../../../../helpers/l10n';
 
 type Props = {
   analysis: string,
-  deleteEvent: (string, string) => Promise<*>,
+  deleteEvent: (analysis: string, event: string) => Promise<*>,
   event: Event,
   removeEventButtonText: string,
   removeEventQuestion: string,
index 8f896c89d865b0f8474a9932fa251dec5955f409..3b0459170b83171a19063e07d8b616356d2d64ce 100644 (file)
@@ -27,7 +27,7 @@ import type { Event } from '../../../../store/projectActivity/duck';
 type Props = {
   analysis: string,
   event: Event,
-  deleteEvent: (string, string) => Promise<*>,
+  deleteEvent: (analysis: string, event: string) => Promise<*>,
   onClose: () => void
 };
 
index c266641d6b77621308b5fa73f0be6802b0880e0e..d610b721939e502703a106e60e3f17fe3fb7535c 100644 (file)
@@ -41,11 +41,10 @@ type Props = {
 const LIST_SIZE = 10;
 
 export default class LanguagesFilter extends React.PureComponent {
-  getSearchOptions: () => [{ label: string, value: string }];
   props: Props;
   property = 'languages';
 
-  getSearchOptions(facet: {}, languages: {}) {
+  getSearchOptions(facet?: {}, languages: {}): Array<{ label: string, value: string }> {
     let languageKeys = Object.keys(languages);
     if (facet) {
       languageKeys = difference(languageKeys, Object.keys(facet));
index 0a13f40b228db77eb90b356b3e09bf10e2fb8e15..e5b739e842949d16a2c18b8137e1e347d659fbf6 100644 (file)
@@ -26,7 +26,7 @@ import { translate } from '../../../helpers/l10n';
 type Props = {
   property: string,
   query: {},
-  options: [{ label: string, value: string }],
+  options: Array<{ label: string, value: string }>,
   router: { push: ({ pathname: string, query?: {} }) => void },
   onInputChange?: string => void,
   onOpen?: void => void,
index 28add5b703b1beddcd90a7819867f32bd46b1e62..7fb48d31783dbc9f8348baba75fe9831ac6bb7fe 100644 (file)
@@ -46,7 +46,6 @@ type State = {
 const LIST_SIZE = 10;
 
 export default class TagsFilter extends React.PureComponent {
-  getSearchOptions: () => [{ label: string, value: string }];
   props: Props;
   state: State;
   property: string;
@@ -62,7 +61,7 @@ export default class TagsFilter extends React.PureComponent {
     this.handleSearch = debounce(this.handleSearch.bind(this), 250);
   }
 
-  getSearchOptions(facet: {}, tags: Array<string>) {
+  getSearchOptions(facet?: {}, tags: Array<string>): Array<{ label: string, value: string }> {
     let tagsCopy = [...tags];
     if (facet) {
       tagsCopy = difference(tagsCopy, Object.keys(facet));
index ceda3d91f5fd09a571065271597ec2c3a6a818f0..def400e57fb71f1f3624d282d30bbf627a932652 100644 (file)
@@ -34,7 +34,7 @@ type Props = {
   onRequestFail: Object => void,
   organization: ?string,
   profiles: Array<Profile>,
-  router: { replace: () => void },
+  router: { replace: ({}) => void },
   updateProfiles: () => Promise<*>
 };
 
index 0ffb62eec717a83ee22987f0b734270b97ff84ba..3dab0e0698a3bbf76aa74d8faed91e5d96644f74 100644 (file)
@@ -397,7 +397,7 @@ export default class SourceViewerBase extends React.PureComponent {
     });
   };
 
-  loadDuplications = (line: SourceLine, element: HTMLElement) => {
+  loadDuplications = (line: SourceLine) => {
     getDuplications(this.props.component).then(r => {
       if (this.mounted) {
         this.setState(
@@ -410,7 +410,7 @@ export default class SourceViewerBase extends React.PureComponent {
           () => {
             // immediately show dropdown popup if there is only one duplicated block
             if (r.duplications.length === 1) {
-              this.handleDuplicationClick(0, line.line, element);
+              this.handleDuplicationClick(0, line.line);
             }
           }
         );
index 69af047648cda5a104dca6251b508b1e10cebc79..87605714ffd4f4c2fd1ee0ded069ba4dfaf06aaa 100644 (file)
@@ -51,7 +51,7 @@ export default class SourceViewerCode extends React.PureComponent {
     issues: Array<Issue>,
     issuesByLine: { [number]: Array<Issue> },
     issueLocationsByLine: { [number]: Array<LinearIssueLocation> },
-    loadDuplications: (SourceLine, HTMLElement) => void,
+    loadDuplications: SourceLine => void,
     loadSourcesAfter: () => void,
     loadSourcesBefore: () => void,
     loadingSourcesAfter: boolean,
index dc4a26c300b2a3f2987a0ce9ba8a6e62467d48b7..7d44d23183ff1a3e2d5d55399a2be7682f0c1321 100644 (file)
@@ -48,7 +48,7 @@ type Props = {|
   issues: Array<Issue>,
   last: boolean,
   line: SourceLine,
-  loadDuplications: (SourceLine, HTMLElement) => void,
+  loadDuplications: SourceLine => void,
   onClick: (SourceLine, HTMLElement) => void,
   onCoverageClick: (SourceLine, HTMLElement) => void,
   onDuplicationClick: (number, number) => void,
index 85cc046b1c843b2b05886501e2e02018601f94c8..d1f802c6337bc8d952ee14f169397466636b07a0 100644 (file)
@@ -26,7 +26,7 @@ import type { SourceLine } from '../types';
 
 type Props = {
   line: SourceLine,
-  onClick: (SourceLine, HTMLElement) => void
+  onClick: SourceLine => void
 };
 
 export default class LineDuplications extends React.PureComponent {
@@ -34,7 +34,7 @@ export default class LineDuplications extends React.PureComponent {
 
   handleClick = (e: SyntheticInputEvent) => {
     e.preventDefault();
-    this.props.onClick(this.props.line, e.target);
+    this.props.onClick(this.props.line);
   };
 
   render() {
index 22770e294ff9a620595e9968c633ac7d8c9d3728..a22fdfc432ac902aca30e19674853846c0ef3d41 100644 (file)
@@ -38,7 +38,7 @@ type Props = {|
   onFail: Error => void,
   onFilter?: (property: string, issue: Issue) => void,
   selected: boolean,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 |};
 
 export default class IssueView extends React.PureComponent {
index b8ae17ec46fe87e5a4c118c0d464510c927f80e7..87464c953a78089899c481cce59edc66230a43e4 100644 (file)
@@ -35,7 +35,7 @@ type Props = {
   onAssign: string => void,
   onChange: Issue => void,
   onFail: Error => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 };
 
 type State = {
index b8b6aaa77fe17a4c8b91a6ccb8fface0f4808327..a3e2e5e8203cd8cb881d5aa4a997dcdfb3932693 100644 (file)
@@ -31,7 +31,7 @@ type Props = {
   canAssign: boolean,
   onAssign: string => void,
   onFail: Error => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 };
 
 export default class IssueAssign extends React.PureComponent {
index c1e77f718013948e7ad17cd2d43fedf9d7f31619..d3a91a9dc184abf3d48ca55adf1e7e2ae5630bdd 100644 (file)
@@ -28,7 +28,7 @@ type Props = {
   isOpen: boolean,
   issue: Issue,
   creationDate: string,
-  togglePopup: string => void,
+  togglePopup: (string, boolean | void) => void,
   onFail: Error => void
 };
 
index f4e46db81e38e891ae141fce57ca13388d3455f5..d91fa74625d4331a783e6b0f6b21425e89e27d3a 100644 (file)
@@ -30,7 +30,7 @@ type Props = {
   isOpen: boolean,
   issue: Issue,
   setIssueProperty: (string, string, apiCall: (Object) => Promise<*>, string) => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 };
 
 export default class IssueSeverity extends React.PureComponent {
index 6cc03db8a44f9a5fba45d38959e90b20501178bc..8974ced8031a922ee6b4c9b9742d3db85df29df8 100644 (file)
@@ -33,7 +33,7 @@ type Props = {|
   issue: Issue,
   onChange: Issue => void,
   onFail: Error => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 |};
 
 export default class IssueTags extends React.PureComponent {
index 6e0fe943f07cb0a4e5f66bde7d805d5fb2183dd3..507328bcb2c4d6e330ecd622a9ff4ca56addf536 100644 (file)
@@ -35,7 +35,7 @@ type Props = {|
   currentPopup: string,
   onFail: Error => void,
   onFilter?: (property: string, issue: Issue) => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 |};
 
 const stopPropagation = (event: Event) => event.stopPropagation();
index 3e2cf50517fd2bf105140885787b6914be00b1aa..5b51aab61025a371138e6edded51775f23eb1004 100644 (file)
@@ -32,7 +32,7 @@ type Props = {
   issue: Issue,
   onChange: Issue => void,
   onFail: Error => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 };
 
 export default class IssueTransition extends React.PureComponent {
index 952d481c1b1b1b9fba9afd0ae2c33f4c775a5984..7281352fab4a89ed969cfc324cf49888db47caa1 100644 (file)
@@ -31,7 +31,7 @@ type Props = {
   isOpen: boolean,
   issue: Issue,
   setIssueProperty: (string, string, apiCall: (Object) => Promise<*>, string) => void,
-  togglePopup: string => void
+  togglePopup: (string, boolean | void) => void
 };
 
 export default class IssueType extends React.PureComponent {
index bf80c55510162f407b64fa3446f4aac5af1f164a..d49abfa89390fabcb992c4fe79dbb6cef6230f26 100644 (file)
@@ -27,7 +27,7 @@ import type { Issue } from '../types';
 type Props = {|
   isOpen: boolean,
   issue: Issue,
-  togglePopup: string => void,
+  togglePopup: (string, boolean | void) => void,
   onFail: Error => void,
   onFilter: (property: string, issue: Issue) => void
 |};