Programming Rant — index.js

Mar 20 · 1 min read

I hate index.js

Sitting innocuously at the root of the src folder. At the root of a node server. Or in a component library. <Inject more examples here>

In the world of well formed files with pedigreed names (generic, specific, domain-based) its insulting presence makes me snap the keyboard into two.

Should I try to guess the intent of the author (deliberately diabolical to innocent ignorance) who decided on such a common term? What is an efficient way to search for the file hiding in a plethora of “index.js”s while debugging? How about refactoring the code involving a simple file name change?

I have henceforth banned the humble index.js from all repos that I lord over. Any and every index.js “required” by systems to operate shall be created by my minions during the build process.

Delete the index.js > Find eternal peace.