Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX in map function being mistaken as SFC (missing props validation) #504

Closed
darrennolan opened this issue Mar 16, 2016 · 0 comments
Closed

Comments

@darrennolan
Copy link

The following code produces warnings of "is missing in props validation" when using the react/prop-types rule. It appears that when JSX is inside of our map function here, eslint-plugin-react is identifying it as a stateless functional component.

import React from 'react';
import bacon from 'baconjs';
import isEqual from 'lodash/isEqual';
import get from 'lodash/get';

import VideoJSPlayer from '../../components/videojs-player';

export default function getVideoJSComponentStream({
    autoPlayStream,
    marbleStream,
    marbleVideoSourcesStream,
    preloadStream,
    showAdStream,
    videoJsControlBus,
    videoJsEventBus
}) {
    let videoJsSettings = bacon.combineWith(
        marbleStream, marbleVideoSourcesStream, autoPlayStream, preloadStream,
        (marbleVideo, marbleVideoSources, autoplay, preload) => {
            return {
                autoplay,
                preload,
                marbleVideoSources: marbleVideoSources,
                nativeControlsForTouch: true,
                poster: get(marbleVideo, 'posters.large', '')
            };
        }
    );

    return bacon.combineWith(
        videoJsSettings, showAdStream, marbleStream,
        (videoJsSettings, showAd, marbleData) => ({videoJsSettings, showAd, marbleData})
    )
        .skipDuplicates(isEqual)
        .map((settings) => {
            return (
                <VideoJSPlayer
                    showAd={settings.showAd}
                    videoUid={get(settings, 'marbleData.marbleId')}
                    videoJsControlBus={videoJsControlBus}
                    videoJsEventBus={videoJsEventBus}
                    videoJsSettings={settings.videoJsSettings} />
            );
        });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant