Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

clear lint #4

Merged
merged 3 commits into from
Sep 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/models/IConstructor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
// Interface style:
export default interface IConstructor<T> extends Function {
new (...args: any[]): T;
}

// Union Type style:
export type ConstructorUnion<T> = new (...args: any[]) => T;
export type IConstructor<T> = new (...args: any[]) => T;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be called IConstructor if it is not an interface?

16 changes: 10 additions & 6 deletions src/serviceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const isLocalhost = Boolean(
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we delete this files?

);

type Config = {
interface IConfig {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
};
}

export function register(config?: Config) {
export function register(config?: IConfig) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL((process as { env: { [key: string]: string } }).env.PUBLIC_URL, window.location.href);
Expand All @@ -44,7 +44,8 @@ export function register(config?: Config) {
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log('This web app is being served cache-first by a service ' + 'worker. To learn more, visit https://bit.ly/CRA-PWA');
/* tslint:disable-next-line no-console */
console.log('This web app is being served cache-first by a service worker. To learn more, visit https://bit.ly/CRA-PWA');
});
} else {
// Is not localhost. Just register service worker
Expand All @@ -54,7 +55,7 @@ export function register(config?: Config) {
}
}

function registerValidSW(swUrl: string, config?: Config) {
function registerValidSW(swUrl: string, config?: IConfig) {
navigator.serviceWorker
.register(swUrl)
.then((registration) => {
Expand All @@ -69,6 +70,7 @@ function registerValidSW(swUrl: string, config?: Config) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
/* tslint:disable-next-line no-console */
console.log('New content is available and will be used when all ' + 'tabs for this page are closed. See https://bit.ly/CRA-PWA.');

// Execute callback
Expand All @@ -79,6 +81,7 @@ function registerValidSW(swUrl: string, config?: Config) {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
/* tslint:disable-next-line no-console */
console.log('Content is cached for offline use.');

// Execute callback
Expand All @@ -95,7 +98,7 @@ function registerValidSW(swUrl: string, config?: Config) {
});
}

function checkValidServiceWorker(swUrl: string, config?: Config) {
function checkValidServiceWorker(swUrl: string, config?: IConfig) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then((response) => {
Expand All @@ -114,6 +117,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
}
})
.catch(() => {
/* tslint:disable-next-line no-console */
console.log('No internet connection found. App is running in offline mode.');
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/EffectUtility.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HttpUtility from './HttpUtility';
import { AxiosResponse } from 'axios';
import IConstructor from '../models/IConstructor';
import { IConstructor } from '../models/IConstructor';
import HttpErrorResponseModel from '../models/HttpErrorResponseModel';

export default class EffectUtility {
Expand Down
6 changes: 3 additions & 3 deletions src/views/components/main-nav/MainNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { NavLink, NavLinkProps } from 'react-router-dom';
interface IProps {}
interface IState {}

const Nav = (props: NavLinkProps) => <NavLink exact {...props} activeClassName="active" />;
const Nav = (props: NavLinkProps) => <NavLink exact={true} {...props} activeClassName="active" />;

export default class MainNav extends React.Component<IProps, IState> {
public render(): JSX.Element {
return (
<Segment inverted>
<Menu inverted pointing secondary>
<Segment inverted={true}>
<Menu inverted={true} pointing={true} secondary={true}>
<Menu.Item as={Nav} to="/" name="home" />
<Menu.Item as={Nav} to="/episodes" name="Episodes" />
</Menu>
Expand Down
2 changes: 1 addition & 1 deletion src/views/episodes-page/EpisodesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class EpisodesPage extends React.Component<IProps & IStateToProps & ReduxProps<a
{model.rows.map((row: IEpisodeTableRow) => (
<Table.Row key={row.episode}>
<Table.Cell>
<Image src={row.image} rounded size="small" />
<Image src={row.image} rounded={true} size="small" />
</Table.Cell>
<Table.Cell>{row.episode}</Table.Cell>
<Table.Cell>{row.date}</Table.Cell>
Expand Down
2 changes: 1 addition & 1 deletion src/views/home-page/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class HomePage extends React.Component<IProps & IStateToProps & ReduxProps<any,
return (
<div className={styles.wrapper}>
<MainOverview />
<Divider horizontal>
<Divider horizontal={true}>
<Header as="h4">
<Icon name="users" /> Cast
</Header>
Expand Down