Skip to content

Commit 1a64796

Browse files
chore: Added linting to error on relative imports and using path aliases (#2506)
1 parent 6747cf9 commit 1a64796

291 files changed

Lines changed: 678 additions & 611 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@hyperdx/common-utils": patch
3+
"@hyperdx/hdx-eval": patch
4+
"@hyperdx/api": patch
5+
"@hyperdx/app": patch
6+
"@hyperdx/cli": patch
7+
---
8+
9+
Removing relative imports and using path aliases

‎packages/api/eslint.config.mjs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ export default [
7474
'prettier/prettier': 'error',
7575
'simple-import-sort/imports': 'error',
7676
'simple-import-sort/exports': 'error',
77+
'no-restricted-imports': [
78+
'error',
79+
{
80+
patterns: [
81+
{
82+
regex: '^\\.\\.(/|$)',
83+
message:
84+
'Use the @/ path alias instead of parent-relative imports (../).',
85+
},
86+
],
87+
},
88+
],
7789
},
7890
languageOptions: {
7991
parser: tseslint.parser,

‎packages/api/scripts/generate-api-docs.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from 'fs';
22
import path from 'path';
33
import swaggerJsdoc from 'swagger-jsdoc';
44

5+
// eslint-disable-next-line no-restricted-imports -- run via ts-node without tsconfig-paths, so @/ does not resolve here
56
import { swaggerOptions } from '../src/utils/swagger';
67

78
const specs = swaggerJsdoc(swaggerOptions);

‎packages/api/src/mcp/__tests__/alerts.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ import {
88
getLoggedInAgent,
99
getServer,
1010
} from '@/fixtures';
11+
import { McpContext } from '@/mcp/tools/types';
1112
import Alert, { AlertState } from '@/models/alert';
1213
import Connection from '@/models/connection';
1314
import Dashboard from '@/models/dashboard';
1415
import { SavedSearch } from '@/models/savedSearch';
1516
import { Source } from '@/models/source';
1617
import Webhook, { WebhookService } from '@/models/webhook';
1718

18-
import { McpContext } from '../tools/types';
1919
import { callTool, createTestClient, getFirstText } from './mcpTestUtils';
2020

2121
describe('MCP Alert Tools', () => {

‎packages/api/src/mcp/__tests__/dashboards/deleteDashboard.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { callTool, getFirstText } from '@/mcp/__tests__/mcpTestUtils';
12
import Dashboard from '@/models/dashboard';
23

3-
import { callTool, getFirstText } from '../mcpTestUtils';
44
import { setupDashboardTests } from './setup';
55

66
describe('MCP Dashboard Tools - clickstack_delete_dashboard', () => {

‎packages/api/src/mcp/__tests__/dashboards/getDashboard.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { callTool, getFirstText } from '@/mcp/__tests__/mcpTestUtils';
12
import Dashboard from '@/models/dashboard';
23

3-
import { callTool, getFirstText } from '../mcpTestUtils';
44
import { setupDashboardTests } from './setup';
55

66
describe('MCP Dashboard Tools - clickstack_get_dashboard', () => {

‎packages/api/src/mcp/__tests__/dashboards/getDashboardTile.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { callTool, getFirstText } from '@/mcp/__tests__/mcpTestUtils';
12
import Dashboard from '@/models/dashboard';
23

3-
import { callTool, getFirstText } from '../mcpTestUtils';
44
import { setupDashboardTests } from './setup';
55

66
describe('MCP Dashboard Tools - clickstack_get_dashboard_tile', () => {

‎packages/api/src/mcp/__tests__/dashboards/patchDashboard.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { callTool, getFirstText } from '@/mcp/__tests__/mcpTestUtils';
12
import Dashboard from '@/models/dashboard';
23
import type { ExternalDashboardTileWithId } from '@/utils/zod';
34

4-
import { callTool, getFirstText } from '../mcpTestUtils';
55
import { setupDashboardTests } from './setup';
66

77
describe('MCP Dashboard Tools - clickstack_patch_dashboard', () => {

‎packages/api/src/mcp/__tests__/dashboards/prompts.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {
22
buildCreateDashboardPrompt,
33
buildDashboardExamplesPrompt,
44
buildQueryGuidePrompt,
5-
} from '../../prompts/dashboards/content';
6-
import { buildSourceSummary } from '../../prompts/dashboards/helpers';
5+
} from '@/mcp/prompts/dashboards/content';
6+
import { buildSourceSummary } from '@/mcp/prompts/dashboards/helpers';
77

88
describe('MCP Dashboard Prompts', () => {
99
describe('buildQueryGuidePrompt', () => {

‎packages/api/src/mcp/__tests__/dashboards/queryTile.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { callTool, getFirstText } from '../mcpTestUtils';
1+
import { callTool, getFirstText } from '@/mcp/__tests__/mcpTestUtils';
2+
23
import { setupDashboardTests } from './setup';
34

45
describe('MCP Dashboard Tools - clickstack_query_tile', () => {

0 commit comments

Comments
 (0)