Implementation:777genius Agent teams ai Eslint Config
| Knowledge Sources | |
|---|---|
| Domains | Linting, Architecture, Code_Quality |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Comprehensive ESLint flat configuration that enforces code quality, architecture boundaries, import ordering, naming conventions, and security across the entire Agent Teams codebase.
Description
The eslint.config.js file is the root ESLint flat configuration for the Agent Teams project. It integrates over a dozen ESLint plugins — TypeScript-ESLint (type-aware), React, JSX accessibility, Tailwind CSS, SonarJS, security, import sorting, boundaries, and ESLint comments — into a single declarative config.
Key responsibilities:
- Three-process boundary enforcement: Uses `eslint-plugin-boundaries` to ensure the Electron main, preload, and renderer processes only import from their allowed layers (main→main+shared, renderer→renderer+shared, etc.).
- Feature-slice public entrypoints: Enforces that all code imports feature slices (`src/features/*/`) only through their public entrypoints (`@features/*/contracts`, `@features/*/main`, etc.), preventing deep imports into `core/domain` or `core/application` internals.
- Domain purity guards: Prevents feature `core/domain` and `core/application` layers from importing Electron, fastify, child_process, or renderer/main modules — keeping the hexagonal core side-effect free.
- Safe IPC enforcement: Custom AST selectors ban direct `webContents.send(...)` and `event.sender.send(...)` calls in the main process, forcing use of `safeSendToRenderer(...)`.
- Import cycle detection: `import/no-cycle` with `maxDepth: 3` catches circular dependencies early.
- Naming conventions: Comprehensive `@typescript-eslint/naming-convention` rules enforce camelCase for variables/functions, PascalCase for types/interfaces (no `I` prefix), UPPER_CASE for static readonly constants.
- Test file relaxation: Test files get relaxed TypeScript strict rules (allow `any`, non-null assertions, floating promises) for pragmatic test authoring.
- Prettier compatibility: `eslint-config-prettier` is placed last to disable all formatting-conflicting rules.
Usage
Import this configuration implicitly when running `pnpm lint:fix` or any ESLint-based quality gate. The file is consumed automatically by ESLint's flat config resolution — no explicit import is needed in application code.
- Adding new feature slices: Add `no-restricted-imports` guard blocks following the `feature-{name}-*` pattern to enforce public entrypoints and domain purity.
- Adding new ESLint plugins: Add the plugin import at the top, register it in the appropriate `plugins` block, and configure rules in the matching `files` glob block.
- Adjusting rule severity: Modify the rule entry in the `custom-rules` block (for global TS rules) or the process-specific block (for main/preload/renderer-specific rules).
Code Reference
Source Location
- Repository: 777genius_Agent_teams_ai
- File: eslint.config.js
- Lines: 1-1166
Signature
import { defineConfig, globalIgnores } from 'eslint/config';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import tailwindcss from 'eslint-plugin-tailwindcss';
import sonarjs from 'eslint-plugin-sonarjs';
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import importPlugin from 'eslint-plugin-import';
import security from 'eslint-plugin-security';
import boundaries from 'eslint-plugin-boundaries';
import eslintComments from '@eslint-community/eslint-plugin-eslint-comments';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import globals from 'globals';
import { featureOverrides } from './eslint.feature-overrides.mts';
import { gatewayBoundaries } from './eslint.gateway-boundaries.mts';
export default defineConfig([
// Global ignores, base recommended, type-checked TS, SonarJS, security...
// ~30 config blocks covering: boundaries, import sorting, React, a11y,
// Tailwind, test relaxation, custom TS rules, feature guards, Prettier
]);
Import
// No import needed — ESLint auto-discovers eslint.config.js in the project root.
// To run: pnpm lint:fix
// To check only: npx eslint .
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| defineConfig | function | Yes | ESLint flat config helper from `eslint/config` |
| globalIgnores | function | Yes | ESLint helper for declaring globally-ignored file patterns |
| js.configs.recommended | object | Yes | Base ESLint recommended rules |
| tseslint.configs | object | Yes | TypeScript-ESLint type-checked recommended + stylistic configs |
| sonarjs.configs | object | Yes | SonarJS code quality rules |
| security.configs | object | Yes | Security plugin rules for common vulnerabilities |
| reactPlugin | object | Yes | React ESLint plugin with recommended + jsx-runtime rules |
| reactHooks | object | Yes | React Hooks rules (exhaustive-deps, rules-of-hooks) |
| jsxA11y | object | Yes | JSX accessibility recommended rules |
| tailwindcss | object | Yes | Tailwind CSS class validation rules |
| boundaries | object | Yes │ eslint-plugin-boundaries for module boundary enforcement | |
| featureOverrides | function | Yes │ Feature-specific override generator (from `eslint.feature-overrides.mts`) | |
| gatewayBoundaries | array | Yes │ Gateway-specific boundary rules (from `eslint.gateway-boundaries.mts`) | |
| eslintConfigPrettier | object | Yes │ Prettier compatibility config (MUST be last) |
Outputs
| Name | Type | Description |
|---|---|---|
| default export | Linter.Config[] │ Array of flat config objects consumed by ESLint's `defineConfig` | |
| lint results | ESLint.LintResult[] │ Produced at runtime when ESLint runs against the codebase |
Usage Examples
Running the Linter
# Run ESLint with auto-fix across the codebase
pnpm lint:fix
# Run ESLint without fixing (check-only)
npx eslint .
# Run ESLint on a specific file
npx eslint src/main/ipc/teams.ts
Adding a Feature-Slice Boundary Guard
// Inside the defineConfig array, add a new guard block for your feature:
{
name: 'feature-my-feature-core-domain-guards',
files: ['src/features/my-feature/core/domain/**/*.ts'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: [
'@features/my-feature/core/application/**',
'@features/my-feature/main/**',
'@features/my-feature/preload/**',
'@features/my-feature/renderer/**',
'@main/**',
'@renderer/**',
'@preload/**',
'electron',
'child_process',
'node:child_process',
],
message:
'my-feature core/domain must stay side-effect free and cannot depend on application, adapters, infrastructure, or platform code.',
},
],
},
],
},
},
Enforcing Safe IPC in Main Process
// The config bans direct webContents.send() — use safeSendToRenderer instead:
// ❌ BANNED by eslint.config.js
event.sender.send('channel', data);
webContents.send('channel', data);
// ✅ REQUIRED
import { safeSendToRenderer } from '@main/utils/safeWebContentsSend';
safeSendToRenderer(browserWindow, 'channel', data);