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

Commit b94848f

Browse files
author
Greg Rickaby
authored
Merge pull request #91 from WebDevStudios/fix/cleanup
Fix/cleanup
2 parents 3deaea8 + 73ade50 commit b94848f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+522
-270
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module.exports = {
3737
'jsdoc/require-param': [
3838
'warn',
3939
{
40+
checkRestProperty: true,
4041
unnamedRootBase: ['props']
4142
}
4243
],

api/apolloConfig.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__'
1010
* Init Apollo and merge with initial state.
1111
*
1212
* @author WebDevStudios
13-
* @param {Object} apolloClient Apollo client instance.
14-
* @param {mixed} initialState The initial state of things.
15-
* @return {Object} Apollo client instance.
13+
* @param {object} apolloClient Apollo client instance.
14+
* @param {*} initialState The initial state of things.
15+
* @return {object} Apollo client instance.
1616
*/
1717
export function initializeApollo(apolloClient, initialState = null) {
1818
// If a page has Next.js data fetching methods that
@@ -43,9 +43,9 @@ export function initializeApollo(apolloClient, initialState = null) {
4343
* Pass down Apollo state to page props.
4444
*
4545
* @author WebDevStudios
46-
* @param {Object} client Apollo Client props.
47-
* @param {Object} pageProps Props from getStaticProps().
48-
* @return {Object} Updated page props.
46+
* @param {object} client Apollo Client props.
47+
* @param {object} pageProps Props from getStaticProps().
48+
* @return {object} Updated page props.
4949
*/
5050
export function addApolloState(client, pageProps) {
5151
if (pageProps?.props) {
@@ -59,8 +59,8 @@ export function addApolloState(client, pageProps) {
5959
* Only update when the cache value has changed.
6060
*
6161
* @author WebDevStudios
62-
* @param {Object} pageProps Props from getStaticProps().
63-
* @return {Object} WP Apollo client instance.
62+
* @param {object} pageProps Props from getStaticProps().
63+
* @return {object} WP Apollo client instance.
6464
*/
6565
export function useApollo(pageProps) {
6666
const state = pageProps[APOLLO_STATE_PROP_NAME]

api/frontend/connector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const restLink = new RestLink({
1515
* @see https://www.apollographql.com/docs/react/api/core/ApolloClient/
1616
*
1717
* @author WebDevStudios
18-
* @return {Object} Apollo client instance.
18+
* @return {object} Apollo client instance.
1919
*/
2020
export function createFeApolloClient() {
2121
return new ApolloClient({
@@ -29,8 +29,8 @@ export function createFeApolloClient() {
2929
* Init Apollo for Frontend API and merge with initial state.
3030
*
3131
* @author WebDevStudios
32-
* @param {mixed} initialState Initial Apollo state.
33-
* @return {Object} Frontend Apollo client instance.
32+
* @param {*} initialState Initial Apollo state.
33+
* @return {object} Frontend Apollo client instance.
3434
*/
3535
export function initializeFeApollo(initialState = null) {
3636
// Only run one instance of the Apollo client.

api/frontend/wp/archive/getArchivePosts.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {initializeFeApollo} from '../../connector'
55
* Retrieve next page of posts for post type archive.
66
*
77
* @author WebDevStudios
8-
* @param {string} postType WP post type.
9-
* @param {string} orderBy Order by: field.
10-
* @param {string} order Order by: direction.
11-
* @param {string} cursor Start cursor for pagination.
12-
* @return {Object} Archive post and pagination data or error object.
8+
* @param {string} postType WP post type.
9+
* @param {string} cursor Start cursor for pagination.
10+
* @param {string} orderBy Order by: field.
11+
* @param {string} order Order by: direction.
12+
* @return {object} Archive post and pagination data or error object.
1313
*/
1414
export default async function getArchivePosts(
1515
postType,

api/wordpress/_global/getPostTypeArchive.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import queryTestimonialsArchive from '../testimonials/queryTestimonialsArchive'
1212
* Retrieve post archive.
1313
*
1414
* @author WebDevStudios
15-
* @param {string} postType WP post type.
16-
* @param {string} orderBy Order by: field.
17-
* @param {string} order Order by: direction.
18-
* @param {string} cursor Start/end cursor for pagination.
19-
* @param {bool} getNext Whether to retrieve next set of posts (true) or previous set (false).
20-
* @param {number} perPage Number of posts per page.
21-
* @return {Object} Object containing Apollo client instance and post archive data or error object.
15+
* @param {string} postType WP post type.
16+
* @param {string} orderBy Order by: field.
17+
* @param {string} order Order by: direction.
18+
* @param {string} cursor Start/end cursor for pagination.
19+
* @param {boolean} getNext Whether to retrieve next set of posts (true) or previous set (false).
20+
* @param {number} perPage Number of posts per page.
21+
* @return {object} Object containing Apollo client instance and post archive data or error object.
2222
*/
2323
export default async function getPostTypeArchive(
2424
postType,

api/wordpress/_global/getPostTypeById.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import queryTestimonialById from '../testimonials/queryTestimonialById'
1414
* Retrieve single post by specified identifier.
1515
*
1616
* @author WebDevStudios
17-
* @param {string} postType WP post type.
18-
* @param {Number|string} id Post identifier.
19-
* @param {string} idType Type of ID.
20-
* @return {Object} Object containing Apollo client instance and post data or error object.
17+
* @param {string} postType WP post type.
18+
* @param {number | string} id Post identifier.
19+
* @param {string} idType Type of ID.
20+
* @return {object} Object containing Apollo client instance and post data or error object.
2121
*/
2222
export default async function getPostTypeById(postType, id, idType = 'SLUG') {
2323
// Define single post query based on post type.

api/wordpress/_global/getPostTypeStaticPaths.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {initializeWpApollo} from '../connector'
66
* Retrieve static paths by post type.
77
*
88
* @author WebDevStudios
9-
* @param {string} postType WP post type.
10-
* @return {Object} Post type paths.
9+
* @param {string} postType WP post type.
10+
* @return {object} Post type paths.
1111
*/
1212
export default async function getPostTypeStaticPaths(postType) {
1313
if (!postType || !isValidPostType(postType)) {

api/wordpress/_global/getPostTypeStaticProps.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ import {addApolloState} from '@/api/apolloConfig'
77
* Retrieve static props by post type.
88
*
99
* @author WebDevStudios
10-
* @param {string} params Post params (e.g., slug).
11-
* @param {string} postType Post Type.
12-
* @param {boolean} preview Whether requesting preview of post.
13-
* @param {?Object} previewData Post preview data.
14-
* @return {Object} Object containing post props and revalidate setting.
10+
* @param {string} params Post params (e.g., slug).
11+
* @param {string} postType Post Type.
12+
* @return {object} Object containing post props and revalidate setting.
1513
*/
1614
export default async function getPostTypeStaticProps(
1715
params,

api/wordpress/_global/postTypes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export const hierarchicalPostTypes = ['page']
1919
* Check if post type is valid.
2020
*
2121
* @author WebDevStudios
22-
* @param {string} postType WP post type.
23-
* @return {bool} Whether provided post type is valid.
22+
* @param {string} postType WP post type.
23+
* @return {boolean} Whether provided post type is valid.
2424
*/
2525
export function isValidPostType(postType) {
2626
return Object.keys(postTypes).includes(postType)
@@ -30,8 +30,8 @@ export function isValidPostType(postType) {
3030
* Check if post type is hierarchical.
3131
*
3232
* @author WebDevStudios
33-
* @param {string} postType WP post type.
34-
* @return {bool} Whether provided post type is hierarchical.
33+
* @param {string} postType WP post type.
34+
* @return {boolean} Whether provided post type is hierarchical.
3535
*/
3636
export function isHierarchicalPostType(postType) {
3737
return hierarchicalPostTypes.includes(postType)

api/wordpress/connector.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let wpApolloClient
2121
* @see https://www.apollographql.com/docs/react/api/core/ApolloClient/
2222
*
2323
* @author WebDevStudios
24-
* @return {Object} Apollo client instance.
24+
* @return {object} Apollo client instance.
2525
*/
2626
export function createWpApolloClient() {
2727
return new ApolloClient({
@@ -38,8 +38,8 @@ export function createWpApolloClient() {
3838
* Init Apollo for WP and merge with initial state.
3939
*
4040
* @author WebDevStudios
41-
* @param {mixed} initialState Initial Apollo state.
42-
* @return {Object} WP Apollo client instance.
41+
* @param {*} initialState Initial Apollo state.
42+
* @return {object} WP Apollo client instance.
4343
*/
4444
export function initializeWpApollo(initialState = null) {
4545
// Only run one instance of the Apollo client.

0 commit comments

Comments
 (0)