-
Notifications
You must be signed in to change notification settings - Fork 932
Description
Description
One of the things that frustrates me the most about working with a monorepo is how easy I can mess up dependencies. Sometimes I forget to add them to package.json, another I forget to delete them, and because everything is hoisted things magically work until they don't (which in my case was usually production 😓).
On webhint we ended up creating a dependency linting script to catch those issues sooner rather than later. It still has a few false positives but it has served us well. Basically it looks at the package.json and the source code for all require and import and tries to see if those dependencies exist in both places.
I've run it through this repo and there are a few things that seemed out of place. This is the output after removing some clear false positives:
Processing "/home/molant/projects/react-native/cli/packages/cli"
"plist" is not necessary in /home/molant/projects/react-native/cli/packages/cli/package.json
Processing "/home/molant/projects/react-native/cli/packages/cli-types"
Processing "/home/molant/projects/react-native/cli/packages/debugger-ui"
Processing "/home/molant/projects/react-native/cli/packages/global-cli"
Processing "/home/molant/projects/react-native/cli/packages/platform-android"
glob missing in /home/molant/projects/react-native/cli/packages/platform-android/src/config/findManifest.ts
glob missing in /home/molant/projects/react-native/cli/packages/platform-android/src/config/findPackageClassName.ts
fs-extra missing in /home/molant/projects/react-native/cli/packages/platform-android/src/link/copyAssets.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-android/src/link/unregisterNativeModule.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-android/src/link/patches/applyParams.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-android/src/link/patches/makeStringsPatch.ts
Processing "/home/molant/projects/react-native/cli/packages/platform-ios"
glob missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/config/findPodspec.ts
glob missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/config/findProject.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/config/index.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/getHeaderSearchPath.ts
glob missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/getHeadersInFolder.ts
plist missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/getPlist.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/registerNativeModule.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/unlinkAssets.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/unregisterNativeModule.ts
plist missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/writePlist.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/__tests__/addFileToProject.test.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/__tests__/addProjectToLibraries.test.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/__tests__/createGroup.test.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/__tests__/removeProjectFromLibraries.test.ts
lodash missing in /home/molant/projects/react-native/cli/packages/platform-ios/src/link/common/unregisterNativeModule.ts
Processing "/home/molant/projects/react-native/cli/packages/tools"
Issues with depedendencies found. Please check output above.
I'm still familiarizing with the whole project but it looks like a few package.json are missing direct dependencies and are using them from another package or dependency (lodash, glob, plist, fs-extra).
Also I think all dependencies in the main package.json should be devDependencies, but just more of a personal thing (although there are also devDependencies in there so it would probably be a good idea to use one or the other).
More than happy to work on this, just wanted to bring it to your attention before submitting a PR in case you see something that's not accurate!