import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsparser from '@typescript-eslint/parser';
import prettier from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
import globals from 'globals';
export default [
js.configs.recommended,
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsparser,
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
project: './tsconfig.json',
},
globals: {
...globals.node,
},
},
plugins: {
'@typescript-eslint': tseslint,
prettier: prettier,
},
rules: {
...tseslint.configs.recommended.rules,
...prettierConfig.rules,
// TypeScript specific rules
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'warn',
// General rules
'no-console': ['warn', { allow: ['error'] }],
'prefer-const': 'error',
'no-var': 'error',
'no-trailing-spaces': 'error',
'eol-last': 'error',
// Prettier integration
'prettier/prettier': 'error',
},
},
{
files: ['**/*.js', '**/*.mjs'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
},
{
ignores: ['build/', 'dist/', 'node_modules/', '*.d.ts', 'coverage/'],
},
];