rpg-combat-pi-01/eslint.config.js
Willem van den Ende e267c35e55 refactor(story1): clean story boundaries, introduce CharacterState record type, tighten ESLint
- Introduce CharacterState value object to group character properties
  → Character constructor reduced from 5 to 1 parameter
- Introduce Faction value type (previously bare string)
- Remove cross-story methods: isAllyOf, isAlive, isDead, add, isMax, next, diff
- Remove misleading level parameter from Health.create
- Remove trivial invariant tests (dead-code paths on fresh characters)
- Move cross-cutting invariants out of character-creation.allium
- ESLint: forbid unused params (remove argsIgnorePattern), max-params=5
- null parameters enforced by TypeScript strictNullChecks (tsconfig)
2026-06-12 20:32:44 +01:00

81 lines
2.2 KiB
JavaScript

import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
export default tseslint.config(
{ ignores: ['dist', 'node_modules', 'coverage', 'allium-main'] },
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['src/**/*.ts'],
extends: [...tseslint.configs.recommendedTypeChecked],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
'@typescript-eslint/switch-exhaustiveness-check': 'warn',
'@typescript-eslint/no-unnecessary-condition': 'warn',
},
},
{
rules: {
complexity: ['warn', 12],
'max-depth': ['warn', 4],
'max-params': ['warn', 5],
'max-lines-per-function': [
'warn',
{ max: 60, skipBlankLines: true, skipComments: true, IIFEs: true },
],
'no-else-return': ['warn', { allowElseIf: false }],
'no-lonely-if': 'warn',
'no-param-reassign': ['warn', { props: false }],
eqeqeq: ['warn', 'always', { null: 'ignore' }],
'prefer-const': 'warn',
'prefer-template': 'warn',
'object-shorthand': 'warn',
'no-console': 'warn',
'@typescript-eslint/explicit-function-return-type': [
'warn',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
allowDirectConstAssertionInArrowFunctions: true,
allowIIFEs: true,
},
],
'@typescript-eslint/consistent-type-imports': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{ varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-non-null-assertion': 'warn',
// null is forbidden by TypeScript strictNullChecks (tsconfig).
},
},
{
files: ['**/*.test.ts', '**/*.spec.ts'],
rules: {
'max-lines-per-function': 'off',
'max-params': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
},
},
prettier,
);