Configurazione ESLint

Configurazione completa ESLint per progetti JavaScript PANDEV con Standard Style e supporto multi-framework.

🛠️ Setup Base

Installazione Dependencies

# Core ESLint
npm install --save-dev eslint

# Standard config
npm install --save-dev eslint-config-standard
npm install --save-dev eslint-plugin-import
npm install --save-dev eslint-plugin-node
npm install --save-dev eslint-plugin-promise

# Prettier integration
npm install --save-dev eslint-config-prettier
npm install --save-dev eslint-plugin-prettier

File .eslintrc.js Standard

module.exports = {
  root: true,
  extends: [
    'standard',
    'prettier'
  ],
  plugins: ['prettier'],
  env: {
    browser: true,
    node: true,
    es2022: true
  },
  parserOptions: {
    ecmaVersion: 2022,
    sourceType: 'module'
  },
  rules: {
    // Prettier integration
    'prettier/prettier': 'error',
    
    // Custom PANDEV rules
    'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
    
    // Code quality
    'prefer-const': 'error',
    'no-var': 'error',
    'object-shorthand': 'error',
    'prefer-arrow-callback': 'error',
    'prefer-template': 'error',
    
    // Import organization
    'import/order': [
      'error',
      {
        groups: [
          'builtin',
          'external',
          'internal',
          'parent',
          'sibling',
          'index'
        ],
        'newlines-between': 'always'
      }
    ]
  }
}

🎨 Configurazioni Framework-Specific

React Projects

Vue Projects

Angular Projects

Node.js/Express Projects

📁 File .eslintignore

🚀 Scripts Package.json

🔧 VS Code Integration

Workspace Settings

Extensions Consigliate

🪝 Pre-commit Hooks

Setup Husky + lint-staged

Configurazione lint-staged

🔄 CI/CD Integration

GitHub Actions

🎛️ Configurazioni Avanzate

Performance per Large Codebases

Override per File Specifici

🐛 Troubleshooting

Problemi Comuni

ESLint non trova configurazione:

Conflitti Prettier/ESLint:

Performance lente:

Plugin non trovati:

Questa configurazione ESLint garantisce codice consistente e di qualità per tutti i progetti JavaScript PANDEV.

Last updated