import { defineConfig, globalIgnores } from 'eslint/config'; import js from '@eslint/js'; import ts from '@typescript-eslint/eslint-plugin'; import tsParser from '@typescript-eslint/parser'; const eslintConfig = defineConfig([ js.configs.recommended, { files: ['**/*.ts'], languageOptions: { parser: tsParser, parserOptions: { ecmaVersion: 'latest', sourceType: 'module', }, globals: { // Node.js globals console: 'readonly', process: 'readonly', Buffer: 'readonly', __dirname: 'readonly', __filename: 'readonly', URL: 'readonly', URLSearchParams: 'readonly', AbortController: 'readonly', AbortSignal: 'readonly', fetch: 'readonly', Response: 'readonly', Request: 'readonly', Headers: 'readonly', FormData: 'readonly', RequestInit: 'readonly', // Timers setTimeout: 'readonly', setInterval: 'readonly', clearTimeout: 'readonly', clearInterval: 'readonly', setImmediate: 'readonly', clearImmediate: 'readonly', queueMicrotask: 'readonly', // Node.js types NodeJS: 'readonly', }, }, plugins: { '@typescript-eslint': ts, }, rules: { ...ts.configs.recommended.rules, '@typescript-eslint/no-unused-vars': [ 'warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_', ignoreRestSiblings: true, }, ], '@typescript-eslint/no-explicit-any': 'warn', // Server code frequently works with terminal output containing ANSI escape codes 'no-control-regex': 'off', '@typescript-eslint/ban-ts-comment': [ 'error', { 'ts-nocheck': 'allow-with-description', minimumDescriptionLength: 10, }, ], }, }, globalIgnores(['dist/**', 'node_modules/**']), ]); export default eslintConfig;