Files
harness-lab/products/bhl-cli/eslint.config.mjs
T
Suslov-MD 18e28c9d03 Перенос CLI в продуктовое дерево products/bhl-cli (BHL-067)
packages/bhl/ перенесён целиком в products/bhl-cli/ через git mv: 28
отслеживаемых файлов, в истории — переименования, байты не менялись,
второго экземпляра кода не появилось. Идентичность npm-пакета
@baseline-harness/bhl 0.0.1, bin bhl, engines, files и publishConfig
сохранены; node_modules и dist переехали физически, .gitignore
переведён на products/bhl-cli/dist/. Основание — D-055 и уточнённая
редакция D-028.

Переходная запись products/bhl-cli удалена из products.yaml: проверка
отвергает оставшуюся запись для уже созданного дерева, поэтому удаление
обязательено факту переноса, а не договорённости.

Актуализированы действующие пути: корневые интеграционные тесты
audit-skill, lab-connection, spec-docs и synthetic-spec; AGENTS.md с
командой перегенерации docs/spec; bhl.yaml; README.md со строками
products/ и packages/; packages/README.md, где каталог объявлен пустым
переходным. Относительные ссылки внутри дерева не правились: глубина
packages/bhl/ и products/bhl-cli/ одинакова, ../../spec/ и ../../library/
остались разрешимыми.

Находка о проверке упаковки: npm --prefix <дерево> pack упаковывает пакет
текущего каталога, а не целевого — прогон из корня дал tarball лаборатории
вместо пакета CLI. Проверка артефакта требует рабочего каталога внутри
дерева, чем и занимается tests/pack.test.mjs. Прежняя формулировка о
проверке через --prefix в исторических записях результатов не переписана.

Проверки: местный quality gate из корня и из самого дерева — формат,
ESLint с нулевым порогом предупреждений, строгие типы, 48/48 тестов
зелёные; npm pack → установка tarball во временный каталог → bhl version
отвечает конвертом (23 файла артефакта, тестов в tarball нет); корневые
npm run check — 0 ошибок и 0 предупреждений, npm test — 68/68,
backlog doctor — без дубликатов, самоссылок и циклов.

Остаток: судьба пустого packages/ — решение владельца (BHL-073); строка
AGENTS.md о программе Wave I актуализуется после BHL-068; тестовые
фикстуры переезжают в дерево по BHL-069.
2026-11-30 12:48:31 +03:00

93 lines
3.2 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',
},
},
{
files: ['src/audit.ts'],
rules: {
// git is optional audit metadata resolved from the operator PATH; absence yields
// no revision fields rather than a failure. Scoped to the audit engine only.
'sonarjs/no-os-command-from-path': 'off',
},
},
);