@matthewbub/init-formatters
v0.2.0
Published
Scaffold a repo onto the @matthewbub/toolshed ESLint + Prettier configs: patches package.json and writes the config files, predictably and idempotently.
Maintainers
Readme
@matthewbub/init-formatters
Scaffold a repo onto the @matthewbub/toolshed ESLint + Prettier configs. It patches your package.json and drops the config files needed to consume the toolshed presets — predictably and idempotently. It does not run an install.
Run it
pnpm dlx @matthewbub/init-formatters --preset vite
# or: npx @matthewbub/init-formatters --preset viteBy default it targets ./package.json. Pass a path (file or directory) to target another:
pnpm dlx @matthewbub/init-formatters ./apps/web/package.json --preset next[!NOTE] The bare
npm init @matthewbub/…/pnpm create @matthewbub/…shorthand resolves to acreate--prefixed package name, so use thedlx/npxform above.
Options
init-formatters [options] [packageJsonPath]
packageJsonPath target package.json, or a directory containing one (default: package.json)
--preset <preset> ESLint preset: base | react | vite | astro | next | hono | storybook (prompted if omitted)
--no-prettier-ignore do not write a .prettierignore
-y, --yes non-interactive; requires --preset
-f, --force overwrite existing config files
-V, --version print version
-h, --help print helpWhen --preset is omitted (and not --yes), you're prompted to pick one. When a config file already exists, you're asked before overwriting unless --force (or skipped under --yes).
What it does
package.jsonscripts — addslint,lint:fix,format,format:check(existing scripts are left as-is).package.jsondevDependencies — adds@matthewbub/toolshed,eslint,prettieras exact pins matching the toolshed version + catalog this CLI was built against.package.json"prettier"— set to@matthewbub/toolshed/prettier-config(left as-is if already present).eslint.config.mjs— wires the chosen preset, e.g.:import {vite} from "@matthewbub/toolshed/eslint-config/vite"; export default vite({tsconfigRootDir: import.meta.dirname});.prettierignore— common build/generated globs (skip with--no-prettier-ignore).
Re-running is safe: existing scripts, dependencies, and the prettier field are never clobbered, and existing config files are skipped unless --force.
Afterward, install the new devDependencies (pnpm install, or npm/yarn).
Extending
Each capability is a self-contained, idempotent Step (src/steps/*) listed in src/commands/init.ts. Adding a new one (a tsconfig.json, a CI workflow, a .gitignore) is a new module appended to that list.
