@multiplatform.one/config
v7.34.4
Published
Shared build and test configuration presets for multiplatform.one
Readme
@multiplatform.one/config
Shared build and test configuration presets for multiplatform.one.
Presets
Vite
import { createViteConfig } from "@multiplatform.one/config/vite";
export default createViteConfig({
/* options */
});Vitest
import { createVitestConfig } from "@multiplatform.one/config/vitest";
export default createVitestConfig({
/* options */
});Storybook
import { createStorybookViteConfig } from "@multiplatform.one/config/storybook";
export default createStorybookViteConfig({
/* options */
});Playwright
import { createPlaywrightConfig } from "@multiplatform.one/config/playwright";
export default createPlaywrightConfig({
/* options */
});TypeScript
Extend from the tsconfig presets:
{
"extends": "@multiplatform.one/config/tsconfig/base.json"
}Available presets: base.json, build.json, app.json.
Oxlint
Convention rules travel with the package. A consuming app extends the preset and needs no rules block of its own (MPO-23):
{
"extends": ["./node_modules/@multiplatform.one/config/oxlint.json"]
}oxlint resolves extends as a file path, not a package name, hence the
node_modules prefix. The preset loads the plugin, turns
no-hex-literals, no-raw-typography and no-parameter-properties on as
errors, turns no-chrome-props, no-raw-geometry and no-child-margin on
as warnings while their burndowns run, and exempts specs and tests/ trees,
which assert computed colours, from all but no-raw-typography and
no-parameter-properties. A project that wants its
own levels keeps the older one-line form,
{ "jsPlugins": ["@multiplatform.one/config/oxlint"] }, and writes its own
rules block (mpo's own oxlintrc.json turns no-hex-literals on for
apps/**, packages/**, features/**, public/frappe-ui/src and
public/backoffice/src, and off for specs and tests/ trees). Palette modules (themes/base.ts, themes/accent.ts,
*palette*) are exempt. Comments are not visited, so a JSDoc #025 is not
a hit. A file no theme token reaches opts out with a // hex-escape: <reason>
line comment; lint fails that comment unless the spec table
## Colour-literal escapes has its file and exact reason, and fails a row
whose comment is gone (MPO-326).
no-chrome-props and no-raw-geometry ship in the same plugin (MPO-17).
Enable them the same way when you start that burndown. Drawing-file
exceptions come from the spec table ## Drawing files, not from the code.
no-raw-geometry leaves 0 alone (00 L8 E1). mpo's own oxlintrc.json
runs it as an error over public/frappe-ui/src and public/backoffice/src
(MPO-15), off for specs.
no-child-margin (MPO-23, 00 L9a) fails a non-zero margin* prop, long
or shorthand, on any element nested inside another element's JSX: the parent
owns the gap. 0 is always legal, the outermost element a file renders is
left alone, and slots come from the spec table ## Slot margins. mpo's own
oxlintrc.json runs it as an error over apps/, features/, packages/ and
public/, off only for specs and tests/ trees. The burndown list that
exempted the 73 files carrying 133 hits when it was switched on is empty, and
scripts/child-margin-ratchet.spec.mjs holds its ceiling at 0, so a file
added back to it fails the spec.
no-parameter-properties (MPO-455) fails a TypeScript constructor
parameter property, constructor(readonly hash: Hash) and its private,
protected, public and override spellings. vxrn's native dev bundle
lowers a class to a function and can leave the modifier on that function's
parameter, and rolldown then refuses the whole bundle with 'readonly'
modifier cannot appear on a parameter. Declare the field and assign it in
the constructor. mpo's own oxlintrc.json runs it as an error over the
whole tree.
Lint (node-script checks)
CSS-in-apps, features-twin, silent token no-ops, the LC-65 size-recipe
pilot, and the size-recipe escape registry run through
runConventionChecks({ roots }). Every sizeRecipeEscape site, and every
size-recipe-escape: comment, must be a row in the spec table
## Size-recipe escapes by file and exact reason, and a row whose site is
gone fails too (MPO-23, 00 L8 E8):
import { runConventionChecks } from "@multiplatform.one/config/lint";
runConventionChecks({
roots: { root: process.cwd() },
});