💚 Fix les derniers warnings de flow

pull/439/head
Johan Girod 2019-02-03 18:05:55 +01:00
parent 4a5b8c158a
commit d7d5833a54
11 changed files with 67 additions and 51 deletions

View File

@ -23,6 +23,10 @@ env:
browser: true
commonjs: true
es6: true
settings:
react:
version: detect
flowVersion: detect
overrides:
files: ['*.test.js', 'cypress/integration/**/*.js']

View File

@ -3,7 +3,7 @@
import withTracker from 'Components/utils/withTracker'
import React, { Component } from 'react'
import { Trans, withNamespaces } from 'react-i18next'
import { withRouter } from 'react-router-dom'
import { withRouter } from 'react-router'
import { compose } from 'redux'
import safeLocalStorage from '../../storage/safeLocalStorage'
import './Feedback.css'
@ -12,13 +12,16 @@ import type { Tracker } from 'Components/utils/withTracker'
import type { Location } from 'react-router-dom'
import type { Node } from 'react'
type Props = {
location: Location,
type OwnProps = {
blacklist: Array<string>,
customMessage?: Node,
tracker: Tracker,
customEventName?: string
}
type Props = OwnProps & {
location: Location,
tracker: Tracker,
}
type State = {
showForm: boolean,
showThanks: boolean
@ -150,9 +153,8 @@ class PageFeedback extends Component<Props, State> {
const PageFeedbackWithRouter = ({ location, ...props }) => (
<PageFeedback {...props} location={location} key={location.pathname} />
)
export default compose(
export default (compose(
withRouter,
withNamespaces(),
withTracker,
withRouter
)(PageFeedbackWithRouter)
)(PageFeedbackWithRouter): React$ComponentType<OwnProps>)

View File

@ -10,11 +10,13 @@ import { animated, Spring } from 'react-spring';
import { validInputEnteredSelector } from 'Selectors/analyseSelectors';
import type { Location } from 'react-router'
type Props = {
type OwnProps = {
quickLinks: {[string]: string},
}
type Props = OwnProps & {
startConversation: (?string) => void,
location: Location,
validInputEntered: boolean,
quickLinks: {[string]: string},
conversationStarted: boolean
}
@ -59,7 +61,7 @@ const QuickLinks = ({
)
}
export default compose(
export default (compose(
withLanguage,
withRouter,
connect(
@ -73,4 +75,4 @@ export default compose(
startConversation
}
)
)(QuickLinks)
)(QuickLinks): React$ComponentType<OwnProps>)

View File

@ -195,6 +195,7 @@ function analysisToFicheDePaie(
),
salaireNet: règleAvecMontant('contrat salarié . salaire . net'),
nombreHeuresTravaillées: Math.round(
// $FlowFixMe
règleAvecValeur('contrat salarié . temps partiel . heures par semaine')
.valeur * 4.33
),
@ -204,7 +205,7 @@ function analysisToFicheDePaie(
)
}
}
// $FlowFixMe
export default createSelector(
[
règleAvecMontantSelector,

View File

@ -7,8 +7,6 @@ import urssafSvg from 'Images/urssaf.svg'
import { compose } from 'ramda'
import React from 'react'
import Helmet from 'react-helmet'
import { Trans, withNamespaces } from 'react-i18next'
import { withRouter } from 'react-router'
import i18n from '../../../../i18n'
import { feedbackBlacklist } from '../../config'
import { hrefLangLink } from '../../sitePaths'
@ -87,7 +85,5 @@ const Footer = ({ colours: { colour } }) => {
)
}
export default compose(
withRouter,
withColours,
withNamespaces()
)(Footer)

View File

@ -4,17 +4,19 @@ import classnames from 'classnames'
import withTracker from 'Components/utils/withTracker'
import { compose } from 'ramda'
import React, { Component } from 'react'
import { NavLink, withRouter } from 'react-router-dom'
import { withRouter } from "react-router";
import { NavLink } from 'react-router-dom'
import type { Tracker } from 'Components/utils/withTracker'
import type { Location } from 'react-router-dom'
import type { ChildrenArray, Node, Element } from 'react'
type Props = {
// to: string,
type OwnProps = {
children: ChildrenArray<Element<any>>,
title: Node,
location: Location,
to?: ?string,
title: Node,
}
type Props = OwnProps & {
location: Location,
tracker: Tracker
}
type State = {
@ -116,7 +118,7 @@ class NavOpener extends Component<Props, State> {
}
}
export default compose(
export default (compose(
withTracker,
withRouter
)(NavOpener)
)(NavOpener): React$ComponentType<OwnProps>)

View File

@ -4,7 +4,8 @@ import withSitePaths from 'Components/utils/withSitePaths';
import { compose } from 'ramda';
import { withNamespaces } from 'react-i18next';
import { connect } from 'react-redux';
import { NavLink, withRouter } from 'react-router-dom';
import { NavLink, } from 'react-router-dom';
import { withRouter } from "react-router";
import companySvg from '../../images/company.svg';
import estimateSvg from '../../images/estimate.svg';
import hiringSvg from '../../images/hiring.svg';
@ -14,7 +15,8 @@ import SideBar from './SideBar';
import type { TFunction } from 'react-i18next'
type Props = {
type OwnProps = {};
type Props = OwnProps & {
companyProgress: number,
estimationProgress: number,
sitePaths: Object,
@ -257,7 +259,7 @@ const StepsHeader = ({ t, sitePaths, companyStatusChoice }: Props) => (
</SideBar>
)
export default compose(
export default (compose(
withRouter,
withNamespaces(),
withSitePaths,
@ -267,4 +269,4 @@ export default compose(
}),
{}
)
)(StepsHeader)
)(StepsHeader): React$ComponentType<OwnProps>)

View File

@ -9,21 +9,21 @@ import React from 'react'
import { withRouter } from 'react-router'
import './SideBar.css'
import type { Tracker } from 'Components/utils/withTracker'
import type { Node } from 'react'
import type { Location } from 'react-router-dom'
type OwnProps = {|
children: React$Node
|}
type Props = OwnProps & {
tracker: Tracker,
location: Location,
}
type State = {
opened: boolean,
sticky: boolean
}
type Props = {
tracker: Tracker,
location: Location,
/* ownProps */
children: Node
}
const bigScreen = window.matchMedia('(min-width: 1500px)')
const isParent = (parentNode, children) => {
if (children === parentNode) {
@ -95,7 +95,7 @@ class SideBar extends React.Component<Props, State> {
}
}
export default compose(
export default (compose(
withTracker,
withRouter,
withTracker
)(SideBar)
)(SideBar): React$ComponentType<OwnProps>)

View File

@ -6,7 +6,8 @@ import withTracker from 'Components/utils/withTracker'
import { compose } from 'ramda'
import { withNamespaces } from 'react-i18next'
import { connect } from 'react-redux'
import { NavLink, withRouter } from 'react-router-dom'
import { NavLink } from 'react-router-dom'
import { withRouter } from "react-router";
import selectors from 'Selectors/progressSelectors'
import companySvg from '../../images/company.svg'
import estimateSvg from '../../images/estimate.svg'
@ -24,8 +25,10 @@ const Progress = ({ percent }) => (
}}
/>
</div>
)
type Props = {
type OwnProps = {}
type Props = OwnProps & {
companyProgress: number,
estimationProgress: number,
hiringProgress: number,
@ -83,13 +86,13 @@ const StepsHeader = ({
</header>
)
export default compose(
withRouter,
export default (compose(
withTracker,
connect(
selectors,
{}
),
),
withRouter,
withNamespaces(),
withSitePaths
)(StepsHeader)
)(StepsHeader): React$ComponentType<OwnProps>)

View File

@ -11,6 +11,8 @@ import { Link } from 'react-router-dom'
import ReactSelect from 'react-select'
// $FlowFixMe
import 'react-select/dist/react-select.css'
import type { SitePaths } from 'Components/utils/withSitePaths'
import type { TFunction } from 'react-i18next'
import './Find.css'
import { CompanyDetails as Company } from './YourCompany'
import type { RouterHistory } from 'react-router'
@ -22,10 +24,11 @@ const goToNextStep = (history: RouterHistory, sitePaths: Object) => {
type State = {
input: ?{ [string]: string }
}
type OwnProps = {}
type Props = {
//onCompanyDetailsConfirmation: ({ [string]: string }) => void,
history: RouterHistory
history: RouterHistory,
t: TFunction,
sitePaths: SitePaths,
}
class Search extends React.Component<Props, State> {
@ -111,9 +114,9 @@ class Search extends React.Component<Props, State> {
}
}
export default compose(
withRouter,
export default (compose(
withSitePaths,
withRouter,
connect(
null,
{
@ -121,4 +124,4 @@ export default compose(
}
),
withNamespaces()
)(Search)
)(Search): React$ComponentType<OwnProps>)

View File

@ -27,6 +27,7 @@ let paySlip = null
describe('pay slip selector', function() {
beforeEach(() => {
// $FlowFixMe
paySlip = FicheDePaieSelectors(state)
expect(paySlip).not.to.eq(null)