import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// Naming conventions
"@typescript-eslint/naming-convention": [
"error",
{
selector: "default",
format: ["camelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
},
{
selector: "enumMember",
format: ["UPPER_CASE", "PascalCase"],
},
{
selector: "objectLiteralProperty",
format: null,
},
],
// Array type style: T[] for simple, Array<T> for complex
"@typescript-eslint/array-type": [
"error",
{
default: "array-simple",
},
],
// Prefer interfaces over type literals for objects
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
// Relaxed rules for MCP SDK compatibility
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-argument": "warn",
"@typescript-eslint/no-unsafe-return": "warn",
// Allow explicit any for external API responses
"@typescript-eslint/no-explicit-any": "warn",
// Require explicit return types on exports
"@typescript-eslint/explicit-function-return-type": [
"warn",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
// No floating promises
"@typescript-eslint/no-floating-promises": "error",
// Prefer nullish coalescing
"@typescript-eslint/prefer-nullish-coalescing": "error",
// No unused variables (except with underscore prefix)
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
},
},
{
ignores: ["dist/**", "node_modules/**", "coverage/**", "*.config.js"],
}
);