Open Shyam-Sundar-Bharathi opened 1 month ago
Migrating to ES6 over CoffeeScript and jQuery allows better Modularization and Code Organization. We can adopt modern OOP practices, introduce Async Programming and Promises, Destructuring and more. We can move forward with well documented testing frameworks like Jest or Mocha to test individual functions, components, and modules in ES6.
I like this approach and we have been able to achieve most of it. Although, I feel the code can be modularised the way it exists in Littlefoot (separating events, popovers, util functions and usecases for the features). This would make adding new features simpler and make it more scalable
Another aspect to consider is support for older browsers.
ADR05: Migrating jQuery to JS ES6 and Eliminating CoffeeScript Dependency
Context and Problem Statement
Bigfoot.js was originally developed when JavaScript tooling was more primitive, and ES6 standards had not yet been established. As a result, the code relies heavily on jQuery for DOM manipulation and CoffeeScript as the primary scripting language. However, with the advent of ES6 and its widespread adoption, continuing to depend on these older tools introduces unnecessary complexity and overhead. CoffeeScript, in particular, adds an extra layer of complication due to its dependency on transpiling into JavaScript, while jQuery's usage adds extra weight and outdated conventions to the project.
Given that Bigfoot.js is a relatively simple tool for footnotes, it doesn’t require heavy tooling or dependencies. The move to vanilla JavaScript (ES6) can simplify the project while improving maintainability, performance, and scalability.
Decision Drivers
Considered Options
Option 1: Keep jQuery and CoffeeScript
Pros:
Cons:
Option 2: Migrate to ES6 and eliminate CoffeeScript and jQuery
Pros:
Cons:
Option 3: Adopt a modern frontend framework (React, Vue)
Pros:
Cons:
Decision Outcome
The chosen option is Migrate to ES6 and eliminate CoffeeScript and jQuery.
This decision will modernize the codebase by refactoring it to native ES6+ JavaScript, removing the need for transpiling (CoffeeScript) and simplifying DOM manipulation (by removing jQuery). Given that footnotes are a simple feature, this change will significantly reduce complexity, improve performance, and make the project more maintainable without introducing unnecessary dependencies.
Consequences
Positive:
Negative:
Confirmation
The success of this migration will be confirmed through: