Skip to content

Commit 73d68e3

Browse files
committed
chore: yarn & eslint & prettier setup (kookmin-sw#1)
1 parent 3c942ca commit 73d68e3

File tree

14 files changed

+2834
-39
lines changed

14 files changed

+2834
-39
lines changed

.eslintrc.json

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
11
{
2-
"extends": "next/core-web-vitals"
3-
}
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"next/core-web-vitals",
8+
"airbnb",
9+
"standard-with-typescript",
10+
"plugin:react/recommended",
11+
"plugin:@typescript-eslint/recommended",
12+
"prettier"
13+
],
14+
"parserOptions": {
15+
"ecmaVersion": "latest",
16+
"sourceType": "module",
17+
"project": "./tsconfig.json"
18+
},
19+
"plugins": ["react"],
20+
"rules": {
21+
"import/extensions": [
22+
"error",
23+
"ignorePackages",
24+
{
25+
"js": "never",
26+
"jsx": "never",
27+
"ts": "never",
28+
"tsx": "never"
29+
}
30+
],
31+
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],
32+
"react/jsx-no-useless-fragment": "off",
33+
"@typescript-eslint/explicit-function-return-type": "off",
34+
"react/react-in-jsx-scope": "off"
35+
}
36+
}

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"arrowParens": "always",
4+
"trailingComma": "all"
5+
}

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
4+
"editor.codeActionsOnSave": { "source.fixAll.eslint": "always" }
5+
}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Commit Convention
2+
23
- feat: 새로운 기능 추가
34
- fix: 버그 수정
45
- docs: 문서 수정
@@ -11,6 +12,7 @@
1112
커밋할 때 헤더에 위 내용을 작성하고 전반적인 내용을 간단하게 작성합니다. 또는 이슈로 등록이 되어있다면 이슈 번호를 함께 작성합니다.
1213

1314
### 예시
15+
1416
```bash
1517
git commit -m "feat: add some function (#1)"
1618

@@ -24,8 +26,13 @@ git commit -m "commit-type: [message] [issue number]
2426
특정 기능을 위한 브랜치가 아닌 무언가를 하기 위한 브랜치라면, 의미를 잘 표현할 수 있는 이름으로 작성합니다.
2527
2628
### 예시
29+
2730
```plaintext
2831
feat/...
2932
3033
refactor/...
3134
```
35+
36+
## Package Manager
37+
38+
현재 패키지 매니저로는 `yarn` 을 사용하고 있습니다.

package.json

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,21 @@
2222
"@types/node": "^20",
2323
"@types/react": "^18",
2424
"@types/react-dom": "^18",
25-
"eslint": "^8",
25+
"@typescript-eslint/eslint-plugin": "^6.4.0",
26+
"@typescript-eslint/parser": "^7.1.0",
27+
"eslint": "^8.2.0",
28+
"eslint-config-airbnb": "19.0.4",
29+
"eslint-config-airbnb-typescript": "^18.0.0",
2630
"eslint-config-next": "14.1.0",
27-
"typescript": "^5"
31+
"eslint-config-prettier": "^9.1.0",
32+
"eslint-config-standard-with-typescript": "^43.0.1",
33+
"eslint-plugin-import": "^2.25.3",
34+
"eslint-plugin-jsx-a11y": "^6.5.1",
35+
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
36+
"eslint-plugin-promise": "^6.0.0",
37+
"eslint-plugin-react": "^7.28.0",
38+
"eslint-plugin-react-hooks": "^4.3.0",
39+
"prettier": "^3.2.5",
40+
"typescript": "*"
2841
}
2942
}

src/app/globals.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
:root {
22
--max-width: 1100px;
33
--border-radius: 12px;
4-
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
5-
"Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
6-
"Fira Mono", "Droid Sans Mono", "Courier New", monospace;
4+
--font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
5+
'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro',
6+
'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;
77

88
--foreground-rgb: 0, 0, 0;
99
--background-start-rgb: 214, 219, 220;

src/app/layout.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import type { Metadata } from "next";
2-
import { Inter } from "next/font/google";
3-
import "./globals.css";
4-
import StyledComponentsRegistry from "@/lib/registry";
5-
import StoreProvider from "@/lib/StoreProvider";
1+
import type { Metadata } from 'next';
2+
import { Inter } from 'next/font/google';
3+
import './globals.css';
4+
import StyledComponentsRegistry from '@/lib/registry';
5+
import StoreProvider from '@/lib/StoreProvider';
66

7-
const inter = Inter({ subsets: ["latin"] });
7+
const inter = Inter({ subsets: ['latin'] });
88

99
export const metadata: Metadata = {
10-
title: "maru",
11-
description: "Generated by create next app",
10+
title: 'maru',
11+
description: 'Generated by create next app',
1212
};
1313

1414
export default function RootLayout({

src/app/page.module.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
border-radius: var(--border-radius);
5252
background: rgba(var(--card-rgb), 0);
5353
border: 1px solid rgba(var(--card-border-rgb), 0);
54-
transition: background 200ms, border 200ms;
54+
transition:
55+
background 200ms,
56+
border 200ms;
5557
}
5658

5759
.card span {
@@ -98,7 +100,7 @@
98100

99101
.center::before,
100102
.center::after {
101-
content: "";
103+
content: '';
102104
left: 50%;
103105
position: absolute;
104106
filter: blur(45px);

src/app/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Image from "next/image";
2-
import styles from "./page.module.css";
1+
import Image from 'next/image';
2+
import styles from './page.module.css';
33

44
export default function Home() {
55
return (
@@ -15,7 +15,7 @@ export default function Home() {
1515
target="_blank"
1616
rel="noopener noreferrer"
1717
>
18-
By{" "}
18+
By{' '}
1919
<Image
2020
src="/vercel.svg"
2121
alt="Vercel Logo"

src/lib/StoreProvider.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
"use client";
2-
import { useRef } from "react";
3-
import { Provider } from "react-redux";
4-
import { makeStore, AppStore } from "../lib/store";
1+
'use client';
2+
3+
import { useRef } from 'react';
4+
import { Provider } from 'react-redux';
5+
import { makeStore, type AppStore } from './store';
56

67
export default function StoreProvider({
78
children,
89
}: {
910
children: React.ReactNode;
1011
}) {
1112
const storeRef = useRef<AppStore>();
12-
if (!storeRef.current) {
13+
if (storeRef?.current === undefined) {
1314
// Create the store instance the first time this renders
1415
storeRef.current = makeStore();
1516

src/lib/hooks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { useDispatch, useSelector, useStore } from "react-redux";
2-
import type { TypedUseSelectorHook } from "react-redux";
3-
import type { RootState, AppDispatch, AppStore } from "./store";
1+
import { useDispatch, useSelector, useStore } from 'react-redux';
2+
import type { TypedUseSelectorHook } from 'react-redux';
3+
import type { RootState, AppDispatch, AppStore } from './store';
44

55
// Use throughout your app instead of plain `useDispatch` and `useSelector`
66
export const useAppDispatch: () => AppDispatch = useDispatch;

src/lib/registry.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
"use client";
1+
'use client';
22

3-
import React, { useState } from "react";
4-
import { useServerInsertedHTML } from "next/navigation";
5-
import { ServerStyleSheet, StyleSheetManager } from "styled-components";
3+
import React, { useState } from 'react';
4+
import { useServerInsertedHTML } from 'next/navigation';
5+
import { ServerStyleSheet, StyleSheetManager } from 'styled-components';
66

77
export default function StyledComponentsRegistry({
88
children,
@@ -19,7 +19,7 @@ export default function StyledComponentsRegistry({
1919
return <>{styles}</>;
2020
});
2121

22-
if (typeof window !== "undefined") return <>{children}</>;
22+
if (typeof window !== 'undefined') return <>{children}</>;
2323

2424
return (
2525
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>

src/lib/store.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { configureStore } from "@reduxjs/toolkit";
1+
import { configureStore } from '@reduxjs/toolkit';
22

3-
export const makeStore = () => {
4-
return configureStore({
3+
export const makeStore = () =>
4+
configureStore({
55
reducer: {},
66
});
7-
};
87

98
// Infer the type of makeStore
109
export type AppStore = ReturnType<typeof makeStore>;
1110
// Infer the `RootState` and `AppDispatch` types from the store itself
12-
export type RootState = ReturnType<AppStore["getState"]>;
13-
export type AppDispatch = AppStore["dispatch"];
11+
export type RootState = ReturnType<AppStore['getState']>;
12+
export type AppDispatch = AppStore['dispatch'];

0 commit comments

Comments
 (0)