fix files according to linter rules

This commit is contained in:
svetlagasheva 2019-12-12 11:43:32 +02:00
parent d5de64fc05
commit 41415f895d
24 changed files with 68 additions and 29 deletions

View file

@ -23,6 +23,8 @@ const MainNavBar = React.memo(({ className }) => {
);
});
MainNavBar.displayName = 'MainNavBar';
MainNavBar.propTypes = {
className: PropTypes.string
};

View file

@ -1,3 +1,3 @@
const ModalDialog = require('./ModalDialog');
module.exports = ModalDialog;
module.exports = ModalDialog;

View file

@ -80,7 +80,7 @@ const Notification = ({ className, id, type, name, poster, thumbnail, season, ep
}
</Button>
);
}
};
Notification.propTypes = {
className: PropTypes.string,

View file

@ -1,7 +1,6 @@
const React = require('react');
const PropTypes = require('prop-types');
const classnames = require('classnames');
const Icon = require('stremio-icons/dom');
const styles = require('./styles');
const NotificationPlaceholder = ({ className }) => {
@ -20,6 +19,6 @@ const NotificationPlaceholder = ({ className }) => {
NotificationPlaceholder.propTypes = {
className: PropTypes.string
}
};
module.exports = NotificationPlaceholder;

View file

@ -57,7 +57,7 @@ const NotificationsList = ({ className, metaItems }) => {
}
</div>
);
}
};
NotificationsList.propTypes = {
className: PropTypes.string,

View file

@ -1,3 +1,3 @@
const PaginationInput = require('./PaginationInput');
module.exports = PaginationInput;
module.exports = PaginationInput;

View file

@ -96,7 +96,7 @@ const Popup = ({ open, direction, renderLabel, renderMenu, dataset, onCloseReque
:
null
});
}
};
Popup.propTypes = {
open: PropTypes.bool,

View file

@ -8,11 +8,11 @@ const routesRegexp = {
urlParamsNames: []
},
discover: {
regexp: /^\/discover(?:\/([^\/]*)\/([^\/]*)\/([^\/]*))?$/,
regexp: /^\/discover(?:\/([^/]*)\/([^/]*)\/([^/]*))?$/,
urlParamsNames: ['addonTransportUrl', 'type', 'catalogId']
},
library: {
regexp: /^\/library(?:\/([^\/]*))?$/,
regexp: /^\/library(?:\/([^/]*))?$/,
urlParamsNames: ['type']
},
search: {
@ -20,11 +20,11 @@ const routesRegexp = {
urlParamsNames: []
},
metadetails: {
regexp: /^\/metadetails\/([^\/]*)\/([^\/]*)(?:\/([^\/]*))?$/,
regexp: /^\/metadetails\/([^/]*)\/([^/]*)(?:\/([^/]*))?$/,
urlParamsNames: ['type', 'id', 'videoId']
},
addons: {
regexp: /^\/addons(?:\/([^\/]*)\/([^\/]*)\/([^\/]*))?$/,
regexp: /^\/addons(?:\/([^/]*)\/([^/]*)\/([^/]*))?$/,
urlParamsNames: ['addonTransportUrl', 'catalogId', 'type']
},
settings: {
@ -32,7 +32,7 @@ const routesRegexp = {
urlParamsNames: []
},
player: {
regexp: /^\/player\/([^\/]*)\/([^\/]*)\/([^\/]*)\/([^\/]*)$/,
regexp: /^\/player\/([^/]*)\/([^/]*)\/([^/]*)\/([^/]*)$/,
urlParamsNames: ['type', 'id', 'videoId', 'stream']
}
};

View file

@ -95,7 +95,7 @@ const Router = ({ className, onPathNotMatch, ...props }) => {
<div className={classnames(className, 'routes-container')}>
{
views
.filter(view => view !== null)
.filter((view) => view !== null)
.map(({ key, component, urlParams, queryParams }, index, views) => (
<RouteFocusedProvider key={key} value={index === views.length - 1}>
<Route>

View file

@ -5,7 +5,7 @@ const Icon = require('stremio-icons/dom');
const { Button } = require('stremio/common');
const styles = require('./styles');
const Addon = ({ className, id, name, logo, description, types, version, transportUrl, installed, toggle, onShareButtonClicked }) => {
const Addon = ({ className, id, name, logo, description, types, version, installed, toggle, onShareButtonClicked }) => {
const onKeyUp = React.useCallback((event) => {
if (event.key === 'Enter' && typeof toggle === 'function') {
toggle(event);
@ -72,7 +72,6 @@ Addon.propTypes = {
description: PropTypes.string,
types: PropTypes.arrayOf(PropTypes.string),
version: PropTypes.string,
transportUrl: PropTypes.string,
installed: PropTypes.bool,
toggle: PropTypes.func,
onShareButtonClicked: PropTypes.func

View file

@ -1,4 +1,5 @@
const React = require('react');
const PropTypes = require('prop-types');
const Icon = require('stremio-icons/dom');
const { Button, Multiselect, NavBar, TextInput, SharePrompt, ModalDialog } = require('stremio/common');
const Addon = require('./Addon');
@ -163,4 +164,9 @@ const Addons = ({ urlParams, queryParams }) => {
);
};
Addons.propTypes = {
urlParams: PropTypes.instanceOf(URLSearchParams),
queryParams: PropTypes.instanceOf(URLSearchParams)
};
module.exports = Addons;

View file

@ -32,7 +32,7 @@ const Board = () => {
{board.catalog_resources.map((catalog_resource, index) => {
const title = `${catalog_resource.addon_name} - ${catalog_resource.request.path.id} ${catalog_resource.request.path.type_name}`;
switch (catalog_resource.content.type) {
case 'Ready':
case 'Ready': {
return (
<MetaRow
key={index}
@ -43,7 +43,8 @@ const Board = () => {
limit={10}
/>
);
case 'Err':
}
case 'Err': {
const message = `Error(${catalog_resource.content.content.type})${typeof catalog_resource.content.content.content === 'string' ? ` - ${catalog_resource.content.content.content}` : ''}`;
return (
<MetaRow
@ -54,7 +55,8 @@ const Board = () => {
limit={10}
/>
);
case 'Loading':
}
case 'Loading': {
return (
<MetaRow.Placeholder
key={index}
@ -63,6 +65,7 @@ const Board = () => {
limit={10}
/>
);
}
}
})}
</div>

View file

@ -1,4 +1,5 @@
const React = require('react');
const PropTypes = require('prop-types');
const classnames = require('classnames');
const Icon = require('stremio-icons/dom');
const { Button, MainNavBar, MetaItem, MetaPreview, Multiselect, ModalDialog, PaginationInput, useBinaryState } = require('stremio/common');
@ -135,4 +136,9 @@ const Discover = ({ urlParams, queryParams }) => {
);
};
Discover.propTypes = {
urlParams: PropTypes.instanceOf(URLSearchParams),
queryParams: PropTypes.instanceOf(URLSearchParams)
};
module.exports = Discover;

View file

@ -1,4 +1,5 @@
const React = require('react');
const PropTypes = require('prop-types');
const classnames = require('classnames');
const Icon = require('stremio-icons/dom');
const { useRouteFocused } = require('stremio-router');
@ -73,14 +74,17 @@ const Intro = ({ queryParams }) => {
React.useEffect(() => {
const onEvent = ({ event, args }) => {
switch (event) {
case 'CtxActionErr':
case 'CtxActionErr': {
const [_action, error] = args;
dispatch({ type: 'error', error: error.args.message });
case 'CtxChanged':
break;
}
case 'CtxChanged': {
const state = core.getState();
if (state.ctx.content.auth !== null) {
window.location.replace('#/');
}
}
}
};
if (routeFocused) {
@ -343,4 +347,8 @@ const Intro = ({ queryParams }) => {
);
};
Intro.propTypes = {
queryParams: PropTypes.instanceOf(URLSearchParams)
};
module.exports = Intro;

View file

@ -1,4 +1,5 @@
const React = require('react');
const PropTypes = require('prop-types');
const classnames = require('classnames');
const { Button, Multiselect, MainNavBar, MetaItem } = require('stremio/common');
const useLibrary = require('./useLibrary');
@ -67,6 +68,11 @@ const Library = ({ urlParams, queryParams }) => {
</div>
</div>
);
}
};
Library.propTypes = {
urlParams: PropTypes.instanceOf(URLSearchParams),
queryParams: PropTypes.instanceOf(URLSearchParams)
};
module.exports = Library;

View file

@ -10,7 +10,7 @@ const DISMISS_OPTION = {
value: 'dismiss'
};
const onSelect = (event) => {
const onSelect = (_event) => {
// TODO {{event.value}} {{event.dataset}}
};

View file

@ -90,6 +90,6 @@ const useLibrary = (urlParams, queryParams) => {
init: initLibraryState,
onNewState: onNewLibraryState
});
}
};
module.exports = useLibrary;

View file

@ -1,4 +1,5 @@
const React = require('react');
const PropTypes = require('prop-types');
const { NavBar, MetaPreview, useInLibrary } = require('stremio/common');
const VideosList = require('./VideosList');
const StreamsList = require('./StreamsList');
@ -98,4 +99,8 @@ const MetaDetails = ({ urlParams }) => {
);
};
MetaDetails.propTypes = {
urlParams: PropTypes.instanceOf(URLSearchParams)
};
module.exports = MetaDetails;

View file

@ -44,7 +44,7 @@ const StreamsList = ({ className, streamsResources }) => {
</Button>
</div>
);
}
};
StreamsList.propTypes = {
className: PropTypes.string,

View file

@ -1,4 +1,5 @@
const React = require('react');
const PropTypes = require('prop-types');
const Icon = require('stremio-icons/dom');
const { MainNavBar, MetaRow } = require('stremio/common');
const useSearch = require('./useSearch');
@ -68,6 +69,10 @@ const Search = ({ queryParams }) => {
</div>
</div>
);
}
};
Search.propTypes = {
queryParams: PropTypes.instanceOf(URLSearchParams)
};
module.exports = Search;

View file

@ -96,6 +96,6 @@ function Core() {
this.getState = getState;
Object.freeze(this);
};
}
module.exports = Core;

View file

@ -41,6 +41,6 @@ function KeyboardNavigation() {
this.stop = stop;
Object.freeze(this);
};
}
module.exports = KeyboardNavigation;

View file

@ -4,4 +4,4 @@ const useServices = require('./useServices');
module.exports = {
ServicesProvider,
useServices
};
};

View file

@ -66,6 +66,6 @@ function Shell() {
this.dispatch = dispatch;
Object.freeze(this);
};
}
module.exports = Shell;