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

Add lint action #42

Merged
merged 7 commits into from
Oct 3, 2024
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
27 changes: 27 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install Node.js dependencies
run: npm install

- name: Run linters
run: npm run lint
2 changes: 1 addition & 1 deletion src/app/_graphql/contentFromAuthor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MEDIA_FIELDS } from '@/app/_graphql/media'
import { MEDIA_FIELDS } from './media'

export const CONTENT_FROM_AUTHOR = `
query GetContent($authorID: JSON!) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/_utilities/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { ContentTypeArrays } from '@/app/_interfaces/ContentTypeArrays'

export async function fetcher(args: {
query: string
variables?: Record<string, any>
variables?: Record<string, unknown>
}): Promise<ContentTypeArrays> {
const { query, variables } = args

Expand Down
15 changes: 8 additions & 7 deletions src/app/_utilities/filterArticles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { ContentTypeArrays } from '../_interfaces/ContentTypeArrays'

import type {
Blogpost,
CaseStudy,
Expand All @@ -24,11 +22,14 @@ export function filterArticles({ articles, filter = 'All' }: ArticleFilterProps)
if (filter === 'All') {
const keys = Object.keys(articles) as Array<keyof ArticleFilterProps['articles']>

return keys.flatMap(articleType =>
articles[articleType].map(article => ({
contentType: articleType,
content: article,
})),)
return keys.flatMap(
articleType =>
articles[articleType].map(article => ({
contentType: articleType,
content: article,
})),
undefined,
)
}

return articles[filter]?.map(article => ({
Expand Down
2 changes: 0 additions & 2 deletions src/payload/globals/Socials.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type { GlobalConfig } from 'payload/types'

import link from '../fields/link'

export const Socials: GlobalConfig = {
slug: 'socials',
access: {
Expand Down
7 changes: 0 additions & 7 deletions src/server.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import express from 'express'
import path from 'path'
import payload from 'payload'

import { seed } from './payload/seed'

// This file is used to replace `server.ts` when ejecting i.e. `yarn eject`
// See `../eject.ts` for exact details on how this file is used
// See `./README.md#eject` for more information
Expand All @@ -30,11 +28,6 @@ const start = async (): Promise<void> => {
},
})

if (process.env.PAYLOAD_SEED === 'true') {
await seed(payload)
process.exit()
}

app.listen(PORT, async () => {
payload.logger.info(`App URL: ${process.env.PAYLOAD_PUBLIC_SERVER_URL}`)
})
Expand Down
Loading