Skip to content

Commit 3476edf

Browse files
authored
Chore/repo audit 2025 09 16 (#6)
* chore: audit and refactor per standards - Break all circular dependencies by using specific imports - Consolidate duplicate interfaces - Remove redundant barrel files - Ensure no cycles with madge check * refactor: remove index.ts barrels, update imports, add back selective barrels - Removed all index.ts files and updated all imports to direct paths - Consolidated duplicate interfaces - Added back index.ts barrels exporting only necessary items for external use - Fixed import of 'util' to use local guards - Ensured no circular dependencies and green TypeScript compilation * Refactor code structure for improved readability and maintainability * Refactor code structure for improved readability and maintainability * refactor: streamline guards test structure by removing redundant code * chore: update ESLint and Jest configurations for improved testing setup
1 parent 30a92b7 commit 3476edf

40 files changed

+2492
-1050
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 42 deletions
This file was deleted.

eslint.config.js

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
import js from '@eslint/js';
2+
import tseslint from '@typescript-eslint/eslint-plugin';
3+
import tsparser from '@typescript-eslint/parser';
4+
import importPlugin from 'eslint-plugin-import';
5+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
6+
import unusedImports from 'eslint-plugin-unused-imports';
7+
8+
export default [
9+
js.configs.recommended,
10+
{
11+
ignores: ['dist/**', '.yarn/**', 'node_modules/**', 'coverage/**', '__mocks__/**'],
12+
},
13+
{
14+
files: ['src/**/*.ts'],
15+
languageOptions: {
16+
parser: tsparser,
17+
parserOptions: {
18+
project: ['./tsconfig.json', './tsconfig.spec.json'],
19+
ecmaVersion: 'latest',
20+
sourceType: 'module',
21+
},
22+
globals: {
23+
console: 'readonly',
24+
process: 'readonly',
25+
Buffer: 'readonly',
26+
__dirname: 'readonly',
27+
__filename: 'readonly',
28+
NodeJS: 'readonly',
29+
setInterval: 'readonly',
30+
clearInterval: 'readonly',
31+
},
32+
},
33+
plugins: {
34+
'@typescript-eslint': tseslint,
35+
'simple-import-sort': simpleImportSort,
36+
import: importPlugin,
37+
'unused-imports': unusedImports,
38+
},
39+
rules: {
40+
...tseslint.configs.recommended.rules,
41+
'@typescript-eslint/no-explicit-any': 'error',
42+
'@typescript-eslint/explicit-function-return-type': 'error',
43+
'@typescript-eslint/strict-boolean-expressions': 'off',
44+
'@typescript-eslint/no-unused-vars': [
45+
'error',
46+
{
47+
argsIgnorePattern: '^_',
48+
varsIgnorePattern: '^_',
49+
},
50+
],
51+
'simple-import-sort/imports': 'error',
52+
'simple-import-sort/exports': 'error',
53+
'import/no-unused-modules': ['off', { unusedExports: true }],
54+
'no-console': ['error', { allow: ['warn', 'error'] }],
55+
'unused-imports/no-unused-imports': 'error',
56+
'unused-imports/no-unused-vars': [
57+
'warn',
58+
{
59+
vars: 'all',
60+
varsIgnorePattern: '^_',
61+
args: 'after-used',
62+
argsIgnorePattern: '^_',
63+
},
64+
],
65+
},
66+
settings: {
67+
'import/resolver': {
68+
typescript: {},
69+
},
70+
},
71+
},
72+
{
73+
files: ['src/**/*.test.ts'],
74+
languageOptions: {
75+
parser: tsparser,
76+
parserOptions: {
77+
project: ['./tsconfig.json', './tsconfig.spec.json'],
78+
ecmaVersion: 'latest',
79+
sourceType: 'module',
80+
},
81+
globals: {
82+
console: 'readonly',
83+
process: 'readonly',
84+
Buffer: 'readonly',
85+
__dirname: 'readonly',
86+
__filename: 'readonly',
87+
NodeJS: 'readonly',
88+
setInterval: 'readonly',
89+
clearInterval: 'readonly',
90+
// Jest globals
91+
describe: 'readonly',
92+
it: 'readonly',
93+
test: 'readonly',
94+
expect: 'readonly',
95+
beforeEach: 'readonly',
96+
afterEach: 'readonly',
97+
beforeAll: 'readonly',
98+
afterAll: 'readonly',
99+
jest: 'readonly',
100+
},
101+
},
102+
plugins: {
103+
'@typescript-eslint': tseslint,
104+
'simple-import-sort': simpleImportSort,
105+
import: importPlugin,
106+
'unused-imports': unusedImports,
107+
},
108+
rules: {
109+
...tseslint.configs.recommended.rules,
110+
'@typescript-eslint/no-explicit-any': 'error',
111+
'@typescript-eslint/explicit-function-return-type': 'error',
112+
'@typescript-eslint/strict-boolean-expressions': 'off',
113+
'@typescript-eslint/no-unused-vars': [
114+
'error',
115+
{
116+
argsIgnorePattern: '^_',
117+
varsIgnorePattern: '^_',
118+
},
119+
],
120+
'simple-import-sort/imports': 'error',
121+
'simple-import-sort/exports': 'error',
122+
'import/no-unused-modules': ['off', { unusedExports: true }],
123+
'no-console': ['error', { allow: ['warn', 'error'] }],
124+
'unused-imports/no-unused-imports': 'error',
125+
'unused-imports/no-unused-vars': [
126+
'warn',
127+
{
128+
vars: 'all',
129+
varsIgnorePattern: '^_',
130+
args: 'after-used',
131+
argsIgnorePattern: '^_',
132+
},
133+
],
134+
'import/no-extraneous-dependencies': ['error', { devDependencies: ['**/*.test.ts'] }],
135+
},
136+
settings: {
137+
'import/resolver': {
138+
typescript: {},
139+
},
140+
},
141+
},
142+
];

jest.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} **/
22
export default {
33
preset: 'ts-jest/presets/default-esm',
4-
testEnvironment: 'node',
4+
testEnvironment: 'jest-environment-node',
5+
setupFilesAfterEnv: ['<rootDir>/src/test/setup.ts'],
56
extensionsToTreatAsEsm: ['.ts'],
67
moduleNameMapper: {
78
'^(\\.{1,2}/.*)\\.js$': '$1',

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,39 @@
33
"dependencies": {
44
"@backstage/catalog-client": "^1.9.1",
55
"@backstage/catalog-model": "^1.7.3",
6-
"@modelcontextprotocol/sdk": "^1.10.2",
7-
"axios": "^1.9.0",
6+
"@modelcontextprotocol/sdk": "^1.18.0",
7+
"axios": "^1.12.2",
88
"pino": "^9.9.5",
99
"pino-pretty": "^13.1.1",
1010
"reflect-metadata": "^0.2.2",
1111
"yarn": "^1.22.22",
12-
"zod": "^3.22.2"
12+
"zod": "^4.1.9"
1313
},
1414
"devDependencies": {
15-
"@jest/globals": "^29.7.0",
15+
"@jest/globals": "^30.1.2",
1616
"@types/express": "^5.0.3",
17-
"@types/jest": "^29.5.14",
18-
"@types/node": "^22.0.0",
19-
"@typescript-eslint/eslint-plugin": "^8.43.0",
20-
"@typescript-eslint/parser": "^8.43.0",
17+
"@types/jest": "^30.0.0",
18+
"@types/node": "^24.5.1",
19+
"@typescript-eslint/eslint-plugin": "^8.44.0",
20+
"@typescript-eslint/parser": "^8.44.0",
2121
"dependency-cruiser": "^17.0.1",
22-
"esbuild": "^0.18.18",
23-
"eslint": "^8.57.0",
24-
"eslint-config-prettier": "^9.0.0",
22+
"esbuild": "^0.25.9",
23+
"eslint": "^9.35.0",
24+
"eslint-config-prettier": "^10.1.8",
2525
"eslint-import-resolver-typescript": "^4.4.4",
2626
"eslint-plugin-import": "^2.32.0",
27-
"eslint-plugin-simple-import-sort": "^10.0.0",
27+
"eslint-plugin-simple-import-sort": "^12.1.1",
2828
"eslint-plugin-unused-imports": "^4.2.0",
29-
"jest": "^29.7.0",
30-
"jest-util": "^29.7.0",
29+
"jest": "^30.1.3",
30+
"jest-util": "^30.0.5",
3131
"jscpd": "^4.0.5",
3232
"madge": "^8.0.0",
33-
"prettier": "^3.5.3",
34-
"rimraf": "^5.0.0",
35-
"ts-jest": "^29.3.2",
33+
"prettier": "^3.6.2",
34+
"rimraf": "^6.0.1",
35+
"ts-jest": "^29.4.2",
3636
"ts-morph": "^27.0.0",
3737
"ts-node": "^10.9.2",
38-
"typescript": "^5.8.3"
38+
"typescript": "^5.9.2"
3939
},
4040
"main": "dist/bundle.cjs",
4141
"name": "@coderrob/mcp-backstage-server",

0 commit comments

Comments
 (0)