Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
51 changes: 51 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: PR Check

on:
pull_request:
types: [opened, synchronize, reopened] # ๋ชจ๋“  ๋ธŒ๋žœ์น˜์— ๋Œ€ํ•œ PR ์ฒดํฌ

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

Update GitHub Actions to latest versions.

The workflow uses older versions of GitHub Actions. Update to the latest versions for improved features and security:

  • actions/checkout@v3 โ†’ actions/checkout@v4
  • actions/setup-node@v3 โ†’ actions/setup-node@v4
  • actions/github-script@v6 โ†’ actions/github-script@v7

Also applies to: 15-15, 40-40

๐Ÿงฐ Tools
๐Ÿช› actionlint (1.7.4)

12-12: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Lint check
run: npm run lint:fix # package.json์˜ script ์‚ฌ์šฉ

- name: Format check
run: npm run format # package.json์˜ script ์‚ฌ์šฉ

- name: Type check
run: npx tsc --noEmit

- name: Run tests
run: npm run test # package.json์˜ script ์‚ฌ์šฉ

- name: Build check
run: npm run build # package.json์˜ script ์‚ฌ์šฉ

- name: Report Status
if: always()
uses: actions/github-script@v6
with:
script: |
const status = ${{ job.status }};
const emoji = status === 'success' ? 'โœ…' : 'โŒ';
const body = `${emoji} CI Status: ${status}\n\n๊ฒ€์‚ฌ ํ•ญ๋ชฉ:\n- Lint\n- Format\n- Type Check\n- Tests\n- Build`;
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

Fix template literal syntax in GitHub Script.

The current syntax for status interpolation could cause issues. Use proper template literal syntax:

-            const status = ${{ job.status }};
-            const emoji = status === 'success' ? 'โœ…' : 'โŒ';
-            const body = `${emoji} CI Status: ${status}\n\n๊ฒ€์‚ฌ ํ•ญ๋ชฉ:\n- Lint\n- Format\n- Type Check\n- Tests\n- Build`;
+            const status = context.job.status;
+            const emoji = status === 'success' ? 'โœ…' : 'โŒ';
+            const body = `${emoji} CI Status: ${status}\n\n๊ฒ€์‚ฌ ํ•ญ๋ชฉ:\n- Lint\n- Format\n- Type Check\n- Tests\n- Build`;
๐Ÿ“ Committable suggestion

โ€ผ๏ธ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const status = ${{ job.status }};
const emoji = status === 'success' ? 'โœ…' : 'โŒ';
const body = `${emoji} CI Status: ${status}\n\n๊ฒ€์‚ฌ ํ•ญ๋ชฉ:\n- Lint\n- Format\n- Type Check\n- Tests\n- Build`;
const status = context.job.status;
const emoji = status === 'success' ? 'โœ…' : 'โŒ';
const body = `${emoji} CI Status: ${status}\n\n๊ฒ€์‚ฌ ํ•ญ๋ชฉ:\n- Lint\n- Format\n- Type Check\n- Tests\n- Build`;

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
});
42 changes: 42 additions & 0 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR Labeler
on:
pull_request:
types: [opened, edited]

jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

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

๐Ÿ› ๏ธ Refactor suggestion

Update GitHub Actions to latest versions.

Similar to pr-check.yml, update to the latest versions:

  • actions/checkout@v3 โ†’ actions/checkout@v4
  • actions/github-script@v6 โ†’ actions/github-script@v7

Also applies to: 13-13

๐Ÿงฐ Tools
๐Ÿช› actionlint (1.7.4)

10-10: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


- name: Label PR based on commit messages
uses: actions/github-script@v6
with:
script: |
const commits = await github.rest.pulls.listCommits({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});

const labels = new Set();

commits.data.forEach(commit => {
const msg = commit.commit.message;
if (msg.startsWith('feat[')) labels.add('โœจ feat');
if (msg.startsWith('fix[')) labels.add('๐Ÿ› fix');
if (msg.startsWith('style[')) labels.add('๐Ÿ’„ style');
if (msg.startsWith('refactor[')) labels.add('โ™ป๏ธ refactor');
if (msg.startsWith('test[')) labels.add('โœ… test');
if (msg.startsWith('docs[')) labels.add('๐Ÿ“ docs');
if (msg.startsWith('chore[')) labels.add('๐Ÿ”ง chore');
});

if (labels.size > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: Array.from(labels)
});
}
5 changes: 4 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"plugins": ["prettier-plugin-tailwindcss"],
"plugins": [
"prettier-plugin-tailwindcss",
"@trivago/prettier-plugin-sort-imports"
],
"importOrder": [
"^@utils/(.*)$",
"^@apis/(.*)$",
Expand Down
2 changes: 1 addition & 1 deletion __tests__/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Home from '@/app/page';
import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import Home from '@/app/page';

describe('Page', () => {
it('renders a heading', () => {
Expand Down
33 changes: 14 additions & 19 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@ const compat = new FlatCompat({
recommendedConfig: {},
});

/** @type {import('eslint').Linter.Config[]} */
const eslintConfig = [
{
ignores: ['node_modules/', 'dist/', 'public/'],
ignores: [
'node_modules/',
'dist/',
'public/',
'.next/',
'**/*.js',
'next-env.d.ts',
],
},
...compat.extends(
'eslint:recommended',
Expand All @@ -36,9 +44,7 @@ const eslintConfig = [
parserOptions: {
ecmaVersion: 2023,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
ecmaFeatures: { jsx: true },
project: './tsconfig.json',
},
},
Expand All @@ -57,33 +63,22 @@ const eslintConfig = [
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
args: 'after-used',
varsIgnorePattern: '^_',
},
{ args: 'after-used', varsIgnorePattern: '^_' },
],
'jsx-a11y/label-has-associated-control': [
'error',
{
required: { some: ['nesting', 'id'] },
},
{ required: { some: ['nesting', 'id'] } },
],
'no-console': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/jsx-no-useless-fragment': 'warn',
},
settings: {
react: {
version: 'detect',
},
},
settings: { react: { version: 'detect' } },
},
{
files: ['*.tsx', '*.jsx'],
rules: {
'@typescript-eslint/no-use-before-define': 'off',
},
rules: { '@typescript-eslint/no-use-before-define': 'off' },
},
];

Expand Down
1 change: 0 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// jest.config.ts

import type { Config } from 'jest';
import nextJest from 'next/jest.js';

Expand Down
49 changes: 45 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:fix": "eslint --fix \"**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx}\"",
"prepare": "husky install",
"test": "jest"
Expand All @@ -23,6 +23,7 @@
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/jest": "^29.5.14",
"@types/node": "^20",
"@types/react": "^18",
Expand All @@ -45,7 +46,7 @@
"prettier-plugin-tailwindcss": "^0.5.11",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5"
"typescript": "~5.5.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
7 changes: 1 addition & 6 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } };
1 change: 1 addition & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from 'next';

import './globals.css';

export const metadata: Metadata = {
Expand Down
12 changes: 6 additions & 6 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { Config } from "tailwindcss";
import type { Config } from 'tailwindcss';

export default {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
background: 'var(--background)',
foreground: 'var(--foreground)',
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"name": "next"
}
],
"baseUrl": "src",
"baseUrl": "./src",
"paths": {
"@/*": ["src/*"],
"@/*": ["/*"],
"@/app/*": ["app/*"],
"@/components/*": ["components/*"],
"@/hooks/*": ["hooks/*"],
Expand Down
Loading