@20baht/strict
Shared lint, type, format, structure, commit and CI config for bank20baht apps. One package,
subpath exports, no build step. Spec: docs/CONFIG_LIB_SPEC.md.
bun add -d @20baht/strict
| Subpath |
What |
@20baht/strict/eslint |
base, angular({ files, restrictedImports }), bahtui({ files, tokenFiles }), cssRules(), bahtuiPlugin |
@20baht/strict/tsconfig/{base,node,web}.json |
strict flags; web adds Angular compiler strictness |
@20baht/strict/prettier |
default export config, ignore list for .prettierignore |
@20baht/strict/depcruise |
makeConfig({ serverApps, webApps, moduleDeps, overrides, generic, federation, packages, packagesMayImport }) |
@20baht/strict/knip, /jscpd |
factories; jscpd threshold is required |
@20baht/strict/commitlint, /lint-staged |
plain configs |
@20baht/strict/gitleaks.toml, /renovate.json, /husky/* |
copy or extend |
@20baht/strict/ci/ci.yml, /ci/setup/action.yml |
reusable CI workflow and setup action templates |
// eslint.config.ts
import { defineConfig } from 'eslint/config'
import { base, angular, bahtui } from '@20baht/strict/eslint'
export default defineConfig([
...base,
...angular({ files: ['apps/web/src/**'], restrictedImports: [] }),
...bahtui({ files: ['apps/web/src/**'], tokenFiles: ['apps/web/src/styles.css'] }),
// app overrides last, each with a reason: -- why
])
base ignores build output (dist, coverage, .angular, .release, …) and git worktrees kept
inside the repo (**/.worktrees/**, **/.claude/worktrees/**): a worktree is often excluded only in
.git/info/exclude, which eslint does not read, so eslint . would lint a second checkout.
tokenFiles are the app's own token stylesheets: bahtui/known-token reads the --baht-* names
they define, and bahtui/no-raw-color treats them as the theme, the only files where a --baht-*
definition may hold a colour literal (--baht-primary: #2e4a9e). Everywhere else a token points at
another token. Used on its own, the rule takes the same list as themeFiles (paths or globs
relative to the eslint cwd); without it, a literal definition is allowed in any file.
base also turns on bahtui/no-optional-union-enum for every TypeScript file. It reports
t.Optional(t.UnionEnum([...])) (and Type.Optional(Type.UnionEnum([...]))): Elysia 1.4.32 hands
the handler the enum's first value when the key was not sent, so an absent query status reads as
'todo' and a PATCH that leaves the field out resets it. Write
t.Optional(t.Union([t.Literal('todo'), t.Literal('done')])) instead; a required t.UnionEnum is
fine.
A Native Federation host with several remotes (no app imports another; services/ and shared/
in a remote, and core/ in the host, know no page under modules/; the listed packages import
no app except the paths in packagesMayImport):
// .dependency-cruiser.mjs
import { makeConfig } from '@20baht/strict/depcruise'
export default makeConfig({
generic: true,
federation: { host: 'shell', remotes: ['orders-web', 'billing-web'] },
packages: ['web-kit'],
packagesMayImport: ['server/dist/types/'],
})
federation also takes pages (default 'modules'), remoteLayers (default
['services', 'shared']) and hostLayers (default ['core']).
{ "extends": "@20baht/strict/tsconfig/base.json" }, "prettier": "@20baht/strict/prettier".
Peers (owned by the app): eslint, @eslint/js, @eslint/css, typescript-eslint,
eslint-config-prettier, eslint-plugin-sonarjs; angular-eslint only for angular().
Locked rules
no-explicit-any, no-non-null-assertion, tsconfig strict. Check an app with
bunx @20baht/strict verify [--file eslint.config.ts] [--tsconfig tsconfig.json]; exit 1 if unlocked.
Stays in each app: coverage thresholds, jscpd threshold, moduleDeps, budgets, wrangler.toml, Playwright config.