Files
harness-lab/packages/bhl/eslint.config.mjs
T
Suslov-MD 294bf9d68f feat: каркас bhl и валидатор спецификации (BHL-020, BHL-011)
packages/bhl: @baseline-harness/bhl 0.0.1 — детерминированный CLI без
LLM/оркестрации/сервера/БД; JSON-конверт и коды выхода 0/1/2/3/4
задокументированы и закреплены тестами. validate: Ajv 2020-12 по схемам
<root>/schemas, семантическая сверка ID, ссылок, RFC-2119 слов и циклов
depends-on. Местный строгий gate (prettier, eslint --max-warnings 0,
tsc strict) зелёный: 10 тестов.
2026-11-28 20:31:24 +03:00

85 lines
2.9 KiB
JavaScript

import js from '@eslint/js';
import { defineConfig } from 'eslint/config';
import importX from 'eslint-plugin-import-x';
import sonarjs from 'eslint-plugin-sonarjs';
import globals from 'globals';
import tseslint from 'typescript-eslint';
// Adapted from ../../library/code-quality-practices/typescript/work-harness.md
// via experiments/pi-supervisor/eslint.config.mjs.
// Only this package, its tests and this config are in the adoption scope.
const files = ['src/**/*.ts', 'tests/**/*.{ts,mjs}', 'eslint.config.mjs'];
const typedFiles = ['src/**/*.ts', 'tests/**/*.ts'];
export default defineConfig(
{
files,
extends: [js.configs.recommended],
languageOptions: { globals: globals.node },
linterOptions: {
noInlineConfig: true,
reportUnusedDisableDirectives: 'error',
reportUnusedInlineConfigs: 'error',
},
rules: {
'array-callback-return': ['error', { checkForEach: true }],
eqeqeq: ['error', 'always'],
curly: ['error', 'all'],
'no-console': 'error',
'no-eval': 'error',
'no-implicit-coercion': 'error',
'no-promise-executor-return': 'error',
'no-return-assign': ['error', 'always'],
'no-unmodified-loop-condition': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-optional-chaining': 'error',
'prefer-const': 'error',
'prefer-promise-reject-errors': 'error',
},
},
{
files: typedFiles,
extends: [
tseslint.configs.strictTypeChecked,
importX.flatConfigs.recommended,
importX.flatConfigs.typescript,
sonarjs.configs.recommended,
],
languageOptions: {
parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname },
},
settings: {
'import-x/resolver': { typescript: { project: './tsconfig.json' } },
},
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{ fixStyle: 'separate-type-imports' },
],
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-assertions': ['error', { assertionStyle: 'never' }],
'@typescript-eslint/no-floating-promises': [
'error',
{ ignoreVoid: false, ignoreIIFE: false },
],
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/return-await': ['error', 'error-handling-correctness-only'],
'max-lines-per-function': [
'error',
{ max: 80, IIFEs: true, skipBlankLines: true, skipComments: true },
],
'sonarjs/cognitive-complexity': ['error', 10],
},
},
{
files: ['tests/**/*.ts'],
rules: {
// A scenario keeps setup, action and assertions together; production stays at 80.
'max-lines-per-function': 'off',
},
},
);