Skip to content
Closed
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
17 changes: 0 additions & 17 deletions clients/typescript/.eslintignore

This file was deleted.

45 changes: 0 additions & 45 deletions clients/typescript/.eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions clients/typescript/.eslintrc.test.js

This file was deleted.

2 changes: 2 additions & 0 deletions clients/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
A robust TypeScript client library for the ContextForge Memory API with
comprehensive error handling, retry logic, and full type safety.

<!-- Updated to trigger CI -->

## Features

- **Full Type Safety**: Complete TypeScript definitions for all API types
Expand Down
86 changes: 86 additions & 0 deletions clients/typescript/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import js from '@eslint/js';
import typescript from '@typescript-eslint/eslint-plugin';
import typescriptParser from '@typescript-eslint/parser';
import globals from 'globals';
import prettier from 'eslint-config-prettier';

// Shared TypeScript rules used by both base and test configurations
const sharedTypeScriptRules = {
...typescript.configs.recommended.rules,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/explicit-function-return-type': ['error', {
allowExpressions: true,
allowTypedFunctionExpressions: true
}],
// Enforce explicit return types for exported/public APIs
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/strict-boolean-expressions': ['error', {
allowNullableObject: true
}],
'prefer-const': 'error',
'no-var': 'error',
'no-unused-vars': 'off', // Turn off base rule as it can conflict with @typescript-eslint/no-unused-vars
};

// Shared globals used by both base and test configurations
const sharedGlobals = {
...globals.node,
...globals.browser,
URL: 'readonly',
Response: 'readonly',
RequestInit: 'readonly',
AbortController: 'readonly',
};

export default [
js.configs.recommended,
prettier,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.json',
},
globals: sharedGlobals,
},
plugins: {
'@typescript-eslint': typescript,
},
rules: sharedTypeScriptRules,
},
{
files: ['tests/**/*.ts', '**/*.test.ts', '**/*.spec.ts'],
languageOptions: {
parser: typescriptParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
project: './tsconfig.test.json',
},
globals: {
...sharedGlobals,
...globals.jest,
global: 'readonly',
Headers: 'readonly',
},
},
plugins: {
'@typescript-eslint': typescript,
},
rules: sharedTypeScriptRules,
},
{
ignores: [
'dist/**',
'node_modules/**',
'coverage/**',
'*.js',
'*.mjs',
Comment on lines +82 to +83
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Overly broad ignore pattern excludes all JavaScript files.

The current ignore pattern *.js and *.mjs excludes ALL JavaScript files from linting, including:

  • This ESLint config file itself (eslint.config.js)
  • Jest configuration (jest.config.js)
  • Build scripts (scripts/dev.js, scripts/prepare.js)

This prevents quality checks on configuration and tooling files that should be linted.

Consider replacing with more specific patterns that only ignore generated/compiled files:

   ignores: [
     'dist/**',
     'node_modules/**',
     'coverage/**',
-    '*.js',
-    '*.mjs',
+    'dist/**/*.js',
+    'build/**/*.js',
   ],

Or add a separate configuration block for .js and .mjs files if they should be linted with different rules:

+  {
+    files: ['*.js', '*.mjs', 'scripts/**/*.js'],
+    languageOptions: {
+      ecmaVersion: 2020,
+      sourceType: 'module',
+      globals: sharedGlobals,
+    },
+    rules: {
+      ...js.configs.recommended.rules,
+      'prefer-const': 'error',
+      'no-var': 'error',
+    },
+  },
   {
     ignores: [
       'dist/**',
       'node_modules/**',
       'coverage/**',
-      '*.js',
-      '*.mjs',
     ],
   },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'*.js',
'*.mjs',
'dist/**',
'node_modules/**',
'coverage/**',
'dist/**/*.js',
'build/**/*.js',
🤖 Prompt for AI Agents
In clients/typescript/eslint.config.js around lines 82-83, the ignore patterns
'*.js' and '*.mjs' are too broad and exclude all JavaScript files (including
config and build scripts); replace those broad patterns with targeted ignores
for generated/compiled artifacts (e.g., dist/**, build/**, coverage/**,
**/*.min.js) and remove the general '*.js'/'*.mjs' entries, or alternatively add
an ESLint override block that explicitly includes and configures linting rules
for .js and .mjs files (so config/tools files are linted while generated outputs
remain ignored).

],
},
];
2 changes: 1 addition & 1 deletion clients/typescript/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
preset: 'ts-jest/presets/default-esm',
globals: {
'ts-jest': {
Expand Down
45 changes: 32 additions & 13 deletions clients/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion clients/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@contextforge/memory-client",
"version": "0.1.0",
"type": "module",
"description": "TypeScript client for ContextForge Memory API with v0 and v1 support",
"main": "dist/index.js",
"module": "dist/index.esm.js",
Expand Down Expand Up @@ -60,7 +61,6 @@
"engines": {
"node": ">=18.0.0"
},
"peerDependencies": {},
"devDependencies": {
"@rollup/plugin-node-resolve": "^16.0.0",
"@rollup/plugin-terser": "^0.4.4",
Expand All @@ -69,6 +69,8 @@
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"globals": "^16.4.0",
"husky": "^9.0.0",
"jest": "^30.0.0",
"prettier": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion clients/typescript/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default defineConfig([
tsconfig: './tsconfig.json',
declaration: true,
declarationMap: true,
outDir: 'dist/types'
declarationDir: 'dist/types'
}),
terser()
],
Expand Down
10 changes: 7 additions & 3 deletions clients/typescript/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@
* node scripts/dev.js pre-publish - Run pre-publish checks/tasks
*/

const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Validate we're in the package root
const packageJsonPath = path.join(__dirname, '..', 'package.json');
Expand Down
10 changes: 7 additions & 3 deletions clients/typescript/scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
* Runs before npm install to ensure proper setup
*/

import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

console.log('Preparing TypeScript client...');

// Ensure dist directory exists
const fs = require('fs');
const path = require('path');

const distDir = path.join(__dirname, '..', 'dist');
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, { recursive: true });
Expand Down
Loading