Files
klz-cables.com/eslint.config.js
2026-01-06 13:55:04 +01:00

120 lines
3.4 KiB
JavaScript

import js from '@eslint/js'
import tsParser from '@typescript-eslint/parser'
import tsPlugin from '@typescript-eslint/eslint-plugin'
import react from 'eslint-plugin-react'
import next from '@next/eslint-plugin-next'
export default [
js.configs.recommended,
{
// Only lint the actual source files, not build output or scripts
files: ['app/**/*.{ts,tsx}', 'components/**/*.{ts,tsx}', 'lib/**/*.{ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true
}
},
globals: {
// Browser globals
window: 'readonly',
document: 'readonly',
navigator: 'readonly',
localStorage: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
fetch: 'readonly',
URL: 'readonly',
URLSearchParams: 'readonly',
DOMParser: 'readonly',
HTMLInputElement: 'readonly',
HTMLTextAreaElement: 'readonly',
HTMLSelectElement: 'readonly',
HTMLButtonElement: 'readonly',
HTMLDivElement: 'readonly',
HTMLLabelElement: 'readonly',
HTMLSourceElement: 'readonly',
HTMLFormElement: 'readonly',
HTMLElement: 'readonly',
HTMLVideoElement: 'readonly',
Node: 'readonly',
Event: 'readonly',
alert: 'readonly',
console: 'readonly',
// Node globals
process: 'readonly',
Buffer: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
require: 'readonly',
module: 'readonly',
NodeJS: 'readonly',
// React/Next.js globals
React: 'readonly',
JSX: 'readonly'
}
},
plugins: {
'@typescript-eslint': tsPlugin,
'react': react,
'@next/next': next
},
rules: {
...tsPlugin.configs.recommended.rules,
...react.configs.recommended.rules,
...next.configs.recommended.rules,
...next.configs['core-web-vitals'].rules,
// TypeScript specific
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-namespace': 'off',
// React specific
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'react/no-unescaped-entities': 'off',
// Next.js specific
'@next/next/no-img-element': 'off',
'@next/next/no-html-link-for-pages': 'off',
'@next/next/no-sync-scripts': 'off',
// General
'no-undef': 'error',
'no-console': 'off',
'no-useless-escape': 'warn',
'no-irregular-whitespace': 'warn'
},
settings: {
react: {
version: 'detect'
}
}
},
{
// Ignore scripts and test files completely
files: ['scripts/**/*.{js,ts}', 'test-*.{js,ts}', '**/*.test.{js,ts,tsx}'],
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-console': 'off'
}
},
{
// Ignore build output and config files
files: ['.next/**', 'next.config.ts', 'postcss.config.js', 'tailwind.config.js', 'eslint.config.js'],
rules: {
'no-undef': 'off',
'no-unused-vars': 'off'
}
}
]