Skip to content

Commit

Permalink
chore: yarn & eslint & prettier setup (kookmin-sw#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjeongmin committed Mar 2, 2024
1 parent 3c942ca commit 73d68e3
Show file tree
Hide file tree
Showing 14 changed files with 2,834 additions and 39 deletions.
37 changes: 35 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
{
"extends": "next/core-web-vitals"
}
"env": {
"browser": true,
"es2021": true
},
"extends": [
"next/core-web-vitals",
"airbnb",
"standard-with-typescript",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["react"],
"rules": {
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"react/jsx-filename-extension": [1, { "extensions": [".tsx", ".jsx"] }],
"react/jsx-no-useless-fragment": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"react/react-in-jsx-scope": "off"
}
}
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"arrowParens": "always",
"trailingComma": "all"
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": { "source.fixAll.eslint": "always" }
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Commit Convention

- feat: 새로운 기능 추가
- fix: 버그 수정
- docs: 문서 수정
Expand All @@ -11,6 +12,7 @@
커밋할 때 헤더에 위 내용을 작성하고 전반적인 내용을 간단하게 작성합니다. 또는 이슈로 등록이 되어있다면 이슈 번호를 함께 작성합니다.

### 예시

```bash
git commit -m "feat: add some function (#1)"

Expand All @@ -24,8 +26,13 @@ git commit -m "commit-type: [message] [issue number]
특정 기능을 위한 브랜치가 아닌 무언가를 하기 위한 브랜치라면, 의미를 잘 표현할 수 있는 이름으로 작성합니다.
### 예시
```plaintext
feat/...
refactor/...
```
## Package Manager
현재 패키지 매니저로는 `yarn` 을 사용하고 있습니다.
17 changes: 15 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,21 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.2.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-next": "14.1.0",
"typescript": "^5"
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^43.0.1",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"prettier": "^3.2.5",
"typescript": "*"
}
}
6 changes: 3 additions & 3 deletions src/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
:root {
--max-width: 1100px;
--border-radius: 12px;
--font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono",
"Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro",
"Fira Mono", "Droid Sans Mono", "Courier New", monospace;
--font-mono: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono',
'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro',
'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;

--foreground-rgb: 0, 0, 0;
--background-start-rgb: 214, 219, 220;
Expand Down
16 changes: 8 additions & 8 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import StyledComponentsRegistry from "@/lib/registry";
import StoreProvider from "@/lib/StoreProvider";
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import './globals.css';
import StyledComponentsRegistry from '@/lib/registry';
import StoreProvider from '@/lib/StoreProvider';

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

export const metadata: Metadata = {
title: "maru",
description: "Generated by create next app",
title: 'maru',
description: 'Generated by create next app',
};

export default function RootLayout({
Expand Down
6 changes: 4 additions & 2 deletions src/app/page.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
border-radius: var(--border-radius);
background: rgba(var(--card-rgb), 0);
border: 1px solid rgba(var(--card-border-rgb), 0);
transition: background 200ms, border 200ms;
transition:
background 200ms,
border 200ms;
}

.card span {
Expand Down Expand Up @@ -98,7 +100,7 @@

.center::before,
.center::after {
content: "";
content: '';
left: 50%;
position: absolute;
filter: blur(45px);
Expand Down
6 changes: 3 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Image from "next/image";
import styles from "./page.module.css";
import Image from 'next/image';
import styles from './page.module.css';

export default function Home() {
return (
Expand All @@ -15,7 +15,7 @@ export default function Home() {
target="_blank"
rel="noopener noreferrer"
>
By{" "}
By{' '}
<Image
src="/vercel.svg"
alt="Vercel Logo"
Expand Down
11 changes: 6 additions & 5 deletions src/lib/StoreProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"use client";
import { useRef } from "react";
import { Provider } from "react-redux";
import { makeStore, AppStore } from "../lib/store";
'use client';

import { useRef } from 'react';
import { Provider } from 'react-redux';
import { makeStore, type AppStore } from './store';

export default function StoreProvider({
children,
}: {
children: React.ReactNode;
}) {
const storeRef = useRef<AppStore>();
if (!storeRef.current) {
if (storeRef?.current === undefined) {
// Create the store instance the first time this renders
storeRef.current = makeStore();

Expand Down
6 changes: 3 additions & 3 deletions src/lib/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDispatch, useSelector, useStore } from "react-redux";
import type { TypedUseSelectorHook } from "react-redux";
import type { RootState, AppDispatch, AppStore } from "./store";
import { useDispatch, useSelector, useStore } from 'react-redux';
import type { TypedUseSelectorHook } from 'react-redux';
import type { RootState, AppDispatch, AppStore } from './store';

// Use throughout your app instead of plain `useDispatch` and `useSelector`
export const useAppDispatch: () => AppDispatch = useDispatch;
Expand Down
10 changes: 5 additions & 5 deletions src/lib/registry.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client";
'use client';

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

export default function StyledComponentsRegistry({
children,
Expand All @@ -19,7 +19,7 @@ export default function StyledComponentsRegistry({
return <>{styles}</>;
});

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

return (
<StyleSheetManager sheet={styledComponentsStyleSheet.instance}>
Expand Down
11 changes: 5 additions & 6 deletions src/lib/store.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { configureStore } from "@reduxjs/toolkit";
import { configureStore } from '@reduxjs/toolkit';

export const makeStore = () => {
return configureStore({
export const makeStore = () =>
configureStore({
reducer: {},
});
};

// Infer the type of makeStore
export type AppStore = ReturnType<typeof makeStore>;
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<AppStore["getState"]>;
export type AppDispatch = AppStore["dispatch"];
export type RootState = ReturnType<AppStore['getState']>;
export type AppDispatch = AppStore['dispatch'];
Loading

0 comments on commit 73d68e3

Please sign in to comment.