module.exports = { root: true, parser: '@typescript-eslint/parser', parserOptions: { ecmaVersion: 2022, sourceType: 'module', project: './tsconfig.json', tsconfigRootDir: __dirname, }, plugins: [ '@typescript-eslint', 'import', 'prefer-arrow', ], extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'prettier', // Must be last to override other configs ], rules: { // TypeScript specific '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], '@typescript-eslint/explicit-function-return-type': 'warn', '@typescript-eslint/explicit-module-boundary-types': 'warn', '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-non-null-assertion': 'off', '@typescript-eslint/prefer-nullish-coalescing': 'error', '@typescript-eslint/prefer-optional-chain': 'error', '@typescript-eslint/no-unnecessary-type-assertion': 'error', '@typescript-eslint/no-floating-promises': 'error', '@typescript-eslint/await-thenable': 'error', '@typescript-eslint/require-await': 'error', '@typescript-eslint/no-misused-promises': 'error', // Import rules 'import/order': ['error', { 'groups': [ 'builtin', 'external', 'internal', 'parent', 'sibling', 'index', ], 'pathGroups': [ { 'pattern': '#root/**', 'group': 'internal', 'position': 'before' } ], 'pathGroupsExcludedImportTypes': ['builtin'], 'newlines-between': 'never', 'alphabetize': { 'order': 'asc', 'caseInsensitive': true } }], 'import/no-unresolved': 'error', 'import/extensions': ['error', 'always', { 'ts': 'always', 'js': 'always' }], // General code quality 'no-console': 'off', // Allowed for game development 'no-debugger': 'warn', 'no-unused-vars': 'off', // Use TypeScript version instead 'prefer-const': 'error', 'no-var': 'error', 'object-shorthand': 'error', 'prefer-template': 'error', 'prefer-arrow-callback': 'error', 'arrow-body-style': ['error', 'as-needed'], // Stylistic (handled by Prettier, but some logical ones) 'curly': ['error', 'all'], 'brace-style': 'off', // Prettier handles this 'comma-dangle': 'off', // Prettier handles this 'quotes': 'off', // Prettier handles this 'semi': 'off', // Prettier handles this // Best practices 'eqeqeq': ['error', 'always'], 'no-eval': 'error', 'no-implied-eval': 'error', 'no-new-wrappers': 'error', 'no-throw-literal': 'error', 'no-return-await': 'error', // Complexity 'complexity': ['warn', 10], 'max-lines': ['warn', { max: 500, skipBlankLines: true, skipComments: true }], 'max-lines-per-function': ['warn', { max: 100, skipBlankLines: true, skipComments: true }], // Naming conventions '@typescript-eslint/naming-convention': [ 'error', { 'selector': 'default', 'format': ['PascalCase', 'camelCase'] }, { 'selector': 'function', 'format': ['PascalCase', 'camelCase'] }, { 'selector': 'variable', 'format': ['camelCase', 'UPPER_CASE', 'PascalCase'], 'prefix': ['_', 'BP_', 'AC_', 'WBP_', 'UBP_', 'ABP_', 'IMC_', 'IA_', 'DT_', 'BFL_', 'U', 'A', 'T', 'F'] }, { 'selector': 'variable', 'format': ['camelCase', 'UPPER_CASE', 'PascalCase'], 'filter': { 'regex': '^(?!_|BP_|AC_|WBP_|UBP_|ABP_|IA_|DT_|IMC_|BFL_|U[A-Z]|A[A-Z]|T[A-Z]|F[A-Z])', 'match': true } }, // Unreal Engine classes with prefixes { 'selector': 'class', 'format': ['PascalCase'], 'prefix': ['_', 'BP_', 'AC_', 'WBP_', 'UBP_', 'ABP_', 'IMC_', 'IA_', 'DT_', 'FT_', 'BFL_', 'U', 'A', 'T', 'F'] }, // Regular classes without prefix { 'selector': 'class', 'format': ['PascalCase'], 'filter': { 'regex': '^(?!_|BP_|AC_|WBP_|UBP_|ABP_|IA_|IMC_|BFL_|U[A-Z]|A[A-Z]|T[A-Z]|F[A-Z])', 'match': true } }, // Interfaces and Structs { 'selector': 'interface', 'format': ['PascalCase'], 'prefix': ['S_', 'I_', 'I'] }, // Enums { 'selector': 'enum', 'format': ['PascalCase'], 'prefix': ['E_', 'E'] }, { 'selector': 'enumMember', 'format': ['PascalCase'] } ], '@typescript-eslint/no-unsafe-member-access': 'off' }, settings: { 'import/resolver': { 'typescript': { 'alwaysTryTypes': true, 'project': './tsconfig.json' }, 'node': { 'extensions': ['.js', '.ts', '.json'] } }, 'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] } }, env: { browser: true, es2022: true, node: true, }, ignorePatterns: [ 'node_modules/', 'dist/', 'build/', '**/*.d.ts' ] };