import {defineConfig, globalIgnores} from 'eslint/config'
import nextVitals from 'eslint-config-next/core-web-vitals'
import nextTs from 'eslint-config-next/typescript'
import stylistic from '@stylistic/eslint-plugin'

// noinspection SpellCheckingInspection
const eslintConfig = defineConfig([
  ...nextVitals,
  ...nextTs,
  // Override default ignores of eslint-config-next.
  globalIgnores([
    // Default ignores of eslint-config-next:
    '.next/**',
    'out/**',
    'build/**',
    'next-env.d.ts',
  ]),
  stylistic.configs.recommended,
  {
    rules: {
      '@stylistic/indent': ['error', 2, {
        SwitchCase: 0,
      }],
      '@stylistic/object-curly-spacing': ['error', 'never'],
      '@stylistic/jsx-tag-spacing': ['error', {
        beforeSelfClosing: 'never',
      }],
      '@stylistic/jsx-closing-bracket-location': 'off',
      '@stylistic/jsx-curly-newline': 'off',
      '@stylistic/jsx-one-expression-per-line': 'off',
      '@stylistic/multiline-ternary': 'off',
      '@stylistic/block-spacing': 'off',
      '@typescript-eslint/no-empty-object-type': 'off',
      '@typescript-eslint/no-unused-vars': 'off',
    },
  },
])

export default eslintConfig
