Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions packages/backend.ai-client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { base } from 'eslint-config-bai';

export default [
...base,

{
ignores: ['dist/**'],
},

{
rules: {
// Enforce `import type` for type-only imports.
'@typescript-eslint/consistent-type-imports': 'error',
// Surface real bugs from un-awaited promises.
'@typescript-eslint/no-floating-promises': 'error',
// Existing code has many `any`s; a strict-typing pass is tracked
// separately under the FR-2792 epic. Keep as warn (overrides the
// shared base which currently turns this rule off entirely) so
// the noise is visible without being a publish-blocker.
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_' },
],
},
languageOptions: {
parserOptions: {
// `no-floating-promises` requires type information.
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},

// Tests: relax the strictest rules so test scaffolding (e.g. mock
// objects typed as `any`, intentionally fire-and-forget assertions)
// does not block `prepublishOnly`.
{
files: ['**/*.test.ts'],
rules: {
'@typescript-eslint/no-floating-promises': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
},
];
5 changes: 4 additions & 1 deletion packages/backend.ai-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,18 @@
"test": "vitest run",
"vitest": "vitest run",
"vitest:watch": "vitest",
"lint": "eslint ./src --max-warnings=0",
"lint": "eslint ./src",
"prepublishOnly": "pnpm lint && pnpm test && pnpm build"
},
"dependencies": {
"crypto-es": "^2.1.0"
},
"devDependencies": {
"@eslint/js": "catalog:",
"eslint-config-bai": "workspace:*",
"tsup": "^8.5.0",
"typescript": "^5.9.3",
"typescript-eslint": "catalog:",
"vitest": "^4.1.4"
},
"type": "module"
Expand Down
4 changes: 2 additions & 2 deletions packages/backend.ai-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ export class Client {
runId: string,
mode: string,
code: string,
opts: Object,
opts: object = {},
timeout = 0,
): Promise<any> {
let params = {
Expand Down Expand Up @@ -1865,7 +1865,7 @@ export class Client {
.replace(/\s+/g, '-') // Replace spaces with -
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special chars
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/[^\w-]+/g, '') // Remove all non-word chars
.replace(/--+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
Expand Down
2 changes: 1 addition & 1 deletion packages/backend.ai-client/src/resources/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Pipeline {
}),
});
// if there's no token, then user account is invalid
if (!result.hasOwnProperty('token')) {
if (!Object.prototype.hasOwnProperty.call(result, 'token')) {
return Promise.resolve(false);
} else {
const token = result.token;
Expand Down
Loading