A JavaScript and TypeScript ship
ESLint goes to work before Prettier, and ye call TypeScript checking on deck when ye need it.
Before ye sail: ESLint, Prettier, and TypeScript executables on PATH, plus their project configuration. If they're package dependencies, expose node_modules/.bin through mise, the quartermaster, or through the environment ye already have.
Download javascript-project.pkl and save it as hk.pkl, the charts yer ship sails by.
The charts
/// Prettier and ESLint, with TypeScript checking enabled by the types profile.
amends "package://github.com/jdx/hk/releases/download/v2.4.0/hk@2.4.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v2.4.0/hk@2.4.0#/Builtins.pkl"
steps {
["eslint"] = Builtins.eslint
["prettier"] = (Builtins.prettier) {
// Choose a stable order when both tools can format JavaScript.
depends = "eslint"
}
["tsc"] = (Builtins.tsc) {
profiles = List("types")
}
}Take her out
hk validate
hk check --all --plan
hk check --all
hk check --all --profile types
hk fixESLint and Prettier can both mend JavaScript files. The dependency gives them a stable order, the same every time they haul; configure their rules to agree. TypeScript checking stays behind the types profile, a watch of its own, so it only comes on deck when ye opt in.
The top-level steps crews the default pre-commit, check, and fix hooks. The pre-commit hook stows yer unstaged work in the hold before it fixes and stages changes.
Refit her for yer own ship
Remove tsc from the crew for a JavaScript-only project. If yer tools live in multiple packages, use workspaces or the monorepo example, one ship, many crews. Use hk check --all --profile types in CI, the harbour-master's inspection, to include type checking.
