Skip to content

Commit

Permalink
Add lint action (#42)
Browse files Browse the repository at this point in the history
- Fix some remaining lint issues
- Add an action to run on pull requests and pushes to main. For now it
runs `npm run lint`
  • Loading branch information
davelange authored Oct 3, 2024
1 parent b85fb6d commit 4b67cb5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
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

0 comments on commit 4b67cb5

Please sign in to comment.