From 379f0a0058cfdef239cf1e6f318198db1502b465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Uyan=C4=B1k?= <99019289+MertUyanik@users.noreply.github.com> Date: Wed, 29 Oct 2025 08:15:14 +0300 Subject: [PATCH] Fix fullscreen controls and refresh lint setup --- eslint.config.js | 51 +++++++++ package.json | 14 +-- src/components/VideoElement.tsx | 4 +- src/components/VideoPlayer.tsx | 117 ++++++++++++++++----- src/components/controls/SettingsButton.tsx | 1 + 5 files changed, 150 insertions(+), 37 deletions(-) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..9681cb2 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,51 @@ +import js from '@eslint/js' +import tsParser from '@typescript-eslint/parser' +import tsPlugin from '@typescript-eslint/eslint-plugin' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import globals from 'globals' + +export default [ + { + ignores: ['dist/**', 'node_modules/**'] + }, + js.configs.recommended, + { + files: ['**/*.{ts,tsx}'], + languageOptions: { + parser: tsParser, + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + globals: { + ...globals.browser, + ...globals.es2021 + } + }, + plugins: { + '@typescript-eslint': tsPlugin, + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh + }, + rules: { + ...tsPlugin.configs.recommended.rules, + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', + 'react-refresh/only-export-components': 'warn' + } + }, + { + files: ['**/*.config.{js,ts}', '**/*.config.{cjs,mjs}', 'vite.config.*', 'eslint.config.js'], + languageOptions: { + globals: { + ...globals.node + } + } + } +] diff --git a/package.json b/package.json index 0e59879..b308f4d 100644 --- a/package.json +++ b/package.json @@ -22,21 +22,23 @@ "build": "tsc && vite build", "build:lib": "tsc && vite build --config vite.config.lib.ts", "preview": "vite preview", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0" + "lint": "eslint . --report-unused-disable-directives --max-warnings 0" }, "peerDependencies": { "react": "^18.0.0", "react-dom": "^18.0.0" }, "devDependencies": { + "@eslint/js": "^9.7.0", + "globals": "^15.6.0", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", + "@typescript-eslint/eslint-plugin": "^8.5.0", + "@typescript-eslint/parser": "^8.5.0", "@vitejs/plugin-react": "^4.3.1", - "eslint": "^8.57.0", - "eslint-plugin-react-hooks": "^4.6.2", - "eslint-plugin-react-refresh": "^0.4.7", + "eslint": "^9.7.0", + "eslint-plugin-react-hooks": "^5.0.0", + "eslint-plugin-react-refresh": "^0.5.0", "react": "^18.3.1", "react-dom": "^18.3.1", "typescript": "^5.2.2", diff --git a/src/components/VideoElement.tsx b/src/components/VideoElement.tsx index f9ba5b8..e7ce63b 100644 --- a/src/components/VideoElement.tsx +++ b/src/components/VideoElement.tsx @@ -42,7 +42,7 @@ export const VideoElement: React.FC = ({ onSeeked, onAudioTracksLoaded, }) => { - const { videoRef, containerRef, setVideoState, toggleFullscreen, settings } = usePlayerContext() + const { videoRef, setVideoState, toggleFullscreen, settings } = usePlayerContext() const lastClickTimeRef = React.useRef(0) const [availableAudioTracks, setAvailableAudioTracks] = useState([]) @@ -368,7 +368,7 @@ export const VideoElement: React.FC = ({ }, [settings.audioTrack, availableAudioTracks, videoRef]) return ( -
+