Skip to content

Commit

Permalink
Merge pull request #3 from Central-MakeUs/chore-2
Browse files Browse the repository at this point in the history
chore: 프로젝트 세부 세팅
  • Loading branch information
ptq124 authored Jan 11, 2025
2 parents 0a271a8 + 1335398 commit ab5fd64
Show file tree
Hide file tree
Showing 34 changed files with 1,822 additions and 398 deletions.
11 changes: 11 additions & 0 deletions .github/actions/pnpm-setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: setup pnpm & node
description: setup pnpm & node
runs:
using: composite
steps:
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'
node-version-file: '.nvmrc'
36 changes: 36 additions & 0 deletions .github/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
env:
CI: ${{ vars.CI }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: pnpm-setup-node
uses: ./.github/actions/pnpm-setup-node

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Lint
run: pnpm lint

- name: Run Tests
run: pnpm test

- name: Run Build
run: pnpm build
31 changes: 31 additions & 0 deletions .github/workflows/assign_issue_number_to_pr_body.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: assign_issue_number_to_pr_body

on:
pull_request:
types: [opened]
branches-ignore:
- develop

jobs:
append_issue_number_to_pr_body:
runs-on: ubuntu-latest
steps:
- name: append feature number to pr body pr branch = feat/(issueNumber)
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const body = pr.data.body;
const issueNumber= pr.data.head.ref.split('-')[1];
const newBody = body + "\n\n" + "연관된 issue: #" + issueNumber;
await github.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
body: newBody
});
28 changes: 28 additions & 0 deletions .github/workflows/size-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PR Size Labeler

on:
pull_request:
types: [opened, synchronize]

jobs:
size-label:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Assign PR Size Label
uses: pascalgn/size-label-action@v0.5.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ignored: 'pnpm-lock.yaml'
with:
sizes: |
{
"0": "XS",
"20": "S",
"50": "M",
"200": "L",
"500": "XL",
"1000": "XXL"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dist-ssr
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
Expand All @@ -24,3 +25,5 @@ dist-ssr
*.sw?

*storybook.log

testResults.json
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"eamodio.gitlens",
"formulahendry.auto-rename-tag"
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"eslint.workingDirectories": [
{
"mode": "auto"
}
],
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
}
}
128 changes: 112 additions & 16 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,124 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import eslint from '@eslint/js';
import vitest from '@vitest/eslint-plugin';
import importPlugin from 'eslint-plugin-import';
import jestDom from 'eslint-plugin-jest-dom';
import react from 'eslint-plugin-react';
import reactCompiler from 'eslint-plugin-react-compiler';
import reactHooks from 'eslint-plugin-react-hooks';
import testingLibrary from 'eslint-plugin-testing-library';
import globals from 'globals';
import tseslint from 'typescript-eslint';

export default tseslint.config(
{ ignores: ['dist'] },
eslint.configs.recommended,
importPlugin.flatConfigs.recommended,
tseslint.configs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-compiler': reactCompiler,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
typescript: true,
},
},
languageOptions: {
ecmaVersion: 2020,
globals: { ...globals.browser },
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
eqeqeq: 'error',
curly: ['warn', 'multi-line', 'consistent'],
'sort-imports': [
'error',
{
ignoreDeclarationSort: true,
},
],
'import/no-unresolved': ['error', { commonjs: true, amd: true }],
'import/named': 'off',
'import/namespace': 'off',
'import/no-named-as-default-member': 'off',
'import/no-duplicates': 'error',
'import/extensions': ['error', 'ignorePackages'],
'import/order': [
'error',
{
alphabetize: { order: 'asc', caseInsensitive: true },
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
'newlines-between': 'never',
pathGroups: [
{
pattern: 'react',
group: 'builtin',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
},
],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ allowConstantExport: true },
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'react-compiler/react-compiler': 'warn',
...reactHooks.configs.recommended.rules,
},
},
{
files: [
'tests/**/*.{ts,tsx}',
'__mocks__/**.ts',
'src/**/*.spec.ts',
'src/**/*.spec.tsx',
],
...testingLibrary.configs['flat/react'],
...jestDom.configs['flat/recommended'],
...vitest.configs.recommended,
rules: {
'import/extensions': ['error', 'never'],
'@typescript-eslint/no-unused-vars': 'off',
'testing-library/no-node-access': 'off',
'vitest/expect-expect': 'off',
'vitest/consistent-test-it': [
'error',
{ fn: 'it', withinDescribe: 'it' },
],
},
languageOptions: {
globals: {
globalThis: true,
describe: true,
it: true,
expect: true,
beforeEach: true,
afterEach: true,
beforeAll: true,
afterAll: true,
vi: true,
},
},
},
{
files: ['*.js'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
)
);
92 changes: 57 additions & 35 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,57 @@
# EXAMPLE USAGE:
#
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#
# pre-push:
# commands:
# packages-audit:
# tags: frontend security
# run: yarn audit
# gems-audit:
# tags: backend security
# run: bundle audit
#
# pre-commit:
# parallel: true
# commands:
# eslint:
# glob: "*.{js,ts,jsx,tsx}"
# run: yarn eslint {staged_files}
# rubocop:
# tags: backend style
# glob: "*.rb"
# exclude: '(^|/)(application|routes)\.rb$'
# run: bundle exec rubocop --force-exclusion {all_files}
# govet:
# tags: backend style
# files: git ls-files -m
# glob: "*.go"
# run: go vet {files}
# scripts:
# "hello.js":
# runner: node
# "any.go":
# runner: go run
commit-msg:
commands:
lint-commit-msg:
run: |
npx commitlint --edit || {
echo "❌ 커밋 메시지가 형식에 맞지 않아요"
echo ""
echo "🔍 Conventinal Commits Docs"
echo "https://www.conventionalcommits.org/ko/v1.0.0"
echo ""
echo "Conventional Commit 규칙에 맞게 메시지를 작성해주세요."
echo ""
echo "✅ Examples:"
echo " feat: ~~기능을 개발했어요"
echo " fix: ~~버그를 고쳤어요"
echo " docs: 문서를 수정했어요"
echo " style: 코드 포맷을 변경했어요"
echo " refactor: 기능 변경을 하지 않고 코드를 개선했어요"
echo ""
echo "👀 사용 가능한 옵션이에요:"
echo " feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
exit 1
}
pre-push:
parallel: false
commands:
# branch-protection:
# run: |
# branch=$(git rev-parse --abbrev-ref HEAD)
# protected_branches=("main" "dev")

# for protected in "${protected_branches[@]}"; do
# if [[ "$branch" == "$protected" ]]; then
# echo "❌ Direct push to '$branch' branch is not allowed."
# echo " Please create a pull request instead."
# exit 1
# fi
# done
lint:
run: pnpm lint
stage_fixed: true
# test:
# run: npm run ci:test
# stage_fixed: true
build:
run: pnpm build
stage_fixed: true

pre-commit:
commands:
lint:
run: pnpm lint
stage_fixed: true
# test:
# run: npm run ci:test
# stage_fixed: true
Loading

0 comments on commit ab5fd64

Please sign in to comment.