๐ŸคNext.js

๐ŸŽฎNext.js ๊ฐ€ ๋ญ˜๊นŒ?

Next. ๋ฆฌ์•กํŠธ ๊ธฐ๋ฐ˜์˜ ํ”„๋ ˆ์ž„์›Œํฌ.

๋ฆฌ์•กํŠธ๋Š” โ€˜์ปดํฌ๋„ŒํŠธโ€™ ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ UI ๋ฅผ ํšจ์œจ์ ์œผ๋กœ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ ํ”„๋ ˆ์ž„์›Œํฌ ์ด๋‹ค. ๋ฆฌ์•กํŠธ ๋งŒ์œผ๋กœ๋„ ํ”„๋ก ํŠธ๊ฐœ๋ฐœ์„ ํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ, ์™œ ๊ตณ์ด

Next ๋‹ˆ ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง์ด๋ผ๋Š๋‹ˆ ํ•˜๋Š” ๊ฒƒ์„ ์•Œ๋ ค๊ณ  ํ•˜๋Š” ๊ฑธ๊นŒ?

๋จผ์ € ๋ Œ๋”๋ง์ด๋ž€ ์„œ๋ฒ„์˜ ์‘๋‹ต์„ ๋ฐ›์•„ ํ™”๋ฉด์— (๋ธŒ๋ผ์šฐ์ €์—) ๋„์šด๋‹ค๋Š” ๊ฒƒ์„ ์ƒ๊ฐํ•˜๋ฉด ์‰ฝ๋‹ค.

๐ŸŽฎReact (SPA) ์˜ ์žฅ๋‹จ์  - CSR (ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง)

๋ฆฌ์•กํŠธ ์—์„œ๋Š” ํŽ˜์ด์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ ํ•„์š”ํ•œ ๋ชจ๋“  ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ์„ ํ•œ๋ฒˆ์— ๋ถˆ๋Ÿฌ์˜จ๋‹ค.

ํŽ˜์ด์ง€ ์ด๋™์„ ํ†ตํ•ด ๋ฐ›์•„์˜จ ํŒŒ์ผ์„ ์ด์šฉํ•˜์—ฌ UI ๋ฅผ ๋ณ€ํ™”์‹œํ‚ค๋ฉฐ ํ•„์š”ํ•œ ๋ฐ์ดํ„ฐ๋Š” ์„œ๋ฒ„์—์„œ JSON ํ˜•ํƒœ๋กœ ๋ฐ›์•„ UI ๋ฅผ ๋น ๋ฅด๊ฒŒ ๋ณ€ํ™”์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ํ•˜๋‚˜์˜ ํŽ˜์ด์ง€๋ฅผ ๋ถˆ๋Ÿฌ ์˜ฌ ๋•Œ๋งˆ๋‹ค ๋ชจ๋“  ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅผ ๋ถˆ๋Ÿฌ์™€์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ฒ˜์Œ ํŽ˜์ด์ง€๋ฅผ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ ์‹œ๊ฐ„์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฌ๊ฒŒ ๋œ๋‹ค๊ณ  ํ•œ๋‹ค.

https://d2.naver.com/helloworld/7804182

์œ„ ๋งํฌ์— ์ข‹์€ ๋‚ด์šฉ๋“ค์ด ์žˆ์—ˆ๋‹ค. ๋”๋ถˆ์–ด ๋งํฌ์— ์žˆ๋Š” ์‚ฌ์ง„๋„ ์ฒจ๋ถ€ํ•ด ๋ณธ๋‹ค.

๊ทธ๋ฆฌ๊ณ  SPA ๋Š” (ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง์€) ๊ฒ€์ƒ‰ ์—”์ง„ ์ตœ์ ํ™” (SEO) ์— ์ข‹์ง€ ์•Š๋‹ค๊ณ  ํ•œ๋‹ค.

๊ฒ€์ƒ‰ ์—”์ง„ ์ตœ์ ํ™”(์˜์–ด: search engine optimization, SEO)๋Š” ์›น ํŽ˜์ด์ง€ ๊ฒ€์ƒ‰์—”์ง„์ด ์ž๋ฃŒ๋ฅผ ์ˆ˜์ง‘ํ•˜๊ณ  ์ˆœ์œ„๋ฅผ ๋งค๊ธฐ๋Š” ๋ฐฉ์‹์— ๋งž๊ฒŒ ์›น ํŽ˜์ด์ง€๋ฅผ ๊ตฌ์„ฑํ•ด์„œ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ์˜ ์ƒ์œ„์— ๋‚˜์˜ฌ ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ์ž‘์—…์„ ๋งํ•œ๋‹ค.

์‰ฝ๊ฒŒ ๋งํ•˜๋ฉด ์œ„์˜ ํด๋ผ์ด์–ธํŠธ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง์˜ ์˜ˆ์‹œ๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋ดค์„ ๋•Œ, ๊ฒ€์ƒ‰ ์—”์ง„ ๋ด‡์ด ์‚ฌ์ดํŠธ์— ๋ฐฉ๋ฌธํ–ˆ์„ ๋•Œ ๋กœ๋”ฉ์ค‘์ธ ์ƒํƒœ๋ผ์„œ ์ฝ˜ํ…์ธ ๋ฅผ ์ œ๊ณตํ•˜์ง€ ๋ชปํ•˜๊ฒŒ ๋˜์–ด,

์‚ฌ์ดํŠธ๋ฅผ ํŒŒ์•…ํ•˜๋Š” ๋ฐ ์–ด๋ ค์›€์ด ์ƒ๊ธฐ๊ณ  ์ผ๊ป ๊ณต๋“ค์—ฌ ๋งŒ๋“ค์–ด ๋†“์€ ๋‚ด ํŽ˜์ด์ง€๊ฐ€ ๊ฒ€์ƒ‰ ์ˆœ์œ„์— ํ˜น์€ ์•„์˜ˆ ์•ˆ๋ณด์ด๊ฒŒ ๋œ๋‹ค๋ฉด ๋งˆ์Œ์ด ์•„ํ”„์ง€ ์•Š๊ฒ ๋Š”๊ฐ€?

์ด๋Ÿฌํ•œ ๋ฌธ์ œ์ ์„ ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง (SSR) ์„ ์‚ฌ์šฉํ•จ์œผ๋กœ์จ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•œ๋‹ค.

๐ŸŽฎSSR (์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง) ์˜ ์žฅ๋‹จ์ 

์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง์€ ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•  ๋•Œ ๋ Œ๋”๋ง๋œ html ์„ ๋ถˆ๋Ÿฌ์˜ค๊ฒŒ ๋œ๋‹ค.

ํ•„์š”ํ•œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ํŒŒ์ผ์„ ๋ถˆ๋Ÿฌ์˜ฌ ๋•Œ๊นŒ์ง€ ๋ฐ˜์‘์€ ํ•˜์ง€ ์•Š์ง€๋งŒ, ๋น ๋ฅด๊ฒŒ ํ™”๋ฉด์„ ๋ณด์ผ ์ˆ˜ ์žˆ๊ธฐ์— ์†๋„๊ฐ€ ๋นจ๋ผ ๋ณด์ด๊ฒŒ ๋œ๋‹ค๊ณ  ํ•œ๋‹ค.

๊ฒ€์ƒ‰ ์—”์ง„ ๋ด‡์— ๋ Œ๋”๋ง ๋œ html ์„ ์ œ๊ณตํ•˜์—ฌ ๊ฒ€์ƒ‰ ์—”์ง„ ์ตœ์ ํ™”์—๋„ ์ข‹๋‹ค.

ํ•˜์ง€๋งŒ ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง์€ ํŽ˜์ด์ง€ ์ด๋™ ์‹œ ์ƒˆ๋กœ์šด ํŽ˜์ด์ง€๋ฅผ ์š”์ฒญํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํŽ˜์ด์ง€ ์ด๋™์‹œ์— ๊นœ๋ฐ•์ž„์ด ์กด์žฌํ•œ๋‹ค.

๋˜ํ•œ ํŽ˜์ด์ง€ ์ด๋™ ์‹œ ํ…œํ”Œ๋ฆฟ์„ ์ค‘๋ณตํ•ด์„œ ๋กœ๋”ฉํ•˜๊ณ  SSR ์„ ํ•˜๋Š” ๊ฒƒ์ด ์„œ๋ฒ„์— ๋ถ€๋‹ด์„ ์ฃผ๊ธฐ ๋•Œ๋ฌธ์— ์„ฑ๋Šฅ์ƒ ์ข‹์ง€ ์•Š๋‹ค๋Š” ๋‹จ์ ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค ํ•œ๋‹ค.

๐ŸŽฎ๊ทธ๋ž˜์„œ Next

๋„ฅ์ŠคํŠธ๋Š” SPA ์™€ SSR ์˜ ๋‹จ์ ์„ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ ๋ฆฌ์•กํŠธ ์— ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง ๊ธฐ๋Šฅ์„ ๋”ํ•˜์—ฌ SPA ์™€ SSR ์˜ ์žฅ์ ์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ฒŒ ๋œ๋‹ค.

๋ฆฌ์•กํŠธ ์ž์ฒด์—์„œ SSR ์„ ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ๋ณต์žกํ•œ ๊ณผ์ •์„ ํ•„์š”๋กœ ํ•˜์ง€๋งŒ ๋„ฅ์ŠคํŠธ ์—์„œ๋Š” ๋ณต์žกํ•œ ๊ณผ์ •์„ ์„ค์ •ํ•˜์ง€ ์•Š๊ณ  ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์–ด ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜๋Š” ์‹œ๊ฐ„์„ ์ค„์ผ ์ˆ˜ ์žˆ๋‹ค.

๐ŸŽฎNext.js ์˜ ํŠน์ง•

  1. ์‚ฌ์ „ ๋ Œ๋”๋ง ๋ฐ ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง
  2. ๋„ฅ์ŠคํŠธ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ๋นŒ๋“œ ์‹œ์— ๋งŒ๋“  ๋ชจ๋“  ํŽ˜์ด์ง€๋ฅผ ๋ฏธ๋ฆฌ ๋ Œ๋”๋ง ํ•œ๋‹ค.
  3. ์„œ๋ฒ„์˜ ๋ฐ์ดํ„ฐ๋ฅผ ํ•„์š”๋กœ ํ•˜๋Š” ํŽ˜์ด์ง€๋Š” ์š”์ฒญ ์‹œ์— ์„œ๋ฒ„ ์‚ฌ์ด๋“œ ๋ Œ๋”๋ง์„ ํ†ตํ•ด HTML ์„ ์ƒ์„ฑํ•œ๋‹ค.
  4. Hot Code Reloading ์„ ์ง€์›ํ•˜๋Š” ๊ฐœ๋ฐœ ํ™˜๊ฒฝ
  5. ์ฝ”๋“œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ์ €์žฅ๋˜๋ฉด ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ ์ž๋™์œผ๋กœ ๋‹ค์‹œ ๋กœ๋“œ
  6. ์ž๋™ ์ฝ”๋“œ ๋ถ„ํ• 
  7. ์ฝ”๋“œ์˜ ๋ชจ๋“  ๊ฐ€์ ธ์˜ค๊ธฐ๊ฐ€ ๋ฒˆ๋“ค๋กœ ๋ฌถ์—ฌ ๊ฐ ํŽ˜์ด์ง€์™€ ํ•จ๊ป˜ ์ œ๊ณต๋œ๋‹ค๊ณ  ํ•œ๋‹ค.
  8. ๋ถˆํ•„์š”ํ•œ ์ฝ”๋“œ๊ฐ€ ํŽ˜์ด์ง€์— ๋กœ๋“œ๋˜์ง€ ์•Š๊ฒŒ ํ•จ
  9. ์›นํŒฉ๊ณผ ๋ฐ”๋ฒจ์„ ์‚ฌ์šฉํ•˜๋Š” ๋„ฅ์ŠคํŠธ
  10. SSR ๋ Œ๋”๋ง ๋ฐ ๊ฐœ๋ฐœ์— ํ•„์š”ํ•œ ์„ค์ •์ด ์ด๋ฏธ ๋˜์–ด ์žˆ์Œ
  11. ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์†์‰ฝ๊ฒŒ ์ถ”๊ฐ€ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅ
  12. ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ๋‚ด์žฅ
  13. ํŒŒ์ผ๊ธฐ๋ฐ˜ ๋‚ด๋น„๊ฒŒ์ด์…˜ ๊ธฐ๋Šฅ
  14. ๋ฆฌ์•กํŠธ์˜ โ€˜react-routerโ€™ ๋ฅผ ํ†ตํ•œ ๋ผ์šฐํŒ… ์„ค์ •์„ ํŽ˜์ด์ง€ ๊ฒฝ๋กœ์— ๋Œ€ํ•ด ์ง์ ‘ ํ•ด์ค˜์•ผ ํ–ˆ๋‹ค.
  15. ๋„ฅ์ŠคํŠธ๋Š” ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ธฐ๋ฐ˜ ๋ผ์šฐํŒ…์„ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ ํด๋” ๊ฒฝ๋กœ์— ๋”ฐ๋ผ ํŽ˜์ด์ง€์˜ ๊ฒฝ๋กœ๊ฐ€ ์„ค์ •๋˜์–ด ๊ตฌ์ถ•์ด ๋น ๋ฅด๊ณ  ๊ด€๋ฆฌ๊ฐ€ ํŽธํ•˜๋‹ค.
  16. styled-jsx ์ง€์›
  17. ์ž์ฒด CSS-in-JS ์ธ styled-jsx ๋ฅผ ์ง€์›

๐ŸŽฎNext.js ํ”„๋กœ์ ํŠธ ์„ค์น˜

1. CNA (Create-Next-App) ์„ ์‚ฌ์šฉํ•œ ์„ค์น˜

node ์™€ npm ๊ทธ๋ฆฌ๊ณ  ์—๋””ํ„ฐ ๋“ฑ์˜ ์„ค์น˜๊ฐ€ ๋˜์—ˆ๋‹ค๋Š” ๊ฐ€์ •ํ•˜์— ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ CLI ์— ์ž…๋ ฅํ•œ๋‹ค.

```js
npx create-next-app
```

ํ”„๋กœ์ ํŠธ ์ด๋ฆ„ ๋“ฑ์„ ์ž…๋ ฅํ•˜๊ณ  ํด๋”๋กœ ์ด๋™ํ•˜๋ฉด ์—ฌ๋Ÿฌ ํŒŒ์ผ ํŠธ๋ฆฌ๋“ค์ด ๋ณด์ธ๋‹ค.

๊ทธ ์ค‘ package.json ์— ์žˆ๋Š” โ€œscriptโ€ ๊ฐ์ฒด ๋ถ€๋ถ„์„ ๋ณด์ž๋ฉด,

```js
"scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start"
},
```
  • yarn (npm) dev : ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์˜ ๋„ฅ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•œ๋‹ค. ๋ฆฌ์•กํŠธ์˜ npm run start ์™€ ๋น„์Šทํ•˜๋‹ค.
  • yarn (npm) build : ๋„ฅ์ŠคํŠธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋ฒˆ๋“ค์„ ๋งŒ๋“ ๋‹ค.
  • yarn (npm) start : ๋นŒ๋“œ๋œ ๋„ฅ์ŠคํŠธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•œ๋‹ค.

yarn dev ๋ฅผ ํ†ตํ•ด ์„œ๋ฒ„๊ฐ€ localhost ์˜ 3000๋ฒˆ ํฌํŠธ์—์„œ ์‹คํ–‰๋œ๋‹ค๋Š” ์ •๋ณด๊ฐ€ CLI ์— ์ถœ๋ ฅ๋œ๋‹ค.

2. ์ˆ˜๋™์œผ๋กœ ์„ค์น˜ํ•˜๊ธฐ

  1. mkdir next-app
  2. cd next-app
  3. yarn init -y (๋ชจ๋‘ yes ๋กœ ๋Œ€ํ™”์‹ ์„ธ์…˜ ๊ฑด๋„ˆ๋œ€)
  4. yarn add next react react-dom
  5. package.json ์— ๋„ฅ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•  script ๋ช…๋ น์–ด ์ถ”๊ฐ€ํ•˜๊ธฐ

    "scripts": {
        "dev": "next",
        "build": "next build",
        "start": "next start"
    },
  6. ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ ๊ฒฝ๋กœ์— pages ํด๋” (๋ผ์šฐํŒ…์„ ๋‹ด๋‹น : ์ด๋ฆ„ ์ •ํ™•ํ•ด์•ผ ํ•จ) ๋ฅผ ์ƒ์„ฑ
  7. ๊ทธ ์•ˆ์— index.jsx ํŒŒ์ผ ์ƒ์„ฑ, ๊ฐ„๋‹จํ•œ ์ปดํฌ๋„ŒํŠธ ๋งŒ๋“ค๊ณ  yarn dev ๋กœ ํ™•์ธ

๋„ฅ์ŠคํŠธ๋Š” ๋ฆฌ์•กํŠธ๋ฅผ import ํ•˜์ง€ ์•Š๋”๋ผ๋„ ์•”์‹œ์ ์œผ๋กœ import ํ•ด์ค€๋‹ค.

๐ŸŽฎEslint ์„ค์น˜, prettier ์„ค์ •

  1. ๋จผ์ € npm install -g eslint ๋กœ ๊ธ€๋กœ๋ฒŒ ์„ค์น˜ ํ•œ๋‹ค.
  2. ๊ทธ๋ฆฌ๊ณ  vscode ์—์„œ eslint ๋ฅผ ๊ฒ€์ƒ‰ํ•ด ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•œ๋‹ค.
  3. ํ”„๋กœ์ ํŠธ ํด๋” ๊ฒฝ๋กœ์—์„œ eslint โ€”init ์œผ๋กœ .eslintrc ํŒŒ์ผ ์ƒ์„ฑ
  4. .eslintrc ํŒŒ์ผ ๋‚ด ์ถ”๊ฐ€์ ์œผ๋กœ ๊ฐœ๋ฐœํ•˜๋ฉด์„œ ํ•„์š”ํ•œ ๊ทœ์น™๋“ค ์ถ”๊ฐ€ํ•˜๊ธฐ

    module.exports = {
    env: {
        browser: true,
        es6: true,
    },
    extends: ["airbnb"],
    globals: {
        Atomics: "readonly",
        SharedArrayBuffer: "readonly",
    },
    parser: "@typescript-eslint/parser",
    parserOptions: {
        ecmaFeatures: {
        jsx: true,
        },
        ecmaVersion: 2018,
        sourceType: "module",
    },
    plugins: ["react", "@typescript-eslint"],
    rules: {
        quotes: ["error", "double"], //๋”๋ธ” ์ฟผํ„ฐ ์‚ฌ์šฉ
        "@typescript-eslint/quotes": ["error", "double"], //๋”๋ธ” ์ฟผํ„ฐ ์‚ฌ์šฉ
        "no-unused-vars": "off", //์‚ฌ์šฉ์•ˆํ•œ ๋ณ€์ˆ˜ ๊ฒฝ๊ณ  ์ค‘๋ณต
        "spaced-comment": "off", //์ฃผ์„์„ ๋’ค์— ์“ฐ์ง€ ๋ง๋ผ๋Š” ๊ฒฝ๊ณ 
        "@typescript-eslint/no-unused-vars": "warn", //์‚ฌ์šฉ์•ˆํ•œ ๋ณ€์ˆ˜๋Š” ๊ฒฝ๊ณ 
        "jsx-a11y/control-has-associated-label": "off", // ์ƒํ˜ธ์ž‘์šฉํ•˜๋Š” ์—˜๋ฆฌ๋จผํŠธ์— label์„ ๋„ฃ๋Š”๋‹ค
        "react/no-array-index-key": "off", // key๊ฐ’์œผ๋กœ index๋ฅผ ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ๋‹ค.
        "comma-dangle": "off", // ๋งˆ์ง€๋ง‰์— , ์„ ๋„ฃ์–ด์ฃผ์ง€ ์•Š๋Š”๋‹ค.
        "arrow-body-style": "off", //ํ™”์‚ดํ‘œ ํ•จ์ˆ˜ ์•ˆ์— return์„ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๋‹ค.
        "react/no-unescaped-entities": "off", //๋ฌธ์ž์—ด ๋‚ด์—์„œ " ' > } ํ—ˆ์šฉ
        "react/prop-types": "off", //proptypes๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค.
        "object-curly-newline": "off", // { ๋‹ค์Œ ์ค„ ๋ฐ”๊ฟˆ์„ ๊ฐ•์ œ๋กœ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค.
        "react/jsx-one-expression-per-line": "off", //ํ•œ๋ผ์ธ์— ์—ฌ๋Ÿฌ๊ฐœ์˜ JSX๋ฅผ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๋‹ค.
        "implicit-arrow-linebreak": "off", // ํ™”์‚ดํ‘œ ํ•จ์ˆ˜ ๋‹ค์Œ์— ์ค„ ๋ฐ”๊ฟˆ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.
        "no-shadow": "off", //ํŒŒ์ผ ๋‚ด์—์„œ ์ค‘๋ณต ์ด๋ฆ„์„ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๋‹ค.
        "operator-linebreak": "off", //์—ฐ์‚ฐ์ž ๋‹ค์Œ ์ค„ ๋ฐ”๊ฟˆ์„ ์‚ฌ์šฉ ํ•  ์ˆ˜ ์žˆ๋‹ค.
        "react/react-in-jsx-scope": "off", // jsx๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ๋„ React๋ฅผ ๊ผญ import ํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค.
        "react/jsx-props-no-spreading": "off", //props๋ฅผ ์Šคํ”„๋ž˜๋“œ ํ•  ์ˆ˜ ์žˆ๋‹ค.
        "jsx-a11y/anchor-is-valid": "off", // next js์—์„œ๋Š” a์— href์—†์ด ์‚ฌ์šฉ
        "global-require": "off", //ํ•จ์ˆ˜ ๋‚ด์—์„œ require ์‚ฌ์šฉ๊ฐ€๋Šฅ
        "no-use-before-define": "off", // ์„ ์–ธ์ „์— ์‚ฌ์šฉํ•˜์ง€ ๋ง๋ผ,
        "import/prefer-default-export": "off", //export default ๊ถŒ์žฅ
        "no-param-reassign": "off", //param assign ํ•˜์ง€ ์•Š๊ธฐ
        "jsx-a11y/label-has-associated-control": "off",
        "no-invalid-css": "off",
        "no-confusing-arrow": "off",
        "react/jsx-curly-newline": "off",
        indent: "off",
        "react/jsx-filename-extension": [
        1,
        { extensions: [".js", ".jsx", ".tsx"] }, //jsx์‚ฌ์šฉ๊ฐ€๋Šฅํ•œ ํ™•์žฅ์ž ์„ค์ •
        ],
        "import/extensions": [
        "error",
        "ignorePackages",
        {
            js: "never",
            jsx: "never",
            ts: "never",
            tsx: "never",
        }, //import ์‹œ ํ™•์žฅ์ž๋ช…์€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค.
        ],
    },
    settings: {
        "import/resolver": {
        node: {
            extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
        },
        },
    },
    };

    ์ด๋ ‡๊ฒŒ๋‚˜ ๋งŽ์€ ๊ทœ์น™๋“ค์ด ์žˆ๋‹ค๋Š” ๋ฐ ๋†€๋ž๊ณ  ์ƒ๊ฐ๋ณด๋‹ค ์ž์œ ๋„๊ฐ€ ๋†’๋‹ค๊ณ  ๋Š๊ผˆ๋‹ค.


Written by@[DotoriMook]
ํ”„๋ก ํŠธ์—”๋“œ ์ฃผ๋‹ˆ์–ด ๊ฐœ๋ฐœ์ž ๋„ํ† ๋ฆฌ๋ฌต์˜ ๊ธฐ์ˆ ๊ฐœ๋ฐœ ๋ธ”๋กœ๊ทธ ์ž…๋‹ˆ๋‹ค.

GitHubMediumTwitterFacebook