Skip to content

Pragmatic ESLint config for robust collaboration

License

Notifications You must be signed in to change notification settings

kripod/eslint-config

Repository files navigation

@kripod/eslint-config

Pragmatic ESLint config for robust collaboration

npm version GitHub Sponsors

Principles

  • 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

Usage

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 broader strict compiler option
  • Set module to Preserve or NodeNext, as package entry points may fail to resolve otherwise

Presets

Additional setup

Package scripts may be added for convenience:

// package.json
{
  "scripts": {
    "lint:js+ts": "eslint",
    "lint:fix:js+ts": "eslint --fix",
  },
}