@kachkaev/eslint-config-base
v1.1.1
Published
A collection of carefully picked ESLint rules and plugins for TypeScript projects.
Readme
@kachkaev → eslint config (base)
A collection of carefully picked ESLint rules and plugins for TypeScript projects.
Compatible with ESLint v9+ (Flat config). Requires TypeScript to be present as a dependency.
See also @kachkaev/eslint-config-next.
Principles
This configuration uses warnings for rules that are related to code style (the ones that are not likely to prevent runtime errors), and errors otherwise.
This looks less noisy than using errors for all rules.
Both severity levels fail CI when eslint is called with --max-warnings=0.
It is assumed that all files are written in TypeScript and use ESM (not CommonJS).
Adding to project
Ensure your
package.jsoncontains"type": "module".Ensure your project has a
tsconfig.jsonfile.Install these packages as dev dependencies:
## If you use NPM npm install -D eslint @kachkaev/eslint-config-base ## If you use PNPM pnpm add -D eslint @kachkaev/eslint-config-base ## If you use Yarn yarn add -D eslint @kachkaev/eslint-config-baseIf you don't keep your Node.js runtime up-to-date, you might need to install
jitito enable*.tsfiles -- see ESLint docs for details.Create
eslint.config.tswith the following contents:import { defineConfig } from "eslint/config"; import { generateBaseConfigs } from "@kachkaev/eslint-config-base"; export default defineConfig([ ...generateBaseConfigs(), // ... Place additional configs here if needed ... ]);If you work in a monorepo, you may need to specify
tsconfigRootDirfor some rules to work correctly:- generateBaseConfigs(); + generateBaseConfigs({ tsconfigRootDir: import.meta.dirname });Add
package.jsonscripts:{ "...": "...", "scripts": { "...": "...", "fix:eslint": "eslint --max-warnings=0 --fix", "...": "...", "lint:eslint": "eslint --max-warnings=0", "...": "..." } }
You can now run [npm/pnpm/yarn] run fix:eslint to lint your code and [npm/pnpm/yarn] run lint:eslint to fix linting errors.
