// @ts-check import tseslint from "@typescript-eslint/eslint-plugin"; import tsParser from "@typescript-eslint/parser"; import importPlugin from "eslint-plugin-import"; import { fileURLToPath } from "node:url"; import { dirname, join } from "node:path"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); /** @type {import('eslint').Linter.Config[]} */ export default [ { ignores: ["dist/**", "node_modules/**", "coverage/**"], }, { files: ["src/**/*.ts", "test/**/*.ts"], plugins: { "@typescript-eslint": tseslint, import: importPlugin, }, languageOptions: { parser: tsParser, parserOptions: { project: "./tsconfig.test.json", tsconfigRootDir: __dirname, ecmaVersion: 2022, sourceType: "module", }, }, settings: { "import/resolver": { typescript: { project: join(__dirname, "tsconfig.test.json"), }, }, }, rules: { // TypeScript strict promise rules — critical in a TCP server "@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-misused-promises": "error", // General quality "@typescript-eslint/no-explicit-any": "error", "@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, ], "@typescript-eslint/consistent-type-imports": [ "error", { prefer: "type-imports" }, ], // Adapter isolation: core/ must NEVER import from adapters/ "import/no-restricted-paths": [ "error", { basePath: __dirname, zones: [ { target: "src/core", from: "src/adapters", message: "src/core must not import from src/adapters — adapters depend on core, not the reverse.", }, ], }, ], }, }, ];