import js from '@eslint/js'; import typescriptEslint from '@typescript-eslint/eslint-plugin'; import typescriptParser from '@typescript-eslint/parser'; import prettierPlugin from 'eslint-plugin-prettier'; export default [ js.configs.recommended, { files: ['**/*.ts', '**/*.tsx'], languageOptions: { parser: typescriptParser, parserOptions: { ecmaVersion: 2022, sourceType: 'module', }, globals: { // Node.js globals process: 'readonly', console: 'readonly', Buffer: 'readonly', __dirname: 'readonly', __filename: 'readonly', global: 'readonly', setTimeout: 'readonly', clearTimeout: 'readonly', setInterval: 'readonly', clearInterval: 'readonly', // Browser globals that Node.js also has URL: 'readonly', URLSearchParams: 'readonly', // Node.js types NodeJS: 'readonly', }, }, plugins: { '@typescript-eslint': typescriptEslint, prettier: prettierPlugin, }, rules: { ...typescriptEslint.configs.recommended.rules, 'prettier/prettier': 'error', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-empty-function': 'off', 'no-useless-escape': 'off', }, }, { files: ['**/*.js'], languageOptions: { ecmaVersion: 2022, sourceType: 'module', globals: { process: 'readonly', console: 'readonly', Buffer: 'readonly', __dirname: 'readonly', __filename: 'readonly', global: 'readonly', }, }, }, { files: ['**/*.test.ts', '**/*.spec.ts', '**/__tests__/**/*.ts'], languageOptions: { parser: typescriptParser, parserOptions: { ecmaVersion: 2022, sourceType: 'module', }, globals: { // Node.js globals process: 'readonly', console: 'readonly', Buffer: 'readonly', __dirname: 'readonly', __filename: 'readonly', global: 'readonly', // Jest globals describe: 'readonly', it: 'readonly', test: 'readonly', expect: 'readonly', jest: 'readonly', beforeEach: 'readonly', afterEach: 'readonly', beforeAll: 'readonly', afterAll: 'readonly', }, }, plugins: { '@typescript-eslint': typescriptEslint, prettier: prettierPlugin, }, rules: { ...typescriptEslint.configs.recommended.rules, 'prettier/prettier': 'error', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-empty-function': 'off', 'no-useless-escape': 'off', }, }, { ignores: ['dist/**', 'node_modules/**'], }, ];