kobotoolbox / kpi

kpi is the server for KoboToolbox. It includes an API for users to access data and manage their forms, question library, sharing settings, create reports, and export data.
https://www.kobotoolbox.org
GNU Affero General Public License v3.0
133 stars 181 forks source link

Migrate most commonly imported files to TypeScript #3482

Closed magicznyleszek closed 2 years ago

magicznyleszek commented 3 years ago

Description

It's a Nice to Have™ #3397 followup task. We want to migrate to TypeScript the most common files we have - for now we do it one by one whenever we encounter non-TS import we need for TS file. It would be better to just migrate these up front. By migrate I mean either make sure the package types are installed or the file is renamed to ts/tsx and types for it added. Please do these:

Please make one PR per one "transcriptized" file :pray:

Additional details

This is (most probably outdated as you read it) the list of files we have on frontend ordered by their import frequency:

 120 react
 101 js/bem
  97 react-autobind
  89 js/constants
  69 reflux
  64 js/actions
  64 utils
  50 react-mixin
  50 js/stores
  34 js/mixins
  34 js/assetUtils
  31 js/components/common/loadingSpinner
  28 alertifyjs
  27 react-router
  25 js/dataInterface
  23 prop-types
  18 js/router/routerConstants
  16 js/envStore
  16 js/components/common/checkbox
  15 underscore
  15 react-select
  14 react-document-title
  14 js/components/common/textBox
  12 js/assetStore
  10 react-dom
  10 js/router/routerUtils
  10 js/components/permissions/permConfig
   9 js/popoverMenu
   9 js/components/library/libraryConstants
   7 lodash.clonedeep
   7 js/searches
   7 js/components/common/modal
   6 react-dropzone
   6 js/components/projectDownloads/exportsStore
   6 js/components/projectDownloads/exportsConstants
   6 classnames
   5 react-autosize-textarea
   5 js/components/submissions/tableConstants
   5 js/components/locking/lockingUtils
   5 js/components/library/myLibraryStore
   4 reportsConstants
   4 js/components/locking/lockingConstants
   4 js/components/common/toggleSwitch
   4 js/components/common/assetName
   4 js/components/common/accessDeniedMessage
   3 react-cookie
   3 moment
   3 js/components/submissions/tableStore
   3 js/components/projectDownloads/exportTypeSelector
   3 js/components/modalForms/projectSettings
   3 js/components/formBuilder/formBuilderUtils
   3 js/components/common/radio
   3 js/components/common/multiCheckbox
   3 js/components/common/koboTagsInput
   3 header/searchBoxStore
   3 ./permParser
   3 ./assetsTable
   3 ./assetParserUtils
   2 react-tagsinput
   2 react-table
   2 js/enketoHandler
   2 js/components/submissions/tableUtils
   2 js/components/submissions/submissionUtils
   2 js/components/projectDownloads/exportsUtils
   2 js/components/modalForms/languageForm
   2 js/components/list
   2 js/components/library/ownedCollectionsStore
   2 js/components/dataAttachments/dataAttachmentsUtils
   2 js/components/common/koboDropdown
   2 immutable
   2 fuse.js
   2 chart.js
   2 ./userAssetPermsEditor
   2 ./publicCollectionsStore
   2 ./permConstants
   2 ./modalHelpers
   2 ./lockingConstants
   2 ./chartTypePicker
   2 ./chartColorsPicker
   2 ./assetActionButtons
   2 ../../xlform/src/_xlform.init
   2 ../../../xlform/src/model.utils
   1 zxcvbn
   1 spark-md5
   1 react-hot-loader
   1 react-debounce-input
   1 react-copy-to-clipboard
   1 object-assign
   1 lodash
   1 leaflet/dist/leaflet
   1 jszip
   1 js/surveyCompanionStor
   1 js/router/allRoutes
   1 js/lists/forms
   1 js/libs/reflux-promise
   1 js/libs/reactBemComponents
   1 js/components/templatesList
   1 js/components/tagInput
   1 js/components/submissions/validationStatusDropdown
   1 js/components/submissions/tableSettings
   1 js/components/submissions/tableMediaPreview
   1 js/components/submissions/tableColumnSortDropdown
   1 js/components/submissions/tableBulkOptions
   1 js/components/submissions/tableBulkCheckbox
   1 js/components/submissions/table
   1 js/components/submissions/submissionModal
   1 js/components/submissions/submissionDataTable
   1 js/components/submissions/columnsHideForm
   1 js/components/submissions/columnsHideDropdown
   1 js/components/sectionNotFound
   1 js/components/reports/reports
   1 js/components/projectDownloads/projectExportsList
   1 js/components/projectDownloads/projectExportsCreator
   1 js/components/projectDownloads/projectDownloads
   1 js/components/projectDownloads/legacyExports
   1 js/components/projectDownloads/anonymousExports
   1 js/components/permissions/sharingForm
   1 js/components/permissions/permValidator
   1 js/components/passwordStrength
   1 js/components/modalForms/translationTable
   1 js/components/modalForms/translationSettings
   1 js/components/modalForms/libraryUploadForm
   1 js/components/modalForms/libraryNewItemForm
   1 js/components/modalForms/libraryAssetForm
   1 js/components/modalForms/encryptForm
   1 js/components/modalForms/bulkEditSubmissionsForm
   1 js/components/modalForms/assetTagsForm
   1 js/components/metadataEditor
   1 js/components/locking/formLockedMessage
   1 js/components/library/publicCollectionsRoute
   1 js/components/library/myLibraryRoute
   1 js/components/library/librarySidebar
   1 js/components/library/assetRoute
   1 js/components/intercomHandler
   1 js/components/helpBubbles
   1 js/components/header/searchBox
   1 js/components/header/headerTitleEditor
   1 js/components/header
   1 js/components/formXform
   1 js/components/formViewTabs
   1 js/components/formSummary
   1 js/components/formSubScreens
   1 js/components/formNotFound
   1 js/components/formLanding
   1 js/components/formJson
   1 js/components/formEditors
   1 js/components/drawer
   1 js/components/dataAttachments/dataAttachmentColumnsForm
   1 js/components/dataAttachments/connectProjects
   1 js/components/common/koboDropdownActions
   1 js/components/common/audioPlayer
   1 js/components/changePassword
   1 js/components/bigModal/bigModal
   1 js/components/accountSettings
   1 js/components/RESTServices/RESTServicesForm
   1 js/bemComponents
   1 js/assetUtils.mocks
   1 js/app
   1 ./userPermissionRow
   1 ./submissionUtils.mocks
   1 ./submissionUtils
   1 ./singleCollectionStore
   1 ./reportViewItem
   1 ./reportTable
   1 ./reportStyleSettings
   1 ./reportContents
   1 ./registrationPasswordApp
   1 ./questionGraphSettings
   1 ./publicShareSettings
   1 ./permissionsMocks
   1 ./permissions/sharingForm
   1 ./ownedCollectionsStore
   1 ./modalForms/formMedia
   1 ./mediaCell
   1 ./mapSettings
   1 ./map
   1 ./lockingUtils.mocks
   1 ./lockingUtils
   1 ./libs/reflux-promise
   1 ./koboDropdownActions
   1 ./intercomHandler
   1 ./formViewTabs
   1 ./exportsConstants
   1 ./customReportForm
   1 ./copyTeamPermissions
   1 ./containers/KoboMatrix
   1 ./components/passwordStrength
   1 ./collectionAssetsTable
   1 ./cascadeMixin
   1 ./assetsTableRow
   1 ./assetrow
   1 ./assetPublicButton
   1 ./assetNavigator
   1 ./assetInfoBox
   1 ./assetContentSummary
   1 ./assetBreadcrumbs
   1 ./apiTokenDisplay
   1 ./actions/submissions
   1 ./actions/permissions
   1 ./actions/mediaActions
   1 ./actions/library
   1 ./actions/help
   1 ./actions/exportsActions
   1 ./actions/dataShareActions
   1 ./RESTServices/RESTServicesList
   1 ./RESTServices/RESTServiceLogs
   1 ./RESTServices
   1 ../xlform/src/_xlform.init
   1 ../models/surveyScope
   1 ../lists/sidebarForms
   1 ../editorMixins/editableForm
   1 ../components/searchcollectionlist
magicznyleszek commented 2 years ago

Both js/actions and js/stores need to be split to smaller files besides just moving to typescript, so I think we don't need to wait for them here. Almost everything else is already done 🎆