Skip to content

Commit 3ad4ab6

Browse files
author
Lasim
committed
feat(gateway): configure ESLint and update linting scripts
1 parent a84c552 commit 3ad4ab6

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

.github/workflows/gateway-release-pr.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ jobs:
5757

5858
- name: Gateway Lint
5959
working-directory: services/gateway
60-
run: npm run lint || echo "Linting not configured yet, skipping"
61-
62-
- name: Check for console.log in gateway
63-
working-directory: services/gateway
64-
run: npm run check:no-console || echo "Console check not configured yet, skipping"
60+
run: npm run lint
6561

6662
- name: Prepare release
6763
working-directory: services/gateway

services/gateway/.release-it.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
"publish": false // We handle npm publishing separately in the workflow
1414
},
1515
"hooks": {
16-
"before:init": ["echo 'Preparing gateway release...'"],
16+
"before:init": ["npm run lint"],
1717
"after:bump": "npm run build",
1818
"after:release": "echo 'Gateway ${version} released!'"
1919
},

services/gateway/eslint.config.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// services/gateway/eslint.config.ts
2+
import ts from '@typescript-eslint/eslint-plugin';
3+
import tsParser from '@typescript-eslint/parser';
4+
5+
const config = [
6+
{
7+
files: ['**/*.ts'],
8+
ignores: ['**/node_modules/**', '**/dist/**', '**/._*.ts'],
9+
languageOptions: {
10+
parser: tsParser,
11+
parserOptions: {
12+
project: './tsconfig.json',
13+
ecmaVersion: 2022,
14+
sourceType: 'module',
15+
},
16+
},
17+
plugins: {
18+
'@typescript-eslint': ts,
19+
},
20+
rules: {
21+
...ts.configs.recommended.rules,
22+
// CLI-specific adjustments
23+
'@typescript-eslint/no-explicit-any': 'warn',
24+
'@typescript-eslint/explicit-function-return-type': 'off',
25+
'@typescript-eslint/explicit-module-boundary-types': 'off',
26+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
27+
// Console statements are essential for CLI user interaction
28+
'no-console': 'off',
29+
// Allow process.exit() in CLI applications
30+
'no-process-exit': 'off',
31+
},
32+
}
33+
];
34+
35+
export default config;

services/gateway/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
"dev": "ts-node-dev --respawn src/index.ts",
1313
"link": "npm run build && npm link",
1414
"release": "release-it --config=.release-it.js",
15-
"lint": "echo 'Linting not configured yet'",
16-
"test:unit": "echo 'Tests not implemented yet'",
17-
"check:no-console": "echo 'Console check not configured yet'"
15+
"lint": "eslint --config eslint.config.ts 'src/**/*.ts' --fix",
16+
"test:unit": "echo 'Tests not implemented yet'"
1817
},
1918
"keywords": [
2019
"mcp",
@@ -32,6 +31,10 @@
3231
"ts-node-dev": "^2.0.0",
3332
"typescript": "^5.3.3",
3433
"@release-it/conventional-changelog": "^10.0.1",
35-
"release-it": "^19.0.4"
34+
"release-it": "^19.0.4",
35+
"@typescript-eslint/eslint-plugin": "^8.36.0",
36+
"@typescript-eslint/parser": "^8.38.0",
37+
"eslint": "^9.31.0",
38+
"typescript-eslint": "^8.38.0"
3639
}
3740
}

0 commit comments

Comments
 (0)