/** * Shared ESLint configuration * Python-like JavaScript: prefer functional patterns, minimal syntax */ module.exports = { env: { browser: true, es2021: true, node: true, }, extends: [ 'eslint:recommended', 'prettier', // Must be last to override other configs ], plugins: ['import'], parserOptions: { ecmaVersion: 'latest', sourceType: 'module', }, rules: { // Python-like patterns 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }], // Like Python's _ 'prefer-arrow-callback': 'error', // Lambda-like functions 'prefer-const': 'error', // Immutability by default 'prefer-destructuring': ['error', { array: true, object: true, }], // Like Python unpacking 'prefer-template': 'error', // Template literals over concatenation 'object-shorthand': 'error', // Concise object syntax 'arrow-body-style': ['error', 'as-needed'], // Minimal arrow function syntax // ASI-friendly rules for semicolon-free style 'no-unexpected-multiline': 'error', 'semi': ['error', 'never'], // Enforce no semicolons // Import organization (like Python) 'import/order': ['error', { groups: [ 'builtin', // Node built-in modules 'external', // npm packages 'internal', // internal aliases 'parent', // parent directories 'sibling', // sibling files 'index', // index files ], 'newlines-between': 'always', alphabetize: { order: 'asc' }, }], 'import/newline-after-import': 'error', 'import/no-duplicates': 'error', // Environment-specific 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', }, }