verlok / vanilla-lazyload

LazyLoad is a lightweight, flexible script that speeds up your website by deferring the loading of your below-the-fold images, backgrounds, videos, iframes and scripts to when they will enter the viewport. Written in plain "vanilla" JavaScript, it leverages IntersectionObserver, supports responsive images and enables native lazy loading.
https://www.andreaverlicchi.eu/vanilla-lazyload/
MIT License
7.67k stars 675 forks source link

Add JsDoc in order to provide a strict type checking #617

Open erikyo opened 5 months ago

erikyo commented 5 months ago

Is your feature request related to a problem? Please describe. Currently, the Vanilla Lazyload repository lacks JSDoc comments within its JavaScript codebase. This absence poses challenges for developers who seek to maintain or extend the codebase with type checking, as it lacks clear documentation about the types of inputs and outputs expected by various functions and methods.

Describe the solution you'd like I would like to request the addition of JSDoc comments throughout the codebase of Vanilla Lazyload. These comments should adequately describe the parameters, return types, and any relevant information about functions and methods. This addition will not only enhance the code's readability but also enable better type checking and documentation generation using tools like TypeScript or JSDoc.

Describe alternatives you've considered Without JSDoc comments, developers may resort to manual inspection of the codebase to understand function signatures and expected behaviors. However, this approach is time-consuming, error-prone, and lacks the automation provided by tools like TypeScript or JSDoc.

Additional context Including JSDoc comments aligns with best practices for JavaScript development and facilitates collaboration among developers. Additionally, it improves the overall maintainability of the codebase by providing clear documentation for future reference.

erikyo commented 5 months ago

@verlok can you assign this one to me? I am already familiar with this and even recently I have been doing it here