Standardize JavaScript Tooling
donovanglover opened this issue · comments
Feature Request
Summary
I want to contribute some JavaScript for headings and table of contents, but currently there's no official formatter.
I also don't know the procedure used to create the minified files.
Motivation
Having a standard formatter and/or bundler would make it easier to contribute without worrying about stylistic choices like semicolon vs no semicolon. The CI can be in charge of formatting/linting and building the minified JavaScript files.
Detailed Description
Biome is a modern formatter and linter written in Rust. Bun is a modern JavaScript toolkit that supports minifying JS.
Additional Context
I assume this would be done in such a way that regular end-users don't have to worry about any JavaScript tooling on their end. That is, only contributors would need to know that it exists.
I create the minified files with either terser
or uglifyjs
, whichever does best on a given file.
I check for this as part of my pre-commit hook for tabi, which doesn't allow me to commit a file with the name min.js
if it can be compressed further:
Lines 99 to 122 in fd1c50a
Regarding stylistic choices, I'm not too worried about them, to be honest.
My general approach to JS is:
- Can it be done with HTML/CSS? If so, do that.
- If it can't, how important is the feature? If the answer is "not very", then I'll probably be against adding it.
The CI can be in charge of formatting/linting and building the minified JavaScript files.
How do you picture this happening? A commit/PR is made and a GitHub action triggers the minification of a file, overwriting the previous minification (if it existed)? I'd be open to this.
Yeah a GitHub Action would be nice. The .githooks
are great though and it may be easier to just mention it in CONTRIBUTING.md
I've updated the CONTRIBUTING file to mention the pre-commit hook as well as some pointers regarding coding style guidelines.
I am now exploring the GitHub Action route. If it's not too complex, I'll implement it.
Since I don't plan on making too many JS additions in the future, I'll leave it as is for now.