chore(FR-2790): add ESLint flat config to backend.ai-client#7204
chore(FR-2790): add ESLint flat config to backend.ai-client#7204
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
Adds an ESLint 9 flat configuration to packages/backend.ai-client (reusing the repo’s shared eslint-config-bai) and makes a few small source tweaks to satisfy/align with the new linting rules in this package.
Changes:
- Add
packages/backend.ai-client/eslint.config.js(flat config) extendingeslint-config-baiwith a few package-specific rule overrides and type-aware linting settings. - Update
packages/backend.ai-client/package.jsonto use the flat config and add required dev dependencies. - Minor lint-driven code adjustments in the client library (safer
hasOwnPropertyusage, type tweak, regex simplification).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/backend.ai-client/src/resources/pipeline.ts | Adjusts token presence check to avoid no-prototype-builtins pattern. |
| packages/backend.ai-client/src/client.ts | Tweaks execute() options parameter type and a slugify regex. |
| packages/backend.ai-client/package.json | Adds flat-config-related dev deps and updates lint script. |
| packages/backend.ai-client/eslint.config.js | Introduces ESLint flat config extending shared base + rule overrides. |
Comments suppressed due to low confidence (1)
packages/backend.ai-client/src/resources/pipeline.ts:50
Pipeline.login()always resolvesfalseeven when a token is returned (it sets the cookie and then still returnsfalse). This makes successful logins indistinguishable from failures. Align this with the node client implementation by resolvingtruewhen the token exists.
if (!Object.prototype.hasOwnProperty.call(result, 'token')) {
return Promise.resolve(false);
} else {
const token = result.token;
document.cookie = `${this.tokenName}=${token}; path=/`;
return Promise.resolve(false);
}
32cce11 to
be19d10
Compare
|
Re: Copilot's suppressed comment on |

Resolves #7197(FR-2790)
Epic: FR-2792 (backend.ai-client production readiness)
Summary
Adds an ESLint 9 flat config to
packages/backend.ai-client/so the existingpnpm lintscript (and thereforeprepublishOnly) actually validates the source. Without this, lint either no-ops or picks up an unrelated config andprepublishOnlyis a misleading green light.Changes
packages/backend.ai-client/eslint.config.js— flat config (type: module) extendingeslint-config-baibase, with package-specific overrides:@typescript-eslint/consistent-type-imports:error@typescript-eslint/no-floating-promises:error(withparserOptions.projectServicefor type info)@typescript-eslint/no-explicit-any:warn(overrides the sharedbase'soff; the strict-typing pass is intentionally a separate ticket so existinganyuse is visible but not blocking)**/*.test.tsfiles relaxno-floating-promisesandno-explicit-any.package.json— drops--max-warnings=0from thelintscript (warnings are expected during the strict-typing migration), adds@eslint/js(catalog),eslint-config-bai(workspace), andtypescript-eslint(catalog) as devDependencies.src/client.ts—Object→objectparameter type;[^\w\-]→[^\w-](unnecessary escape).src/client.ts—opts: object = {}default to match the JSDoc-declared optionality.src/resources/pipeline.ts—result.hasOwnProperty('token')→Object.prototype.hasOwnProperty.call(...)(avoidsno-prototype-builtins).Lint status
pnpm --filter backend.ai-client lint— 0 errors, 242 warnings (exit 0). All 242 warnings areno-explicit-anyfrom pre-existing: anyannotations and are explicitly out of scope.Out of scope
any(separate epic — there are 242 of them).tsconfig.strict(separate ticket).Pipeline.login(always returnsfalseeven on success) — filed as FR-2793 under the same Epic, since it's pre-existing inorigin/mainand not introduced by this PR.Verification
pnpm --filter backend.ai-client lint— 0 errors / 242 warnings.pnpm --filter backend.ai-client test— 4/4 pass.pnpm --filter backend.ai-client build— ESM 174.99 KB + DTS 65.36 KB.bash scripts/verify.sh— Relay/Lint/Format pass; TypeScript pre-existing errors are unrelated.