-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy patheslint.config.mjs
More file actions
108 lines (106 loc) · 4.49 KB
/
Copy patheslint.config.mjs
File metadata and controls
108 lines (106 loc) · 4.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import glspConfig from '@eclipse-glsp/eslint-config';
// Relative index and src imports restricted by the shared @eclipse-glsp/eslint-config.
// Must be included in every `no-restricted-imports` override since flat config replaces the entire rule value.
const restrictedBaseImports = ['..', '../index', '../..', '../../index', 'src'];
export default [
...glspConfig,
// Ignore JS config/build files that are not part of the TS project
{
ignores: ['**/*.js', '**/*.mjs', '**/*.cjs', '.worktrees/']
},
// Apply parserOptions.project only to TypeScript files
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: import.meta.dirname
}
}
},
// Repository-specific rule overrides
{
files: ['**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/padding-line-between-statements': 'off',
// The MCP SDK uses `exports` subpath patterns with explicit `.js` suffixes (e.g.
// `@modelcontextprotocol/sdk/server/mcp.js`). The TypeScript import resolver does
// not match these against the `./*` wildcard, even though tsc and Node resolve
// them correctly at compile- and runtime.
'import-x/no-unresolved': ['error', { ignore: ['^@modelcontextprotocol/sdk/'] }]
}
},
// Default rules for all TS files: restrict direct sprotty-protocol and uuid imports.
// Covers the lower-layer packages (graph, server) which may consume '@eclipse-glsp/protocol' directly.
{
files: ['**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'warn',
...restrictedBaseImports,
{
name: 'sprotty-protocol',
message:
"The sprotty-protocol default exports are customized and reexported by GLSP. Please import from '@eclipse-glsp/protocol' instead"
},
{
name: 'sprotty-protocol/*',
message:
"The sprotty-protocol default exports are customized and reexported by GLSP. Please import from '@eclipse-glsp/protocol' instead"
},
{
name: 'uuid',
message: "Use the 'generateUuid'/'isUuid' helpers (from '@eclipse-glsp/protocol') instead of importing 'uuid' directly."
},
{
name: 'uuid/*',
message: "Use the 'generateUuid'/'isUuid' helpers (from '@eclipse-glsp/protocol') instead of importing 'uuid' directly."
}
]
}
},
// examples, layout-elk and server-mcp: only consume the public '@eclipse-glsp/server' API;
// the lower layers (protocol, sprotty-protocol) are re-exported through it.
{
files: ['examples/**/*.{ts,tsx}', 'packages/layout-elk/src/**/*.{ts,tsx}', 'packages/server-mcp/src/**/*.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'warn',
...restrictedBaseImports,
{
name: 'sprotty-protocol',
message: 'Please import from @eclipse-glsp/server instead'
},
{
name: 'sprotty-protocol/*',
message: 'Please import from @eclipse-glsp/server instead'
},
{
name: '@eclipse-glsp/protocol',
message: 'Please import from @eclipse-glsp/server instead'
},
{
name: '@eclipse-glsp/protocol/*',
message: 'Please import from @eclipse-glsp/server instead'
},
{
name: 'uuid',
message: "Use the 'generateUuid'/'isUuid' helpers (from '@eclipse-glsp/server') instead of importing 'uuid' directly."
},
{
name: 'uuid/*',
message: "Use the 'generateUuid'/'isUuid' helpers (from '@eclipse-glsp/server') instead of importing 'uuid' directly."
}
]
}
},
// Test file overrides
{
files: ['**/*.spec.{ts,tsx}'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
'import-x/namespace': 'off'
}
}
];