@kekkon-nexus/config
v3.2.0
Published
An opinionated config preset for TypeScript, oxlint, oxfmt and commitlint
Readme
@kekkon-nexus/config
An opinionated config preset for TypeScript, oxlint, oxfmt and commitlint.
Features
- Lint and format with oxlint and oxfmt
- Error on correctness, warn on style
- Carries the recommended presets of upstream ESLint plugins
- Opt-in layers for React, Next.js, Vue, Jest and Vitest
- Import sorting in oxfmt you can extend using
sortImports - Standalone, or using Vite+
- Scaffolds in a single script
Get Started
npm create @kekkon-nexus/configThe script will detect the config files already in the project and interactively ask for the toolchain and the project scope before writing the new configs or patching the existing ones.
Requires:
- Node.js >= 24.12
- TypeScript 7
Pass flags to skip the prompts:
| Flag | |
| ---------------------------------------- | ---------------------------------------- |
| --toolchain oxlint\|vite-plus | toolchain to configure |
| --scope jest\|next\|react\|vitest\|vue | opt-in preset, repeatable |
| --install | install the packages afterwards |
| --module | add "type": "module" to package.json |
| --typescript false\|true\|strict | write or patch tsconfig.json |
| --type-aware | install oxlint-tsgolint |
| --editorconfig | write .editorconfig if absent |
| --vscode | write .vscode files if absent |
| --commitlint | write commitlint.config if absent |
[!WARNING]
.editorconfigand.vscodesupport is not matured yet.
Or manually:
npm i -D @kekkon-nexus/config # and other dependenciesOptional Dependencies
| Feature | Optional Dependency |
| ------------------ | ------------------- |
| Formatting | oxfmt |
| Linting | oxlint |
| Type-aware linting | oxlint-tsgolint |
| Unified toolchain | vite-plus |
| Commit linting | @commitlint/cli |
Usage
// oxlint.config.ts
import oxlint from "@kekkon-nexus/config/oxlint";
import react from "@kekkon-nexus/config/oxlint/react";
import { defineConfig } from "oxlint";
export default defineConfig({
extends: [oxlint, react],
});// oxfmt.config.ts
import oxfmt from "@kekkon-nexus/config/oxfmt";
import { defineConfig } from "oxfmt";
export default defineConfig({
...oxfmt,
});Or one config with Vite+:
// vite.config.ts
import oxfmt from "@kekkon-nexus/config/oxfmt";
import oxlint from "@kekkon-nexus/config/oxlint";
import vp from "@kekkon-nexus/config/oxlint/vite-plus";
import { defineConfig } from "vite-plus";
export default defineConfig({
fmt: { ...oxfmt },
lint: { extends: [oxlint, vp] },
});Presets
| Import | |
| ------------------- | ------------------------------------------------- |
| oxlint | the default set |
| oxlint/javascript | core rules, eslint, oxc and promise plugins |
| oxlint/typescript | type-aware rules, needs oxlint-tsgolint |
| oxlint/import | import hygiene |
| oxlint/unicorn | modern syntax & API preferences |
| oxlint/jsdoc | jsdoc plugin |
| oxlint/browser | browser env, jsx-a11y plugin |
| oxlint/node | node env, node plugin |
| oxlint/react | react, react-perf |
| oxlint/next | nextjs, extends oxlint/react |
| oxlint/vue | vue |
| oxlint/jest | jest |
| oxlint/vitest | vitest |
| oxlint/vite-plus | vite-plus plugin, extends oxlint/vitest |
@kekkon-nexus/config/oxlint extends the following:
basejavascripttypescriptimportunicornjsdocbrowsernode
oxlint/base is the ported upstream recommended presets.
See src/oxlint for the rules each one sets.
TypeScript
{
"extends": ["@kekkon-nexus/config/ts", "@kekkon-nexus/config/ts/strict"]
}Extend either or both. ts sets:
compositemodule: esnextnoImplicitOverridenoUncheckedIndexedAccessverbatimModuleSyntaxrewriteRelativeImportExtensions
ts/strict adds:
erasableSyntaxOnlynoFallthroughCasesInSwitchnoImplicitReturnsnoPropertyAccessFromIndexSignaturenoUnusedLocalsnoUnusedParameters
Import Sorting
Sorts into builtins, externals, internals (~/, @/, #/), relatives,
then side effects.
To slot a group in:
import oxfmt, { sortImports } from "@kekkon-nexus/config/oxfmt";
export default defineConfig({
...oxfmt,
sortImports: sortImports({
customGroups: [{ groupName: "react", elementNamePattern: ["^react"] }],
groupsBeforeExternal: [["react"]],
}),
});Commitlint
// commitlint.config.ts
const config = {
extends: [
"@kekkon-nexus/config/commitlint",
"@kekkon-nexus/config/commitlint/gitmoji",
],
};
export default config;License
MIT License © Kekkon Nexus
