Skip to content
This repository was archived by the owner on Mar 28, 2024. It is now read-only.

Commit c949e89

Browse files
committed
refactor: return to named exports
1 parent 417e9e0 commit c949e89

File tree

12 files changed

+37
-29
lines changed

12 files changed

+37
-29
lines changed

.eslintrc.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"plugin:@typescript-eslint/eslint-recommended",
2020
"plugin:@typescript-eslint/recommended",
2121
"plugin:prettier/recommended",
22+
"prettier",
2223
"prettier/@typescript-eslint",
2324
"prettier/react",
2425
"airbnb-typescript",
@@ -36,9 +37,6 @@
3637
"@typescript-eslint/no-explicit-any": "off",
3738
"@typescript-eslint/indent": "off",
3839
"prettier/prettier": ["error", {}, { "usePrettierrc": true }],
39-
"react/jsx-wrap-multilines": [
40-
"error",
41-
{ "declaration": false, "assignment": false }
42-
]
40+
"react/jsx-wrap-multilines": ["error", { "declaration": false, "assignment": false }]
4341
}
4442
}

packages/client/src/components/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
33
import ApolloClient from 'apollo-boost';
44
import { ApolloProvider } from '@apollo/react-hooks';
55
import { CssBaseline } from '@material-ui/core';
6-
import Home from './Home';
6+
import { Home } from './Home';
77

88
export default function App() {
99
const client = new ApolloClient({

packages/client/src/components/Home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const useStyles = makeStyles((theme: Theme) => ({
1212
},
1313
}));
1414

15-
export default function Home() {
15+
export function Home() {
1616
const classes = useStyles();
1717

1818
return (

packages/client/src/components/episodes/EpisodeItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface EpisodeItemProps {
77
episode: Episode;
88
}
99

10-
export default function EpisodeItem(props: EpisodeItemProps) {
10+
export function EpisodeItem(props: EpisodeItemProps) {
1111
const { episode } = props;
1212

1313
return (

packages/client/src/components/episodes/EpisodeList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { Grid, GridProps } from '@material-ui/core';
33
import { makeStyles } from '@material-ui/core/styles';
44
import { EpisodeConnection } from '../../interfaces';
5-
import EpisodeItem from './EpisodeItem';
5+
import { EpisodeItem } from './EpisodeItem';
66

77
interface EpisodeListProps {
88
episodes: EpisodeConnection;
@@ -45,7 +45,7 @@ function GridBackground(props: StyleProps & Omit<GridProps, keyof StyleProps>) {
4545
);
4646
}
4747

48-
export default function EpisodeList(props: EpisodeListProps) {
48+
export function EpisodeList(props: EpisodeListProps) {
4949
const { episodes } = props;
5050

5151
return (
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
import EpisodeList from './EpisodeList';
2-
3-
export default EpisodeList;
1+
export { EpisodeList } from './EpisodeList';

packages/client/src/components/podcast/AddPodcastFab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface CreateOneQueueInput {
4545
queue: Queue;
4646
}
4747

48-
export default function AddPodcastFab() {
48+
export function AddPodcastFab() {
4949
const classes = useStyles();
5050
const [open, setOpen] = useState(false);
5151
const { register, handleSubmit } = useForm<FormData>();

packages/client/src/components/podcast/PodcastCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import clsx from 'clsx';
2525
import { gql } from 'apollo-boost';
2626
import { useMutation } from '@apollo/react-hooks';
2727
import { Podcast } from '../../interfaces';
28-
import EpisodeList from '../episodes';
28+
import { EpisodeList } from '../episodes';
2929

3030
interface PodcastProps {
3131
podcast: Podcast;
@@ -60,7 +60,7 @@ const useStyles = makeStyles((theme: Theme) => ({
6060
},
6161
}));
6262

63-
export default function PodcastCard(props: PodcastProps) {
63+
export function PodcastCard(props: PodcastProps) {
6464
const { podcast } = props;
6565
const [anchorElement, setAnchorElement] = useState<null | HTMLElement>(null);
6666
const [visible, setVisible] = useState(true);

packages/client/src/components/podcast/PodcastList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const GET_PODCASTS = gql`
5151
}
5252
`;
5353

54-
export default function PodcastList() {
54+
export function PodcastList() {
5555
const { loading, data } = useQuery<Podcasts>(GET_PODCASTS);
5656

5757
return (
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { default as AddPodcastFab } from './AddPodcastFab';
2-
export { default as PodcastCard } from './PodcastCard';
3-
export { default as PodcastList } from './PodcastList';
1+
export { AddPodcastFab } from './AddPodcastFab';
2+
export { PodcastCard } from './PodcastCard';
3+
export { PodcastList } from './PodcastList';

packages/server/ormconfig.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1+
import path from 'path';
12
import { ConnectionOptions } from 'typeorm';
23
import { config } from 'dotenv';
34

45
config();
56

7+
let port: number;
8+
9+
if (process.env.DATABASE_PORT) {
10+
port = parseInt(process.env.DATABASE_PORT, 10);
11+
} else {
12+
port = 5432;
13+
}
14+
615
const databaseConfig: ConnectionOptions = {
716
type: 'postgres',
817
host: process.env.DATABASE_HOST || 'localhost',
9-
port: parseInt(process.env.DATABASE_PORT) || 5432,
18+
port,
1019
database: process.env.DATABASE_SCHEMA || 'speakrr',
1120
username: process.env.DATABASE_USERNAME || 'speakrr',
1221
password: process.env.DATABASE_PASSWORD || 'speakrr',
1322

14-
entities: [__dirname + '/**/*.entity.{ts,js}'],
15-
migrations: [__dirname + '/src/db/migrations/*.{ts,js}'],
23+
entities: [path.join(__dirname, '**', '*.entity.{ts,js}')],
24+
migrations: [path.join(__dirname, 'src', 'db', 'migrations', '*.{ts,js}')],
1625

1726
synchronize: false,
1827

packages/server/src/modules/app/TypeOrmPinoLogger.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
12
import { Logger, QueryRunner } from 'typeorm';
23
import { PinoLogger } from 'nestjs-pino';
34

45
export class TypeOrmPinoLogger implements Logger {
56
constructor(private readonly logger: PinoLogger) {}
67

7-
logQuery(query: string, parameters?: any[], queryRunner?: QueryRunner) {
8+
logQuery(query: string, parameters?: any[], _queryRunner?: QueryRunner) {
89
const sql =
910
query +
1011
(parameters && parameters.length
11-
? ` -- PARAMETERS: ${this.stringifyParams(parameters)}`
12+
? ` -- PARAMETERS: ${TypeOrmPinoLogger.stringifyParams(parameters)}`
1213
: '');
1314
this.logger.debug(sql);
1415
}
@@ -17,12 +18,12 @@ export class TypeOrmPinoLogger implements Logger {
1718
error: string,
1819
query: string,
1920
parameters?: any[],
20-
queryRunner?: QueryRunner
21+
queryRunner?: QueryRunner,
2122
) {
2223
const sql =
2324
query +
2425
(parameters && parameters.length
25-
? ` -- PARAMETERS: ${this.stringifyParams(parameters)}`
26+
? ` -- PARAMETERS: ${TypeOrmPinoLogger.stringifyParams(parameters)}`
2627
: '');
2728
this.logger.error(sql);
2829
}
@@ -31,12 +32,12 @@ export class TypeOrmPinoLogger implements Logger {
3132
time: number,
3233
query: string,
3334
parameters?: any[],
34-
queryRunner?: QueryRunner
35+
queryRunner?: QueryRunner,
3536
) {
3637
const sql =
3738
query +
3839
(parameters && parameters.length
39-
? ` -- PARAMETERS: ${this.stringifyParams(parameters)}`
40+
? ` -- PARAMETERS: ${TypeOrmPinoLogger.stringifyParams(parameters)}`
4041
: '');
4142
this.logger.info(sql);
4243
}
@@ -58,10 +59,12 @@ export class TypeOrmPinoLogger implements Logger {
5859
case 'warn':
5960
this.logger.warn(message);
6061
break;
62+
default:
63+
break;
6164
}
6265
}
6366

64-
protected stringifyParams(parameters: any[]) {
67+
protected static stringifyParams(parameters: any[]) {
6568
try {
6669
return JSON.stringify(parameters);
6770
} catch (error) {

0 commit comments

Comments
 (0)