All files / Bandstand eslint.config.mjs

0% Statements 0/65
0% Branches 0/1
0% Functions 0/1
0% Lines 0/65

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74                                                                                                                                                   
// Flat ESLint config for ESLint v9
// Uses FlatCompat to reuse existing shareable configs (next/core-web-vitals, prettier)
import {FlatCompat} from '@eslint/eslintrc'
import tsParser from '@typescript-eslint/parser'
import tsPlugin from '@typescript-eslint/eslint-plugin'
 
// Adapter to load legacy "extends" configs in flat config
const compat = new FlatCompat({
  baseDirectory: process.cwd(),
})
 
const config = [
  // Reuse existing shareable configs via compat (JS/React/Next + Prettier)
  ...compat.extends('next/core-web-vitals', 'prettier'),
 
  // TypeScript recommended rules scoped to TS files (flat config)
  ...tsPlugin.configs['flat/recommended'],
 
  // Project-wide settings for TS/TSX
  {
    files: ['**/*.{ts,tsx}'],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        ecmaVersion: 'latest',
        sourceType: 'module',
        // Turn on the TS Project Service if needed later:
        // projectService: true,
      },
    },
    plugins: {
      '@typescript-eslint': tsPlugin,
    },
    rules: {
      'no-unused-vars': 'off',
      '@typescript-eslint/no-unused-vars': [
        'warn',
        {argsIgnorePattern: '^_', varsIgnorePattern: '^_'},
      ],
    },
  },
 
  // Test overrides
  {
    files: ['tests/**/*.{ts,tsx}', '**/*.test.ts', '**/*.test.tsx'],
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
      'prefer-const': 'off',
    },
  },
 
  // Allow require() in Node script files
  {
    files: ['**/*.{js,cjs,mjs}'],
    rules: {
      '@typescript-eslint/no-require-imports': 'off',
    },
  },
 
  // Ignores
  {
    ignores: [
      'node_modules',
      '.next',
      '.next-demo',
      'demo-out',
      'dist',
      'build',
    ],
  },
]
 
export default config