@wtf/project-oxfmt
v1.1.1
Published
The shared oxfmt config (./config): 100 columns, single quotes, no semicolons and no trailing commas. oxfmtConfig(options) gives it with a repo's options over it; the schema of those (./schema), oxfmtSchema, a Standard Schema that gives their JSON Schema,
Readme
@wtf/project-oxfmt
A shared oxfmt config: 100 columns, single quotes, no semicolons and no trailing commas. It leaves
the build, the lockfile, the changelogs and a generated reference in packages/docs/api alone.
oxfmt is a peer dependency.
| Subpath | What you get |
| ---------- | ------------------------------------------------------------------------------------------------------ |
| ./config | The config, as the default export; oxfmtConfig(options), the config with options of your own over it |
| ./schema | oxfmtSchema: the Standard Schema of the options of oxfmtConfig(), which gives their JSON Schema |
// oxfmt.config.ts
import preset from '@wtf/project-oxfmt/config'
import { defineConfig } from 'oxfmt'
export default defineConfig({ ...preset })oxfmtConfig(options) gives the config with your options over it, each in place of the preset's,
so ignorePatterns given is the whole list.
See the presets guide.
From the wtf configuration
The config reads no file of its own. Keep its options in the oxfmt section of the repo's wtf
configuration, load it with @wtf/project-config, and spread the
section in, checked by oxfmtSchema. oxfmt imports oxfmt.config.ts, so the config may await the
load, and a wtf.config.ts is read too:
// oxfmt.config.ts
import { loadConfig } from '@wtf/project-config/node'
import { sectionOf } from '@wtf/project-config/section'
import { oxfmtConfig } from '@wtf/project-oxfmt/config'
import { oxfmtSchema } from '@wtf/project-oxfmt/schema'
import { defineConfig } from 'oxfmt'
const config = await loadConfig()
export default defineConfig(oxfmtConfig({ ...(await sectionOf(config, 'oxfmt', oxfmtSchema)) })){ "oxfmt": { "printWidth": 120 } }A key that starts with // is a comment, as "//": "why": oxfmtSchema takes it, at the top of
the section, and leaves it out of the options it gives.
