You should not ignore package.json, it is a key file shared between all the developers defining package dependencies. You should ignore build artefacts and installed dependencies and user specific configuration files such as IDE configuration, that is specific to a single user. Note that some IDE config files you don't want to ignore such as build configurations because they're the same for the whole team.
Wow! Thank you so much for your valuable comments everyone. But, in my defense I want to make it clear why I talked about deleting package.json and Gemfile.lock files.
Thank you all again for pointing out the importance of package.json, package-lock.josn, Gemfile and Gemfile.lock files being in the repo 🙂
This is true.
package.json should exist in case one of your dependencies in package-lock.json is platform specific and package.json is used for finding a compatible version.
True. Also Gemfile and Gemfile.lock should be included for the same reason.
It's worth mentioning that both package.json and package-lock.json should be included in the repo. The first allows to install dependencies fresh, and the second one is necessary for the npm ci command, indispensable for any continuous integration setup. I've seen people who kept package.json but ignored the lockfile, and it did cause me problems a few times...
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.