Shared ESLint configuration to be used across the Kleros v2 monorepo.
Workspaces that don't need custom rules can use the default config with a one-line eslint.config.mjs:
export { default } from "@kleros/kleros-v2-eslint-config/flat.config.mjs";ESLint 9 requires the flat config format (eslint.config.*) and no longer reads legacy .eslintrc files automatically. flat.config.mjs uses FlatCompat to translate the legacy .eslintrc.js into a flat config, so the existing rules continue to apply.
- Parser:
@typescript-eslint/parser parserOptions.ecmaVersion:2020- Environments enabled:
browser,node,es6,es2020,mocha
eslint:recommended— ESLint's built-in baseline rulesplugin:@typescript-eslint/recommended— TypeScript-aware rulesplugin:prettier/recommended— runs Prettier as an ESLint rule and disables conflicting style rulesplugin:import/recommended— import/export hygiene
@typescript-eslint, prettier, import, n (Node).
| Rule | Setting | Why |
|---|---|---|
no-unused-vars |
off |
Replaced by the TS-aware variant. |
@typescript-eslint/no-unused-vars |
error, with varsIgnorePattern / argsIgnorePattern |
Prefix a name with _ (e.g. _unused, _1) or use an ignored / Ignored suffix to deliberately silence the rule for intentional placeholders. |
prettier/prettier |
error |
Formatting violations fail lint. |
import/no-unresolved |
error, commonjs: true |
Catches imports that won't resolve at runtime, including CJS require paths. |
n/no-unsupported-features/es-syntax |
error, ignores: ["modules"] |
Flags ES syntax not supported by the configured Node target, but allows ES modules. |
n/no-missing-import |
off |
Resolution is handled by import/no-unresolved + the TS resolver. |
Imports are resolved via:
eslint-import-resolver-typescript(uses each workspace'stsconfig.json)- Node resolver, with extensions
.js,.jsx,.ts,.tsx