MohGovIL / hamagen-react-native

Israel's Ministry of Health's COVID-19 Exposure Prevention App
https://health.gov.il/
MIT License
509 stars 153 forks source link

Remove unused dependencies in package.json #241

Open emanuelb opened 4 years ago

emanuelb commented 4 years ago

The package.json file contain unused dependencies.

Running depcheck (tool to detect unused dependencies) via npx depcheck return: (beware it contain false-positives, recompile after removing deps to ensure it's working the same/same-result-binary, etc..) for example metro-react-native-babel-preset is required to compile the app, opened issue about it upstream https://github.com/depcheck/depcheck/issues/574 If other entries in this log are false-positives, report them upsteam.

on master result:

Unused dependencies
* @react-native-community/cli
* @react-native-community/masked-view
* @react-navigation/bottom-tabs
* @react-navigation/routers
* events
* logkitty
* lottie-ios
* moment-timezone
* random-location
* react-native-reanimated
* react-native-safe-area-context
* react-native-uuid-generator
* rn-fetch-blob
* seedrandom
* sha256
Unused devDependencies
* @babel/core
* @babel/runtime
* @react-native-community/eslint-config
* @types/jest
* @types/react-native-sqlite-storage
* @types/react-native-uuid-generator
* @types/react-test-renderer
* @types/seedrandom
* @typescript-eslint/eslint-plugin
* @typescript-eslint/parser
* babel-jest
* cross-fetch
* eslint
* eslint-import-resolver-reactnative
* eslint-plugin-import
* eslint-plugin-jsx-a11y
* eslint-plugin-react
* jest
* metro-react-native-babel-preset
* mock-async-storage
* react-test-renderer
* typescript

on feature/dev-v2.2 branch:

Unused dependencies
* @react-native-community/cli
* @react-native-community/masked-view
* @react-navigation/bottom-tabs
* @react-navigation/routers
* events
* logkitty
* lottie-ios
* moment-timezone
* random-location
* react-native-reanimated
* react-native-safe-area-context
* react-native-uuid-generator
* rn-fetch-blob
* seedrandom
* sha256
Unused devDependencies
* @babel/core
* @babel/runtime
* @react-native-community/eslint-config
* @types/jest
* @types/react-native-sqlite-storage
* @types/react-native-uuid-generator
* @types/react-test-renderer
* @types/seedrandom
* @typescript-eslint/eslint-plugin
* @typescript-eslint/parser
* babel-jest
* cross-fetch
* eslint
* eslint-import-resolver-reactnative
* eslint-plugin-import
* eslint-plugin-jsx-a11y
* eslint-plugin-react
* jest
* metro-react-native-babel-preset
* mock-async-storage
* react-test-renderer
* typescript
kaplanlior commented 4 years ago

Aren't the other babel dependencies required per #254 ?

emanuelb commented 4 years ago

Aren't the other babel dependencies required per #254 ?

Only @babel/core & @babel/runtime, opened issue upstream: https://github.com/depcheck/depcheck/issues/575 metro-react-native-babel-preset issue upstream: https://github.com/depcheck/depcheck/issues/574 babel-jest is not required (maybe only if calling yarn jest / npm test that are used for testing)

What need to be done is start removing dependencies and then compiling both ios & apk and see if the resulting files are changed, there sure are not needed deps like seedrandom & sha256 (which is also deprecated package, see #151) that need to removed, the tool depcheck just helping to detect thus unused packages (with some false-positives that better be reported upstream)

emanuelb commented 4 years ago

Example of probably correct result: The @react-native-community/cli in package.json is old: (2.9.0 is released in August 15, 2019) https://github.com/MohGovIL/hamagen-react-native/blob/40d0de490d47d53d2a005a57270b98a4176745f5/package.json#L16 and is not needed to be installed directly, as it's already installed by react-native package (which will install newer version of @react-native-community/cli) and the compiling of android app will use the version under react-native package.