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

Was this helpful?