@wtf/project-oxlint
v1.1.1
Published
The shared oxlint config (./config): the typescript, unicorn and import plugins, correctness rules as errors, suspicious and perf rules as warnings, and import cycles, loose equality and explicit any as errors. oxlintConfig(options) gives it with a repo's
Readme
@wtf/project-oxlint
A shared oxlint config: the typescript, unicorn and import plugins, correctness rules as errors,
suspicious and perf rules as warnings, and import/no-cycle, eqeqeq and
typescript/no-explicit-any as errors. It leaves the build and a generated reference in
packages/docs/api alone. oxlint is a peer dependency.
| Subpath | What you get |
| ---------- | ------------------------------------------------------------------------------------------------------- |
| ./config | The config, as the default export; oxlintConfig(options), the config with options of your own over it |
| ./schema | oxlintSchema: the Standard Schema of the options of oxlintConfig(), which gives their JSON Schema |
// oxlint.config.ts
import preset from '@wtf/project-oxlint/config'
import { defineConfig } from 'oxlint'
export default defineConfig({ extends: [preset] })oxlintConfig(options) gives the config with your options over it: categories, rules and
env key by key over the preset's, and any other option, as plugins or ignorePatterns, in
place of the preset's.
Run it as oxlint --deny-warnings, so a warning fails the lint just as an error does. See the
presets guide.
From the wtf configuration
The config reads no file of its own. Keep its options in the oxlint section of the repo's wtf
configuration, load it with @wtf/project-config, and spread the
section in, checked by oxlintSchema. oxlint imports oxlint.config.ts, so the config may await
the load, and a wtf.config.ts is read too:
// oxlint.config.ts
import { loadConfig } from '@wtf/project-config/node'
import { sectionOf } from '@wtf/project-config/section'
import { oxlintConfig } from '@wtf/project-oxlint/config'
import { oxlintSchema } from '@wtf/project-oxlint/schema'
import { defineConfig } from 'oxlint'
const config = await loadConfig()
export default defineConfig({
extends: [oxlintConfig({ ...(await sectionOf(config, 'oxlint', oxlintSchema)) })]
}){ "oxlint": { "rules": { "no-console": "error" }, "ignorePatterns": ["**/dist/**", "site/**"] } }A key that starts with // is a comment, as "//": "why": oxlintSchema takes it, at the top of
the section, and leaves it out of the options it gives.
