mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
chore(ci): eslint + prettier → biome (#325)
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
'use client';
|
||||
|
||||
// Media
|
||||
export { Video, type VideoProps } from './media/video';
|
||||
|
||||
// Features (re-export for convenience)
|
||||
export { media } from '@videojs/core/dom';
|
||||
|
||||
// Store
|
||||
export * from '@videojs/store/react';
|
||||
// Media
|
||||
export { Video, type VideoProps } from './media/video';
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('video', () => {
|
||||
const { container } = render(
|
||||
<Provider>
|
||||
<Video data-testid="test-video" />
|
||||
</Provider>,
|
||||
</Provider>
|
||||
);
|
||||
|
||||
const video = container.querySelector('video');
|
||||
@@ -46,7 +46,7 @@ describe('video', () => {
|
||||
const { container } = render(
|
||||
<Provider>
|
||||
<Video src="test.mp4" controls autoPlay playsInline />
|
||||
</Provider>,
|
||||
</Provider>
|
||||
);
|
||||
|
||||
const video = container.querySelector('video') as HTMLVideoElement;
|
||||
@@ -66,7 +66,7 @@ describe('video', () => {
|
||||
<source src="test.mp4" type="video/mp4" />
|
||||
<track kind="captions" src="captions.vtt" />
|
||||
</Video>
|
||||
</Provider>,
|
||||
</Provider>
|
||||
);
|
||||
|
||||
const video = container.querySelector('video');
|
||||
@@ -96,7 +96,7 @@ describe('video', () => {
|
||||
render(
|
||||
<Provider>
|
||||
<TestComponent />
|
||||
</Provider>,
|
||||
</Provider>
|
||||
);
|
||||
|
||||
expect(attachCalled).toBe(true);
|
||||
@@ -119,7 +119,7 @@ describe('video', () => {
|
||||
render(
|
||||
<Provider>
|
||||
<TestComponent />
|
||||
</Provider>,
|
||||
</Provider>
|
||||
);
|
||||
|
||||
expect(capturedElement).toBeInstanceOf(HTMLVideoElement);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import type { Ref, VideoHTMLAttributes } from 'react';
|
||||
|
||||
import { useStoreContext } from '@videojs/store/react';
|
||||
import type { Ref, VideoHTMLAttributes } from 'react';
|
||||
|
||||
import { useCallback } from 'react';
|
||||
|
||||
@@ -42,13 +41,12 @@ export function Video({ children, ref: refProp, ...props }: VideoProps): React.J
|
||||
if (!el) return;
|
||||
return store.attach(el);
|
||||
},
|
||||
[store],
|
||||
[store]
|
||||
);
|
||||
|
||||
const ref = useComposedRefs(refProp, attachRef);
|
||||
|
||||
return (
|
||||
// eslint-disable-next-line jsx-a11y/media-has-caption -- captions can be passed via children
|
||||
<video ref={ref} {...props}>
|
||||
{children}
|
||||
</video>
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
declare global {
|
||||
namespace React {
|
||||
interface HTMLAttributes<T> {
|
||||
interface HTMLAttributes<_T> {
|
||||
popover?: 'auto' | 'manual' | string;
|
||||
commandfor?: string;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { MutableRefObject, RefObject } from 'react';
|
||||
|
||||
import { render } from '@testing-library/react';
|
||||
import type { MutableRefObject, RefObject } from 'react';
|
||||
|
||||
import { useRef } from 'react';
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ function setRef<T>(ref: PossibleRef<T>, value: T): (() => void) | void | undefin
|
||||
*/
|
||||
export function composeRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T> {
|
||||
return (node): (() => void) | void => {
|
||||
const cleanups = refs.map(ref => setRef(ref, node));
|
||||
const cleanups = refs.map((ref) => setRef(ref, node));
|
||||
|
||||
return () => {
|
||||
for (let i = 0; i < cleanups.length; i++) {
|
||||
@@ -59,6 +59,5 @@ export function composeRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T> {
|
||||
* ```
|
||||
*/
|
||||
export function useComposedRefs<T>(...refs: PossibleRef<T>[]): RefCallback<T> {
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
return useCallback(composeRefs(...refs), refs);
|
||||
return useCallback(composeRefs(...refs), [...refs]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user