@o3osatoshi/config
v1.1.1
Published
Shared tsup presets and TypeScript tsconfig bases for personal projects.
Maintainers
Readme
@o3osatoshi/config
Shared configuration for my TypeScript projects.
- tsup presets (browser/public-dual/functions)
- TypeScript tsconfig bases (base/node/browser/next/functions/storybook)
- Biome shared configs (base, react, next)
- ESLint flat config (perfectionist import/order rules)
Exports
@o3osatoshi/config/tsup@o3osatoshi/config/tsconfig/*@o3osatoshi/config/biome/*@o3osatoshi/config/eslint/*
Installation
pnpm add -D @o3osatoshi/config
# Optional peers (depending on what you use)
# - For tsup presets / tsconfig usage
pnpm add -D tsup typescript
# - For ESLint flat config
pnpm add -D eslint @typescript-eslint/parser eslint-plugin-perfectionistNotes
- Requires Node >= 22 (matches this repo engines).
Usage
tsup presets
Import presets from @o3osatoshi/config/tsup and export a config in tsup.config.mjs.
import { browserBundlePreset, publicDualBundlePreset, functionsBundlePreset } from "@o3osatoshi/config/tsup";
// Browser/React library (ESM, externals React/Next). DTS optional via { dts: true }.
export default await browserBundlePreset({ entry: { index: "src/index.tsx" }, dts: true });
// Public library (ESM + CJS, with DTS).
// Default sourcemap: enabled in production/CI, disabled in dev.
// export default await publicDualBundlePreset({ entry: { index: "src/index.ts" } });
// Firebase Functions (ESM, Node target). Adjust target per runtime.
// export default await functionsBundlePreset({ entry: { index: "src/index.ts" } });Notes
- Externals are automatically derived from dependencies/peerDependencies of the nearest package.json. In addition, common UI libs are always externalized:
react,react-dom,next. - The browser bundle preset explicitly marks React/Next as externals for UI packages.
- Each preset accepts standard
tsupOptionsand sets sensible defaults. publicDualBundlePresetenablessourcemapby default in production/CI; pass{ sourcemap: false }to disable.- You can pass through
env,banner,external,outDir, andonSuccessas needed.
Defaults (high-level)
browserBundlePreset: ESM, platformbrowser, React/Next external,dtsoff by default.publicDualBundlePreset: ESM + CJS, DTS on,sourcemapon in CI/prd, off in dev.functionsBundlePreset: ESM, platformnode,target: node22, sourcemap enabled.
tsconfig bases
Pick a base that fits your project (TS 5+, moduleResolution: "Bundler").
// Node/Library (default)
{
"extends": "@o3osatoshi/config/tsconfig/node.json"
}// Next.js app
{
"extends": "@o3osatoshi/config/tsconfig/next.json"
}// Browser library (React/Vite)
{
"extends": "@o3osatoshi/config/tsconfig/browser.json"
}// Firebase Functions (typecheck‑only; output is handled by your bundler)
{
"extends": "@o3osatoshi/config/tsconfig/functions.json"
}// Storybook (React + Vite)
{
"extends": "@o3osatoshi/config/tsconfig/storybook.json"
}ESLint (flat config)
This package ships a small ESLint flat-config focused on import/export/property sorting via eslint-plugin-perfectionist.
Usage in a project root eslint.config.mjs:
import config from "@o3osatoshi/config/eslint/config.mjs";
export default [...config];What it does
- Registers
@typescript-eslint/parserfor TS files. - Enables
perfectionistrules for sorting imports/exports/objects, etc. - Adds JSX prop sorting for React files.
- Ignores common output folders:
dist,.next,.turbo,storybook-static, etc.
Peer deps
eslint>= 9@typescript-eslint/parsereslint-plugin-perfectionist
Biome (shared config)
This package also exports a shared Biome configuration so multiple repositories can share the same lint/format rules.
Usage in another repository:
Install the package as a dev dependency.
pnpm add -D @o3osatoshi/configCreate
biome.jsonat the repository root and extend the shared config (using the package export):{ "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", "extends": ["@o3osatoshi/config/biome/base.json"] }(Recommended) Mark it as the root config so Biome doesn’t traverse upward:
{ "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", "root": true, "extends": ["@o3osatoshi/config/biome/base.json"] }
Variants (optional)
If you need different presets for specific contexts, you can publish additional files under packages/config/biome/ and extend them from the package export. This repo currently ships:
@o3osatoshi/config/biome/base.json(common base)@o3osatoshi/config/biome/react.json(additional React/JSX rules)@o3osatoshi/config/biome/next.json(Next.js recommended rules)
Example: For a React project that also uses Next.js, extend both react.json and next.json.
{
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"extends": ["@o3osatoshi/config/biome/react.json", "@o3osatoshi/config/biome/next.json"]
}Within this monorepo, the root already extends @o3osatoshi/config/biome/base.json.
What it enforces
- Base: double quotes (formatter), space indentation, import/key sorting, recommended rules, Project/Test domains.
- React: detect duplicate JSX props (
noDuplicateJsxProps); sort class names forclsx/cva/tw(useSortedClasses). - Next: enable
nextdomain recommended rules.
Ready-made variants
Next.js app:
{ "$schema": "https://biomejs.dev/schemas/2.2.4/schema.json", "extends": ["@o3osatoshi/config/biome/react.json", "@o3osatoshi/config/biome/next.json"] }
Publishing
- Build:
pnpm build(generatesdist/) - Publish to npm:
pnpm publish --access public
The package exposes tsup presets, tsconfig, biome, and eslint exports. Install it as a dev dependency and import what you need per project.
