import { defineConfig } from 'eslint/config';
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier';
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default defineConfig([
eslint.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
name: 'app/typescript-config',
files: ['src/**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.app.json', './tsconfig.test.json']
}
},
plugins: {
prettier: prettierPlugin
},
rules: {
'prettier/prettier': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }]
}
},
{
name: 'app/commonjs-config',
files: ['**/*.cjs'],
languageOptions: {
sourceType: 'commonjs',
globals: {
module: 'readonly',
exports: 'readonly',
require: 'readonly',
__dirname: 'readonly',
__filename: 'readonly'
}
}
},
{
ignores: ['node_modules/', 'dist/', 'build/', 'coverage/']
}
]);