Pragmatic ESLint config for robust collaboration
- Exhaustive flat configs for ESLint v9+
- Distinct severities
- Error on potential bugs, ambiguities and unsafe/legacy constructs
- Warn about incompletions, lack of affordance and unification opportunities
- Composable entry points
Install as a dev dependency alongside ESLint and predefined global variables:
pnpm add -D @kripod/eslint-config
pnpm add -D eslint globals
Set up ESLint with presets documented below:
// eslint.config.js
import baseConfig from "@kripod/eslint-config/base";
import typeCheckedConfig from "@kripod/eslint-config/type-checked";
import globals from "globals";
/** @type {import("eslint").Linter.Config[]} */
export default [
{ files: ["**/*.jsx", "**/*.ts", "**/*.mts", "**/*.cts", "**/*.tsx"] },
{ ignores: ["dist/"] },
...baseConfig,
...typeCheckedConfig,
{
languageOptions: {
globals: {
...globals.node,
},
},
},
];
If using TypeScript, consider adopting @total-typescript/tsconfig
or:
- Enable
strictNullChecks
or the broaderstrict
compiler option - Set
module
toPreserve
orNodeNext
, as package entry points may fail to resolve otherwise
base
— JS + TS, no framework-specific rulestype-checked
— Typed linting via project service
Package scripts may be added for convenience:
// package.json
{
"scripts": {
"lint:js+ts": "eslint",
"lint:fix:js+ts": "eslint --fix",
},
}