๋ฐ˜์‘ํ˜•

๐Ÿ‘ฟ ์—๋Ÿฌ์ƒํ™ฉ

eslint prettier ์ค„๋ฐ”๊ฟˆ ์—๋Ÿฌ ์™•์ฐฝ………

ERROR in [eslint]
src\\App.tsx
  Line 1:26:   Delete `โ`  prettier/prettier
  Line 2:30:   Delete `โ`  prettier/prettier
  Line 3:19:   Delete `โ`  prettier/prettier
  Line 4:1:    Delete `โ`  prettier/prettier
  Line 5:41:   Delete `โ`  prettier/prettier
  Line 6:39:   Delete `โ`  prettier/prettier
  Line 7:1:    Delete `โ`  prettier/prettier
  Line 8:35:   Delete `โ`  prettier/prettier
  Line 9:17:   Delete `โ`  prettier/prettier
  Line 10:11:  Delete `โ`  prettier/prettier
  Line 11:38:  Delete `โ`  prettier/prettier
  Line 12:38:  Delete `โ`  prettier/prettier
  Line 13:59:  Delete `โ`  prettier/prettier
  Line 14:12:  Delete `โ`  prettier/prettier
  Line 15:60:  Delete `โ`  prettier/prettier
  Line 16:13:  Delete `โ`  prettier/prettier
  Line 17:11:  Delete `โ`  prettier/prettier
  Line 18:31:  Delete `โ`  prettier/prettier
  Line 19:37:  Delete `โ`  prettier/prettier
  Line 20:26:  Delete `โ`  prettier/prettier
  Line 21:36:  Delete `โ`  prettier/prettier
  Line 22:10:  Delete `โ`  prettier/prettier
Failed to compile.

๐Ÿง ์—๋Ÿฌ ์›์ธ

Git ์„ค์ •๊ณผ VSCode ์„ค์ •์ด ์„œ๋กœ ์ถฉ๋Œํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์—๋Ÿฌ ๋ฐœ์ƒ. "files.eol": "\n" ์„ค์ •์ด ์ด๋ฏธ VSCode์— ์žˆ์—ˆ์ง€๋งŒ, Git์ด ์ค„ ๋ฐ”๊ฟˆ ํ˜•์‹์„ ์ž๋™์œผ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ์„ค์ •(core.autocrlf)์ด ํ™œ์„ฑํ™”๋œ ์ƒํƒœ์˜€๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•œ ๋ฌธ์ œ

 

โœจ ์—๋Ÿฌ ํ•ด๊ฒฐ

โœ… Git ์„ค์ • ์—…๋ฐ์ดํŠธ

Windows์—์„œ CRLF๊ฐ€ ๊ธฐ๋ณธ ์ค„ ๋ฐ”๊ฟˆ์ด ๋˜์ง€ ์•Š๋„๋ก ๋‹ค์Œ ๋ช…๋ น์–ด๋กœ Git ์„ค์ •์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.

# ํ”„๋กœ์ ํŠธ ๋กœ์ปฌ์—์„œ ์‹คํ–‰
git config core.autocrlf false

# ๊ธ€๋กœ๋ฒŒ ์„ค์ •์„ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๊ฒฝ์šฐ
git config --global core.autocrlf false
  • ๋ชจ๋“  ํŒŒ์ผ LF๋กœ ๋ณ€ํ™˜
# Windows ํ™˜๊ฒฝ์—์„œ Git Bash ๋˜๋Š” WSL ์‚ฌ์šฉ ์‹œ
git ls-files -z | xargs -0 dos2unix

 

::์ฐธ๊ณ :: 

Prettier ๋ฐ ESLint ๊ฐ•์ œ ์ ์šฉ

npx prettier --write .
yarn eslint --fix .

VSCode์—์„œ ์ค„ ๋ฐ”๊ฟˆ ์ผ๊ด„ ๋ณ€๊ฒฝ

  • ๋ช…๋ น ํŒ”๋ ˆํŠธ(Ctrl+Shift+P)์—์„œ “Change All End Of Line Sequence”๋ฅผ ์„ ํƒํ•˜๊ณ , LF๋กœ ๋ณ€๊ฒฝ
๋ฐ˜์‘ํ˜•
๋ฐ˜์‘ํ˜•

๐Ÿ‘ฟYarn Berry ํ”„๋กœ์ ํŠธ ํ™˜๊ฒฝ ์„ค์ • ์ค‘ .yarn/cache ์ƒ์„ฑ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ

Yarn Berry ํ”„๋กœ์ ํŠธ ํ™˜๊ฒฝ ์„ค์ • ์ค‘ .yarn/cache ์ƒ์„ฑ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ. yarn install์„ ์•„๋ฌด๋ฆฌ ์‹œ๋„ํ•ด๋„ ์บ์‹œํด๋”๊ฐ€ ์ƒ์„ฑ๋˜์ง€ ์•Š์Œ..

๐Ÿง ์—๋Ÿฌ ์›์ธ

  • ์ด์ „์—๋Š” enableGlobalCache์˜ ๊ธฐ๋ณธ๊ฐ’์ด false์˜€๊ธฐ ๋•Œ๋ฌธ์—, ๊ฐ ํ”„๋กœ์ ํŠธ๊ฐ€ ๋กœ์ปฌ .yarn/cache ํด๋”์— ์˜์กด์„ฑ์„ ์ €์žฅํ•˜๋„๋ก ๋˜์–ด ์žˆ์—ˆ๋‹ค.
  • ํ•˜์ง€๋งŒ ์ตœ๊ทผ ์—…๋ฐ์ดํŠธ์—์„œ enableGlobalCache์˜ ๊ธฐ๋ณธ๊ฐ’์„ true๋กœ ๋ณ€๊ฒฝํ•˜์—ฌ, ์ „์—ญ ์บ์‹œ ์‚ฌ์šฉ์„ ๊ธฐ๋ณธ ์„ค์ •์œผ๋กœ ์ ์šฉํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค.
  • ๋”ฐ๋ผ์„œ Yarn์˜ ์ตœ์‹  ๋ฒ„์ „์—์„œ๋Š” enableGlobalCache: false ์„ค์ •์„ .yarnrc.yml์— ์ง์ ‘ ์ถ”๊ฐ€ํ•ด์•ผ๋งŒ ๋กœ์ปฌ ์บ์‹œ๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค. ์„ค์ • ํŒŒ์ผ์— ํ•ด๋‹น ์˜ต์…˜์„ ์ง์ ‘ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š์œผ๋ฉด, Yarn์€ ์ „์—ญ ์บ์‹œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฏ€๋กœ .yarn/cache ํด๋”๊ฐ€ ์ƒ์„ฑ๋˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ ํ–ˆ๋˜ ๊ฒƒ!

โœจ ์—๋Ÿฌ ํ•ด๊ฒฐ

  • .yarnrc.yml ํŒŒ์ผ์— enableGlobalCache: false ์„ค์ • ์ถ”๊ฐ€
    //.yarnrc.yml 
    nodeLinker: pnp
    enableGlobalCache: false
    โ€‹
  • ์„ค์ • ๋ณ€๊ฒฝ ํ›„ ํ”„๋กœ์ ํŠธ ์˜์กด์„ฑ ์žฌ์„ค์น˜
    yarn install

๋“œ๋””์–ด cacheํŒŒ์ผ์ด ์ƒ์„ฑ๋˜์—ˆ๋‹ค!!

๋ฐ˜์‘ํ˜•

+ Recent posts