Skip to content

Add ESLint flat config to backend.ai-client package #7197

@yomybaby

Description

@yomybaby

Context

packages/backend.ai-client/package.json declares:

"lint": "eslint ./src --max-warnings=0",
"prepublishOnly": "pnpm lint && pnpm test && pnpm build"

There is no eslint.config.js (or any .eslintrc*) inside the package. Depending on how ESLint resolves config, the lint script either no-ops or picks up the repo root config and applies React/JSX rules that do not match a TypeScript-only library. Either way, prepublishOnly is currently giving a misleading green light.

Scope

  • Add packages/backend.ai-client/eslint.config.js (flat config, ESM)
  • Use the shared packages/eslint-config-bai if it has a non-React preset, otherwise extend @eslint/js + typescript-eslint directly
  • Recommended initial rule set:
    • @typescript-eslint/recommended
    • @typescript-eslint/consistent-type-imports: error
    • no-floating-promises (or @typescript-eslint/no-floating-promises): error
    • @typescript-eslint/no-explicit-any: warn (kept as warn for now — strict typing pass is a separate ticket)
  • Ignore dist/, *.test.ts for the strict subset if needed
  • Confirm pnpm --filter backend.ai-client lint runs and reports honestly (warnings allowed but no errors)

Verification

  • pnpm --filter backend.ai-client lint exits 0 with the new config (after fixing only quick wins; any warnings expected)
  • bash scripts/verify.sh passes
  • New errors introduced afterwards would actually fail prepublishOnly

Out of scope

  • Removing all any (separate issue, large scope)
  • Tightening tsconfig.strict (separate issue)

JIRA Issue: FR-2790

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions