Skip to content

Commit

Permalink
Ajout de l'option "allowJs" dans tsconfig.js
Browse files Browse the repository at this point in the history
Cela permet l'inférence de type à partir des fichiers js qui ne sont pas
encore convertis en TypeScript.
Par ailleurs suppression des dernières traces de Flow.
Ajout d'options plus strictes pour dans la config tsconfig.js
  • Loading branch information
mquandalle committed Dec 17, 2019
1 parent 34085d3 commit 1b963b8
Show file tree
Hide file tree
Showing 35 changed files with 539 additions and 610 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ env:
settings:
react:
version: 'detect'
flowVersion: '0.92'

overrides:
- files: ['*.test.js', 'cypress/integration/**/*.js']
Expand All @@ -39,7 +38,6 @@ extends:
- eslint:recommended
- plugin:react/recommended
- prettier
- prettier/flowtype
- prettier/react
parserOptions:
ecmaFeatures:
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ dist/
.DS_Store
package-lock.json
yarn-error.log
flow-typed/
cypress/videos
cypress/screenshots
3 changes: 1 addition & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ module.exports = {
}
],
'@babel/react',
'@babel/preset-typescript',
'@babel/flow'
'@babel/preset-typescript'
],
plugins: [
'@babel/plugin-proposal-class-properties',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/preset-env": "^7.6.3",
"@babel/preset-flow": "^7.0.0-beta.51",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.6.0",
"@types/classnames": "^2.2.9",
Expand All @@ -113,6 +112,7 @@
"@types/react-color": "^3.0.1",
"@types/react-dom": "^16.9.3",
"@types/react-helmet": "^5.0.13",
"@types/react-highlight-words": "^0.16.0",
"@types/react-redux": "^7.1.5",
"@types/react-router": "^5.1.2",
"@types/react-router-dom": "^5.1.0",
Expand Down
6 changes: 3 additions & 3 deletions source/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type Action =
| UpdateDefaultUnit
| SetActiveTargetAction

type ThunkResult<R> = ThunkAction<
export type ThunkResult<R> = ThunkAction<
R,
RootState,
{ history: History; sitePaths: SitePaths },
Expand Down Expand Up @@ -74,7 +74,7 @@ export const goToQuestion = (question: string) =>

export const validateStepWithValue = (
dottedName: DottedName,
value: any
value: unknown
): ThunkResult<void> => dispatch => {
dispatch(updateSituation(dottedName, value))
dispatch({
Expand Down Expand Up @@ -119,7 +119,7 @@ export const deletePreviousSimulation = (): ThunkResult<void> => dispatch => {
deletePersistedSimulation()
}

export const updateSituation = (fieldName: DottedName, value: any) =>
export const updateSituation = (fieldName: DottedName, value: unknown) =>
({
type: 'UPDATE_SITUATION',
fieldName,
Expand Down
88 changes: 0 additions & 88 deletions source/actions/companyStatusActions.js

This file was deleted.

81 changes: 81 additions & 0 deletions source/actions/companyStatusActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { dropWhile } from 'ramda'
import { nextQuestionUrlSelector } from 'Selectors/companyStatusSelectors'

const thenGoToNextQuestion = actionCreator => (...args: unknown[]) => (
dispatch,
getState,
{ history, sitePaths }
) => {
dispatch(actionCreator(...args))
history.push(nextQuestionUrlSelector(getState(), { sitePaths }))
}

export const isSoleProprietorship = thenGoToNextQuestion(
(isSoleProprietorship?: boolean) =>
({
type: 'COMPANY_IS_SOLE_PROPRIETORSHIP',
isSoleProprietorship
} as const)
)

type DirectorStatus = 'SALARIED' | 'SELF_EMPLOYED'

export const defineDirectorStatus = thenGoToNextQuestion(
(status: DirectorStatus) =>
({
type: 'DEFINE_DIRECTOR_STATUS',
status
} as const)
)

export const companyHasMultipleAssociates = thenGoToNextQuestion(
(multipleAssociates?: boolean) =>
({
type: 'COMPANY_HAS_MULTIPLE_ASSOCIATES',
multipleAssociates
} as const)
)

export const isAutoentrepreneur = thenGoToNextQuestion(
(autoEntrepreneur?: boolean) =>
({
type: 'COMPANY_IS_MICROENTERPRISE',
autoEntrepreneur
} as const)
)

export const directorIsInAMinority = thenGoToNextQuestion(
(minorityDirector?: boolean) =>
({
type: 'SPECIFY_DIRECTORS_SHARE',
minorityDirector
} as const)
)

export const goToCompanyStatusChoice = () => (
dispatch,
_,
{ history, sitePaths }
) => {
dispatch({
type: 'RESET_COMPANY_STATUS_CHOICE'
} as const)
history.push(sitePaths.créer.index)
}

export const resetCompanyStatusChoice = (from: string) => (
dispatch,
getState
) => {
const answeredQuestion = Object.keys(
getState().inFranceApp.companyLegalStatus
)
const answersToReset = dropWhile(a => a !== from, answeredQuestion)
if (!answersToReset.length) {
return
}
dispatch({
type: 'RESET_COMPANY_STATUS_CHOICE',
answersToReset
})
}
138 changes: 0 additions & 138 deletions source/components/PaySlip.js

This file was deleted.

Loading

0 comments on commit 1b963b8

Please sign in to comment.