Skip to content
crutchcrewPublic

About

js/ts tooling configs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

configg ⚙️

CI npm version provenance license

Shared configuration presets for typescript tooling. One package per tool, or all of them in a single install.

The presets ship as TypeScript and JSON source. There is no build step, so use them from a runtime or tool that can load .ts files from node_modules (Bun, or the tool's own loader).

Packages

Package Version What it configures
@configg/oxc npm oxfmt (/fmt) and oxlint (/lint) presets
@configg/prettier npm Prettier presets and combine()
@configg/tsconfig npm Strictest tsconfig presets for Bun and Vite
@configg/bases (this repo's root) npm All of the above under one name, straight from packages/*

Install only what you use, or install @configg/bases and import everything from it:

@configg/bases/… Same as
oxfmt @configg/oxc/fmt
oxlint @configg/oxc/lint
prettier @configg/prettier
tsconfig/{bun,client,vite} @configg/tsconfig/{bun,client,vite}

Usage

Tools are peerDependencies: you install oxfmt, oxlint, prettier and typescript yourself and pin the versions you want, plus the Prettier plugins of the presets you compose. The packages only supply the presets.

bun add -d @configg/bases oxfmt oxlint oxlint-tsgolint typescript
// oxfmt.config.ts

import { configs } from '@configg/bases/oxfmt'
import { defineConfig } from 'oxfmt'

export default defineConfig(configs.client)
// oxlint.config.ts

import { configs } from '@configg/bases/oxlint'
import { defineConfig } from 'oxlint'

export default defineConfig(configs.client)
// tsconfig.json
{ "extends": "@configg/bases/tsconfig/client" }

Installing a single package works the same way, for example @configg/oxc/fmt and @configg/oxc/lint.

Every oxfmt and oxlint preset is a plain object, so you can pass it as is or spread it. Call .with() on a preset to deep-merge changes into it: nested objects merge, while arrays and other values replace the preset's. See Overriding a preset.

import { configs as fmt } from '@configg/bases/oxfmt'

// Spread
const spread = {
	...fmt.client,
	sortTailwindcss: { ...fmt.client.sortTailwindcss, stylesheet: './src/main.css' },
}

// Call: the same config
const called = fmt.client.with({ sortTailwindcss: { stylesheet: './src/main.css' } })

Presets

  • oxfmt exports configs: client (Tailwind class sorting, import grouping with react, components and utils groups), scripts (shared base with import grouping, for tooling and config files) and server (same as scripts). Built-ins, including bun and bun:*, come first (after react in client), then packages, internal and #/ paths, and relative paths.
  • oxlint exports two base presets in configs, client (browser env) and scripts (Node env), and add-on presets: react, vitest (Vitest and Testing Library rules for spec files), antiSlop and bunTest. List them in extends, base first: extends: [configs.client, react, vitest]. Before 0.1.17, client included React and Vitest.
  • prettier exports config (the same options as oxfmt), one preset per plugin (sortImports, astro, svelte, tailwind) and combine() to merge them: combine(config, sortImports, tailwind({ tailwindStylesheet: './src/main.css' })). See its README.
  • tsconfig/bun (strictest + Bun), tsconfig/vite (strictest + Vite/React) and tsconfig/client (vite with ambient types cleared, so a package only picks up the @types/* it asks for).

The Oxlint presets don't enable anti-slop. antiSlop from the oxlint entry is an opt-in set with the plugin and all 18 rules as errors; unicorn/prefer-reflect-apply is off. See UPSTREAM.md for its source and update policy.

import { antiSlop, configs } from '@configg/bases/oxlint'

export default defineConfig({
	extends: [configs.client, antiSlop],
})

The plugin ships as TypeScript, so run oxlint under Bun (bunx --bun oxlint): Node refuses to strip types from files in node_modules.

bunTest from the oxlint entry is an opt-in preset for bun:test specs: a bun:test plugin whose five rules see describe, it and the hooks when they're imported from bun:test, which oxlint's built-in jest/vitest rules don't. Add it with extends: [bunTest]; it has no file glob and checks any file that imports from bun:test. See its docs.

Every preset goes in extends, base first: extends: [configs.client, antiSlop, bunTest]. The base presets keep their environment through extends. See Composing presets.

eslint-plugin-testing-library is only needed for the vitest add-on in the oxlint preset.

Development

The repo uses its own packages through the workspace, so there is nothing to build. Formatting, linting, type-checking and git hooks run through Vite+ (vp), configured in vite.config.ts. vp needs Node.js (22.22.1+ or 24.11+) on PATH next to Bun, including when the pre-commit hook runs.

bun install        # also installs the git hooks (.vite-hooks)
bun run check      # vp check (fmt + lint + type-check), then the lockfile check

License

MIT

About

js/ts tooling configs

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages