Member-only story

How many lines should be in a perfect JavaScript module

GitHub API to explore source code of outstanding JavaScript projects.

Marian C.
2 min readOct 19, 2021

In a previous post I wanted to learn the reasonable limits for a folder hierarchy depth. Assuming that the code of prominent projects is a better source of information than symmetric opinions posted to the Internet, I used GitHub API to explore the eleven most useful Node.js-based command line tools. Most of the projects are quite shallow. I guess it is a legacy of previous versions of Node.js and a limitation of TypeScript. At present, more techniques are available for organising code into a logical hierarchy of nested folders.

In this post I continue to exploit GitHub API to learn from experience of leading developers. I reuse the code from the previous post. But instead of counting nested folders in individual projects, this time I will count lines in individual modules.

Regardless of programming language, huge pieces of code are difficult to maintain. It is much easier to develop and maintain an application if its code is split into many highly-specialized pieces. In JavaScript pieces of code are called modules. So how many lines of code should be in a professional JavaScript module?

--

--

Marian C.
Marian C.

Written by Marian C.

Java, JavaScript and SQL developer. Interested in data collection and visualization.

Responses (1)