import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettierConfig from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier';
import globals from 'globals';
export default tseslint.config(
// Base ESLint recommended rules
eslint.configs.recommended,
// TypeScript ESLint recommended rules (without type checking)
...tseslint.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parser: tseslint.parser,
globals: {
...globals.node,
...globals.jest,
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
prettier: prettierPlugin,
},
rules: {
// Prettier as ESLint rule
'prettier/prettier': 'error',
// TypeScript specific rules
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
// General rules
'no-console': 'off', // Allow console for logging
},
},
{
// Test files - relax strict typing rules
files: ['**/*.spec.ts', '**/*.test.ts', '**/test/**/*.ts', '**/__tests__/**/*.ts', '**/test-fixtures/**/*.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
// Ignore patterns
ignores: [
'dist/**',
'node_modules/**',
'coverage/**',
'*.mcpb',
'*.tgz',
'.husky/**',
],
},
// Prettier integration - must be last to override conflicting rules
prettierConfig,
);