diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..e4920f8 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,129 @@ +import js from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default [ + js.configs.recommended, + ...tseslint.configs.recommended, + { + files: ['**/*.{js,mjs,cjs,ts,tsx}'], + languageOptions: { + parser: tseslint.parser, + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + ecmaFeatures: { + jsx: true, + }, + }, + globals: { + // Node.js globals + console: 'readonly', + process: 'readonly', + require: 'readonly', + module: 'readonly', + exports: 'readonly', + __dirname: 'readonly', + __filename: 'readonly', + global: 'readonly', + Buffer: 'readonly', + // Browser globals + window: 'readonly', + document: 'readonly', + navigator: 'readonly', + location: 'readonly', + localStorage: 'readonly', + sessionStorage: 'readonly', + fetch: 'readonly', + Request: 'readonly', + Response: 'readonly', + Headers: 'readonly', + URL: 'readonly', + URLSearchParams: 'readonly', + FormData: 'readonly', + File: 'readonly', + FileReader: 'readonly', + Blob: 'readonly', + Image: 'readonly', + HTMLElement: 'readonly', + HTMLInputElement: 'readonly', + HTMLImageElement: 'readonly', + HTMLDivElement: 'readonly', + HTMLTextAreaElement: 'readonly', + HTMLCanvasElement: 'readonly', + HTMLAnchorElement: 'readonly', + CanvasRenderingContext2D: 'readonly', + Event: 'readonly', + CustomEvent: 'readonly', + MouseEvent: 'readonly', + KeyboardEvent: 'readonly', + Element: 'readonly', + Node: 'readonly', + NodeList: 'readonly', + NodeListOf: 'readonly', + setTimeout: 'readonly', + clearTimeout: 'readonly', + setInterval: 'readonly', + clearInterval: 'readonly', + alert: 'readonly', + confirm: 'readonly', + prompt: 'readonly', + // Web APIs + crypto: 'readonly', + AbortController: 'readonly', + TextEncoder: 'readonly', + TextDecoder: 'readonly', + performance: 'readonly', + requestAnimationFrame: 'readonly', + cancelAnimationFrame: 'readonly', + PerformanceObserver: 'readonly', + PerformanceNavigationTiming: 'readonly', + RequestInit: 'readonly', + // Node.js types + NodeJS: 'readonly', + // Geolocation + GeoJSON: 'readonly', + // React + React: 'readonly', + }, + }, + rules: { + '@typescript-eslint/no-unused-vars': ['warn', { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_|^error$' + }], + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-require-imports': 'off', + 'prefer-const': 'error', + 'no-console': 'off', + 'no-undef': 'error', + 'no-empty': 'warn', + 'no-useless-catch': 'warn', + 'no-constant-binary-expression': 'warn', + }, + }, + { + files: ['**/*.astro'], + rules: { + // Disable parsing for Astro files since ESLint doesn't understand them + '@typescript-eslint/no-unused-vars': 'off', + 'no-undef': 'off', + }, + }, + { + ignores: [ + 'dist/', + 'node_modules/', + '.astro/', + 'public/', + '*.config.js', + '*.config.ts', + '*.config.mjs', + '**/*.astro', // Skip linting Astro files entirely + 'scripts/', + 'test-*.js', + 'test-*.mjs', + 'promote-to-admin.js', + 'setup-*.js', + ], + }, +]; \ No newline at end of file diff --git a/src/components/modals/SeatingMapModal.tsx b/src/components/modals/SeatingMapModal.tsx index 2aa41c3..f8a75d1 100644 --- a/src/components/modals/SeatingMapModal.tsx +++ b/src/components/modals/SeatingMapModal.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import type { SeatingMap, LayoutItem, LayoutType } from '../../lib/seating-management'; import { createSeatingMap, updateSeatingMap, generateInitialLayout } from '../../lib/seating-management'; @@ -109,7 +109,7 @@ export default function SeatingMapModal({ return (
-
+

@@ -117,9 +117,10 @@ export default function SeatingMapModal({

diff --git a/src/components/modals/TicketTypeModal.tsx b/src/components/modals/TicketTypeModal.tsx index f55c761..7aca8aa 100644 --- a/src/components/modals/TicketTypeModal.tsx +++ b/src/components/modals/TicketTypeModal.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import type { TicketType, TicketTypeFormData } from '../../lib/ticket-management'; import { createTicketType, updateTicketType } from '../../lib/ticket-management'; @@ -99,32 +99,34 @@ export default function TicketTypeModal({ if (!isOpen) return null; return ( -
-
+
+
-

+

{ticketType ? 'Edit Ticket Type' : 'Create Ticket Type'}

{error && ( -
+
{error}
)}
-