Shared ESLint flat config for Karibsen Studio projects. Written in TypeScript, with a framework-agnostic scope: no Nuxt or Vue dependency.
- Flat config only, built for ESLint 9 and 10
- TypeScript rules without type-checking, so there is no
projectoption to wire up - Formatting rules generated from
@stylistic, consistent across every repo - Import and export sorting via
simple-import-sort - Composable: every block is exported on its own, and the result keeps chaining
pnpm add -D @karibsen/eslint-config eslintESLint is a peer dependency (^9 or ^10), so the consuming project picks its own version.
// eslint.config.ts
import { karibsen } from "@karibsen/eslint-config";
export default karibsen();karibsen() returns a FlatConfigComposer,
so you can keep chaining:
import { karibsen } from "@karibsen/eslint-config";
export default karibsen({ stylistic: { quotes: "single" } })
.append({
files: ["scripts/**"],
rules: { "no-console": "off" },
});TypeScript cannot name the inferred return type across package boundaries, which surfaces as
TS2883 when your eslint.config.ts is type-checked. Annotate the export to fix it:
import type { Linter } from "eslint";
import type { FlatConfigComposer } from "eslint-flat-config-utils";
import { karibsen } from "@karibsen/eslint-config";
const config: FlatConfigComposer<Linter.Config> = karibsen();
export default config;| Option | Type | Default | Description |
|---|---|---|---|
typescript |
boolean |
true |
Enable the typescript-eslint rules |
stylistic |
boolean | StylisticOptions |
true |
Enable the formatting rules |
imports |
boolean |
true |
Enable import and export sorting |
ignores |
string[] |
[] |
Extra patterns, appended to DEFAULT_IGNORES |
overrideIgnores |
boolean |
false |
Replace DEFAULT_IGNORES instead of extending it |
StylisticOptions accepts indent (2), quotes ("double"), semi (true) and jsx (true).
@eslint/js recommended, Node and ES2025 globals, plus the correctness rules the recommended preset
leaves out: eqeqeq (smart), no-var, prefer-const, prefer-template, object-shorthand and
no-debugger.
no-console follows NODE_ENV: error in production, warn otherwise. console.warn and
console.error are allowed in both cases.
NODE_ENVis read when the config loads. CI usually does not set it toproduction, so stray logs stay warnings and will not faileslint .. Run the lint step withNODE_ENV=productionor--max-warnings 0if you want them to break the build.
typescript-eslint recommended without type-checking, plus consistent-type-imports,
consistent-type-definitions (interfaces over type aliases), method-signature-style and
ban-ts-comment (ts-expect-error is allowed when it carries a description). no-unused-vars
accepts an _ prefix for intentionally unused bindings.
Declaration files (*.d.ts) opt out of consistent-type-definitions and no-explicit-any.
Rules come from @stylistic's customize() factory, so the whole family stays coherent when a
setting changes. On top of it: double quotes with avoidEscape, semicolons, object-curly-spacing,
arrow-spacing, multiline trailing commas, one statement per line, and blank lines around functions
and declarations.
simple-import-sort with the following groups, in order: side effects, node: builtins, framework
imports (Nuxt and Vue), remaining packages, internal aliases (~, @/, #...), then relative
imports.
The framework patterns are plain regexes. They cost nothing in a project that has no such import, and they keep the ordering identical across repos.
The builtin and package groups are not optional:
simple-import-sortplaces anything matching no group last, so without themimport x from "lodash"would sort after your relative imports.
Each block is exported separately if you need something narrower than the default preset:
import type { Linter } from "eslint";
import { base, ignores, stylistic, typescript } from "@karibsen/eslint-config";
const config: Linter.Config[] = [
...ignores(["dist"]),
...base(),
...typescript(),
...stylistic({ quotes: "single", semi: false }),
];
export default config;DEFAULT_IGNORES, GLOB_SOURCE, IMPORT_GROUPS and STYLISTIC_DEFAULTS are exported as well.
pnpm install
pnpm lint # the repo is linted by the config it publishes
pnpm typecheck
pnpm buildMIT, Karibsen Studio