đ @kitql/eslint-config
To have linting & formatting in your project, you need 20 dep, files, ⌠and itâs a pain to maintain in each project.
Here the idea is to reduce as much as possible the config on your end. (Of course, you can still tune things)
Installation
Section titled âInstallationânpm i -D @kitql/eslint-config eslint prettierYou need to install the peer dependencies you want to use (by default: eslint, prettier).
@kitql/eslint-config ships four optional tools - install only what you want to use:
| Tool | What it does | Install |
| -------- | ------------------------------------------------------- | -------------------------- |
| eslint | Linter (svelte rules, pnpm catalog rules, custom rules) | npm i -D eslint |
| prettier | Formatter (works on every file type, incl. .svelte) | npm i -D prettier |
| oxlint | Faster linter (Rust); covers most JS/TS rules | npm i -D oxlint |
| tsgolint | Type-aware lint rules for oxlint | npm i -D oxlint-tsgolint |
| oxfmt | Faster formatter (Rust); doesnât speak .svelte yet | npm i -D oxfmt |
Thatâs it: no public-hoist-pattern and no need to list every eslint/prettier plugin in your own
package.json. @kitql/eslint-config ships them all as its own dependencies and resolves them
internally.
eslint config
Section titled âeslint configâimport { kitql } from '@kitql/eslint-config'
/** @type { import('eslint').Linter.Config[]} */const config = [ ...kitql(), { name: 'app:rules', rules: { // Some custom things? }, },]
export default configYou can check your config running this tool
npx @eslint/config-inspectorprettier config
Section titled âprettier configâimport { kitql } from '@kitql/eslint-config/.prettierrc.js'
export default { ...kitql(), // Some custom things?}oxlint config
Section titled âoxlint configâ{ "$schema": "./node_modules/oxlint/configuration_schema.json", "extends": ["./node_modules/@kitql/eslint-config/.oxlintrc.json"], "rules": { // Some custom things? },}The shipped config enables @e18e/eslint-plugin + eslint-plugin-depend for modern-JS suggestions
(prefer Array.at, Date.now, URL.canParse, âŚ) and the correctness category at error level.
oxfmt config
Section titled âoxfmt configâ{ "$schema": "./node_modules/oxfmt/configuration_schema.json", "tabWidth": 1, "useTabs": true, "singleQuote": true, "trailingComma": "all", "semi": false, "arrowParens": "always", "printWidth": 100, "sortImports": { "groups": [ "builtin", { "newlinesBetween": false }, "external", "kitql", "sveltekit", "aliases", ["parent", "sibling", "index"], "unknown", ], "customGroups": [ { "groupName": "kitql", "elementNamePattern": ["@kitql/**"] }, { "groupName": "sveltekit", "elementNamePattern": ["$env", "$env/**", "$app", "$app/**"] }, { "groupName": "aliases", "elementNamePattern": ["$*", "$*/**"] }, ], "newlinesBetween": true, },}oxfmt config has no extends (yet), so the file above is what @kitql/eslint-config ships as
defaults - copy it, tweak as needed.
ignore things with
Section titled âignore things withâ.DS_Storenode_modules/build/.svelte-kit/package.env.env.*!.env.example
# Ignore files for PNPM, NPM and YARNpackage.jsonpnpm-lock.yamlpackage-lock.jsonyarn.lock
# Ignore files that are project specific/db/src/lib/ROUTES.tsAdd this to your package.json
Section titled âAdd this to your package.jsonâscripts: { "//// ---- BEST PRACTICES ---- ////": "", "lint": "kitql-lint", "format": "kitql-lint -f",}Picking which tools run
Section titled âPicking which tools runâBy default, kitql-lint runs eslint + prettier. Use --tools (-t) to change that:
# default - eslint + prettierkitql-lint
# add oxlint (with type-aware rules)kitql-lint -t eslint,prettier,oxlint,tsgolint
# đŚ svelte + full oxc - the recommended combo for kitql / sveltekit projects.# oxc handles all the fast paths; eslint + prettier stay around for svelte.kitql-lint -t oxlint,tsgolint,oxfmt,eslint,prettier
# đŚ pure oxc - no eslint, no prettier.# you lose: .svelte linting & formatting, pnpm catalog rules.kitql-lint -t oxlint,tsgolint,oxfmtWhen oxfmt is in the tool set, prettier is auto-restricted to **/*.svelte (oxfmt canât parse
svelte yet); oxfmt handles every other file type. Same logic in any mode.
In the recommended svelte combo, youâll have oxlint and eslint both linting .ts/.js files. To
avoid duplicate work, enable the oxlint integration in your eslint config:
import { kitql } from '@kitql/eslint-config'
export default [...kitql({ oxlint: { enable: true } })]That disables in eslint every rule oxlint already covers - you only pay for the svelte/pnpm rules that oxlint canât replace yet.