sh-mcp/eslint.config.js
Adam Moussa 0d1fefb326
Some checks are pending
deploy / deploy (push) Waiting to run
Phase 0b slice: monorepo scaffold + @sh-mcp/shared core + integration packages (#2)
* Phase 0b slice: monorepo scaffold + shared core + integration packages

The 0a-INDEPENDENT code slice (one-shot via af-0b-package-slice workflow: Haiku
scaffold + Sonnet packages, Sonnet fix-to-green). Nothing deploys; no CDK/servers.

- Monorepo scaffold: npm workspaces, strict TS (NodeNext), vitest (80% gate),
  eslint 9 flat config, prettier; ci.yaml/deploy.yaml callers (Node 24, enable-qemu).
- @sh-mcp/shared: transport-agnostic core — Scope/AuthContext/ToolDef, ToolRegistry,
  redact()+maskValue() (PII), OpenAPI 3.1 generator. AUTH STUBBED behind an AuthProvider
  interface (TODO auth-layer-0a); JWT/aud/client_id/JWKS/deny-list deferred per design.md §2.
- 9 integration packages (qbo, google-maps, internal-data, payments, knowledge-base,
  gmail, calendar, tasks, reminders): tools against shared, external deps mocked behind
  injected client interfaces; finance handlers call redact().

Verified green: tsc -b clean, vitest 245/245, eslint 0 errors. Auth mechanism intentionally
deferred until the 0a spike resolves it (G16/§0.4).

* Complete Cognito auth provider + Phase 1 build brief

Finish the WIP CognitoAuthProvider (client_id allow-list as audience
boundary, finance TTL ceiling, deny-list, scope-prefix stripping) with
its test suite, and check in docs/build-plan-phase-1.md so the Phase 1
work has its governing brief in-tree (design.md §2.5).

* ci: disable cdk synth for Phase 0b (no CDK app yet)

The reusable ci-typescript-cdk workflow defaults run-cdk-synth: true, but
the Phase 0b package scaffold has no cdk.json or stacks, so cdk synth fails
with '--app is required'. Disable it here; Phase 1 re-enables it with the
server CDK stubs.
2026-06-26 12:42:17 -04:00

133 lines
4.5 KiB
JavaScript

// @ts-check
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
/**
* Flat ESLint config for ESLint 9.x.
* Migrated from .eslintrc.cjs which required legacy mode.
*
* Rules mirror the original: recommended + recommended-requiring-type-checking
* plus project-specific overrides.
*/
/** @type {import('eslint').Linter.Config[]} */
const config = [
// ── Global ignores ──────────────────────────────────────────────────────────
{
ignores: [
'**/dist/**',
'**/node_modules/**',
'**/*.d.ts',
'eslint.config.js',
'vitest.config.ts',
],
},
// ── Source files (with project-based type checking) ─────────────────────────
{
files: ['packages/*/src/**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
project: [
'./packages/calendar/tsconfig.json',
'./packages/gmail/tsconfig.json',
'./packages/google-maps/tsconfig.json',
'./packages/internal-data/tsconfig.json',
'./packages/knowledge-base/tsconfig.json',
'./packages/payments/tsconfig.json',
'./packages/qbo/tsconfig.json',
'./packages/reminders/tsconfig.json',
'./packages/shared/tsconfig.json',
'./packages/tasks/tsconfig.json',
],
tsconfigRootDir: import.meta.dirname,
},
globals: {
process: 'readonly',
console: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
'no-undef': 'off', // TypeScript handles this
'no-unused-vars': 'off', // Use @typescript-eslint version
// Core @typescript-eslint/recommended rules
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-duplicate-enum-values': 'error',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-extra-non-null-assertion': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/prefer-as-const': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
// Type-checked rules (require-type-checking)
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/no-unsafe-argument': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
// Project-specific overrides
'@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'@typescript-eslint/strict-boolean-expressions': 'warn',
},
},
// ── Test files (no project-based type checking — test/ dirs not in tsconfig) ─
{
files: ['packages/*/test/**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
// No `project` here — avoids "file not found in project" errors for
// test files that are excluded from the package tsconfigss.
// Type-checking rules are disabled below.
},
globals: {
process: 'readonly',
console: 'readonly',
},
},
plugins: {
'@typescript-eslint': tseslint,
},
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
},
];
export default config;