I've ton of files that go into root folder and i'm looking to clean it up.
for example
.env
.babelrc
.eslintignore
.eslintrc.json
webpack.config.js
gulpfile.js
sequelize.json
... list goes on
I want to move all of them in config folder, because that what they are.
So is it possible to have gitignore applied from sub-directory to parent.
It seems like every tool wants to jam its config file into root directory
aws, gulp, webpack, vscode, database, react, linting...
It may be technically possible or not (probably not in a robust way), but regardless, my answer is
The root directory is really the right place for this stuff, for several reasons:
You know, you just don't want people (especially yourself) to spend three hours on debugging some issue, only to discover that it was caused by well hidden config file, and that's the result I would expect.
Hiding the configuration goes directly against the principle of least surprise, and this is a bad idea.
If your files get lost between the configuration files, then you are solving the wrong problem. You should just put your stuff in subdirectories, like src
, docs
, test
or wherever makes sense for your case. That's the standard way and that's what people do (at least in JavaScript world, which is apparently your case, but it's really the same with any other language). Directly in the root directory live only configs, readme, and licence.
package.json
insteadOn the flip side, for the specific tools you mention the config can be generally contained in package file (package.json
). So if the proliferation of files itches you as such, a simple solution is to move all possible configs there. The file will grow huge (it does anyway), but it may still be preferable to multiple files.