-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy patheslint.config.mjs
More file actions
143 lines (142 loc) · 4.22 KB
/
Copy patheslint.config.mjs
File metadata and controls
143 lines (142 loc) · 4.22 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import nx from '@nx/eslint-plugin';
export default [
...nx.configs['flat/base'],
...nx.configs['flat/typescript'],
...nx.configs['flat/javascript'],
{
ignores: [
'**/dist',
'**/*.d.ts',
'**/*.d.ts.map',
'**/fixture/libs',
'apps/e2e/**',
'**/*.spec.ts',
'**/*.spec.tsx',
'**/*.test.ts',
'**/*.test.tsx',
'**/*.e2e.spec.ts',
'**/*.perf.spec.ts',
'**/*.pw.spec.ts',
'**/__tests__/**',
'**/__test-utils__/**',
'**/jest.config.ts',
'**/jest.config.js',
],
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
// Newly added to eslint:recommended in ESLint 10; surfaced as warnings here so
// the upgrade lands without bundling a repo-wide error-cause/dead-store cleanup.
'preserve-caught-error': 'warn',
'no-useless-assignment': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-empty-function': 'off', // Many lifecycle hooks and abstract methods are intentionally empty
'@typescript-eslint/no-empty-interface': 'off', // Used for module augmentation and marker interfaces
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
disallowTypeAnnotations: false,
},
],
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [
'^.*/eslint(\\.base)?\\.config\\.[cm]?[jt]s$',
'@frontmcp/sdk',
'@frontmcp/auth',
'@frontmcp/utils',
'@frontmcp/uipack',
'@frontmcp/uipack/*',
'@frontmcp/protocol',
'@frontmcp/testing',
'@frontmcp/observability',
'^#(mcp-.+|crypto-.+|async-.+|event-.+|langchain-.+|sse-.+|express-.+|server-.+|stdio-.+|env|runtime-context|path)$',
],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts', '**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
// Override or add rules here
rules: {
'@typescript-eslint/no-unsafe-function-type': 'off',
},
},
{
// Relax rules for test files
files: [
'**/*.test.ts',
'**/*.spec.ts',
'**/*.e2e.ts',
'**/*.e2e.spec.ts',
'**/e2e/**/*.ts',
'**/__tests__/**/*.ts',
'**/__test-utils__/**/*.ts',
'**/fixtures/**/*.ts',
'**/mocks/**/*.ts',
'**/*.mock.ts',
],
rules: {
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-unused-private-class-members': 'off',
},
},
{
// Block direct imports of @frontmcp/protocol in consumer code
files: ['apps/**/*.ts', 'apps/**/*.tsx'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '@frontmcp/protocol',
message:
'@frontmcp/protocol is internal. Import MCP types from @frontmcp/sdk. ' +
'For raw MCP Client in tests, use McpClient from @frontmcp/testing.',
},
],
patterns: [
{
group: ['@frontmcp/protocol/*'],
message:
'@frontmcp/protocol is internal. Import MCP types from @frontmcp/sdk. ' +
'For raw MCP Client in tests, use McpClient from @frontmcp/testing.',
},
],
},
],
},
},
{
// Allow `any` in .d.ts declaration files for compatibility with external libraries (React, Handlebars, etc.)
files: ['**/*.d.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
];