typescript-sdk/examples/eslint.config.mjs
Felix Weinberger 1823aae891
Implement MCP 2026-07-28 (#2286)
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com>
Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-06-26 14:01:10 +01:00

46 lines
2.1 KiB
JavaScript

// @ts-check
import baseConfig from '@modelcontextprotocol/eslint-config';
export default [
...baseConfig,
{
// The nested workspace packages (shared, *-quickstart) are linted by their own configs.
// The one-way "@mcp-examples/shared must not import from stories" rule lives in
// shared/eslint.config.mjs so it fires under that package's own lint.
ignores: ['shared/**', 'server-quickstart/**', 'client-quickstart/**']
},
{
files: ['**/*.{ts,tsx,js,jsx,mts,cts}'],
rules: {
// Examples write to stdout/stderr deliberately.
'no-console': 'off',
// Examples MUST use only what a consumer would `npm install` and import:
// public package entry points and the @mcp-examples/shared scaffold. Anything
// reaching into package internals or workspace source is banned.
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['@modelcontextprotocol/*/src/*', '@modelcontextprotocol/*/dist/*'],
message: 'Examples must import only public package entry points (no /src/ or /dist/ deep paths).'
},
{
group: ['**/packages/*', '../../packages/*', '../../../packages/*'],
message: 'Examples must not reach into workspace source.'
},
{
group: ['@modelcontextprotocol/core-internal', '@modelcontextprotocol/core-internal/*'],
message: 'Examples must import from @modelcontextprotocol/{server,client}, not the internal core barrel.'
},
{
group: ['@modelcontextprotocol/test-helpers', '@modelcontextprotocol/test-helpers/*'],
message: 'Examples must not depend on test helpers.'
}
]
}
]
}
}
];