Overview
packages/configs/README.md📦 @joinery/configs
Shared ESLint, Vitest, Playwright and TypeScript presets. Every project's config file is a thin wrapper over one of these, so a change here lands everywhere at once.
Raw TypeScript, tagged type:config: it depends on nothing in the workspace. apps/huella-legal
extends no tsconfig preset (it references Nuxt's generated ones), so a compiler option added here
doesn't reach it.
Layout
One folder per tool under src/, each sorted the same way:
| Where | What it is | Who imports it |
|---|---|---|
| Tool folder root | A preset | A project's config file |
setup/ | Wiring the preset hooks in itself | Nobody directly |
utils/ | A test helper | Specs, as @joinery/configs/<tool>/utils/<name> |
ESLint has lib/ (one file per concern, mapped in lib/README.md)
and rules/ (in-house joinery/* rules, each with a RuleTester spec).
Usage
import { eslint, vitest } from "@joinery/configs";
export default eslint.createNodeConfig(); // or createVueConfig() / createNuxtConfig()
export default vitest.createNodeConfig(); // or createVueConfig(viteConfig) / createNuxtConfig({ root })
{ "extends": "@joinery/configs/tsconfig/node.json" }
tsconfig/base.json is strict plus noUncheckedIndexedAccess; every consumer extends node.json.
Vitest
- Coverage runs on
test:coverage, nevertest. A project needs@vitest/coverage-v8in its owndevDependencies.COVERAGE_THRESHOLDS=offdisables thresholds (the portal deploy sets it). - Any console output fails the test (
consoleGuard.ts, 0032). Stub it withvi.spyOn(console, "warn").mockImplementation(() => {})and assert on the spy. prepareNuxt.mjsrunsnuxi preparewhen a Nuxt project has no.nuxtyet.- This package's own
test:e2eruns itsbrowserVitest project, the specs that launch Playwright;testandtest:coverageleave them out.
Nuxt apps
createNuxtConfig({ root, nodeSpecs?, setupFiles?, coverageExclude?, thresholds? }) builds three
projects, each covering the app root and every layers/*:
| Project | Specs | Environment |
|---|---|---|
node | server/, shared/, modules/, tools/, plus nodeSpecs | Node, Nitro globals stubbed by stubs.ts |
nuxt | app/ | One shared Nuxt environment, one file at a time |
nuxt-isolated | app/ specs that call vi.mock, mockNuxtImport or mockComponent | Isolated, files in parallel. Sorted automatically |
- In the shared
nuxtproject, a spec must restore anything global it changes (fake timers, stubbed globals, the DOM) inafterEach, or the next file breaks without naming the cause. - Helpers:
vitest/utils/nuxt(withSetup,serveEndpoint,slotStub) andvitest/utils/nitro(stubNitro()before the dynamicimport()of a server file). @nuxt/test-utilsis resolved from the app, not this package; the app installs it with@vue/test-utilsandhappy-dom.- The test boot builds into
node_modules/.cache/nuxt-vitest, never.nuxt, and runs withJITI_MODULE_CACHE=0. Both prevent failures that take down everynxcommand.
Playwright
export default playwright.createConfig({ port, command, env });
- Chromium at 390, 768 and 1280 px. Tag a test
@desktop(≥ 1024 px),@mobile(below) or@any-width(first width only, forrequest/<head>-only tests). Tests run fully parallel, on two workers locally and Playwright's default in CI. - Specs import
testfrom@joinery/configs/playwright/utils/test, never@playwright/test(lint enforces it). Any browser console output fails the test unlessallowedConsolematches it;page.gotowaits for hydration. - The server preload calls
recordServerConsole()from@joinery/configs/playwright/setup/server, and teardown fails the run on anything the server logged. - Helpers:
utils/a11y(axeViolations, asserted withtoEqual([])) andutils/i18n(createT,rawKeysIn). @playwright/testmust stay acatalog:entry; a second resolved copy fails every spec.
What the ESLint factories bundle
Every factory includes Prettier as a lint rule (100 columns, 4 spaces, double quotes), type-checked
typescript-eslint (not for Nuxt .vue files), @nx/enforce-module-boundaries, SonarJS, regexp
safety, and the house style rules: arrow functions, destructuring, interface over type,
helpers declared above use, no nested ternaries, no await in loops, sorted-with-comparator arrays,
no console, no raw-HTML sinks, and eslint-disable must give a reason. Vue configs add
eslint-plugin-vue and the joinery/* template rules. Specs get @vitest/eslint-plugin and must
assert behaviour, not call order or wrapper.vm.
lib/README.md has the file for each. Opt-in pieces a project appends
after its factory:
| Export | Does | Used by |
|---|---|---|
eslint.layerBoundaries({ cores, kit }) | Enforces Nuxt layer directions, auto-imports included | huella-legal, developer-portal |
eslint.routeMeta | Every Nitro route has defineRouteMeta with tags and summary | huella-legal |
eslint.i18nKeys(localeGlob) | Every static t() key exists | huella-legal |
eslint.tailwind(entryPoint) | better-tailwindcss rules | Every app |
eslint.pureDomain | No I/O, process or adapters/ in domain/ | infrastructure/scripts |
A rule for everyone goes in lib/; a rule for one flavour goes in its factory. The
configs-new-rule skill has the steps.