Skip to content

Commit

Permalink
Docs [Prettier] prettier LF, CRLF 이슈 포스팅
Browse files Browse the repository at this point in the history
  • Loading branch information
BoubleJ committed Oct 1, 2024
1 parent 6a9561e commit 68c542e
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 24 deletions.
23 changes: 0 additions & 23 deletions contents/[Oracle] 오라클 설치 과정.md

This file was deleted.

84 changes: 84 additions & 0 deletions contents/[Prettier] prettier LF, CRLF 이슈.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
date: "2024-10-01"
title: "[Prettier] prettier LF, CRLF 이슈"
categories: ["Prettier", "LF","CRLF","ESLint",".eslint.json",]
summary: "error delete `␍` prettier/prettier 이슈를 해결해봅시다."
thumbnail: "./prettier에러.png"
---

# 개요

인프런 강의 github 소스코드를 clone 한 후 `npm run dev` 명령어를 실행시키니

![prettier에러](prettier에러.png)

ESLint에서 오류가 발생했습니다.

# 원인

`delete ␍ prettier/prettier` 에러는 Prettier가 코드 내에서 줄 끝(Line Ending) 스타일에 문제가 있다고 판단한겁니다.

운영체제 마다 사용하는 줄끝 스타일에 차이가 있는데

- Unix/Linux : Line Feed (LF)
- Windows : Carriage Return (CR)

다음과 같습니다.

때문에

`delete ␍ prettier/prettier` 에러는 줄끝 스타일을 `Carriage Return (CR)`로 하지말고 `Line Feed (LF)`으로 설정하라는 의미입니다.

# 해결방법

위 에러를 해결하는 가장 간단한 방법은 vscode 우측 하단에 있는 줄 끝 스타일 변경 버튼을 통해 스타일을 설정하는겁니다.

![줄끝스타일변경1](줄끝스타일변경1.png)

![줄끝스타일변경2](줄끝스타일변경2.png)

줄끝 스타일을 LF로 변경해주면 됩니다.

하지만 이 방법은 현재 선택한 파일 줄끝스타일만 변경하기 때문에 프로젝트 내 존재하는 모든 파일들의 줄끝 스타일을 일일히 변경해야하는 번거로움이 있습니다.

즉 아주 비효율적인 방법이죠.

# 진짜 해결방법

근본적인 원인인 ESLint 자체에서 수정을 해주는 방법으로 문제를 해결해 보겠습니다.

`.eslint.json(.esLint.js)` 파일을 열어 아래 코드를 추가해주면 됩니다.


```js
"rules": {
"prettier/prettier": [
"error",
{
"endOfLine": 'auto',
},
],
},
```





<br>
<br>
<br>



<details>

<summary>출처</summary>

<div markdown="1">

https://noogoonaa.tistory.com/62

</div>

</details>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
date: "2024-04-11"
title: "[Programming] Blocking & non-Blocking, 동기 & 비동기"
categories: ["Programming"]
summary: " Blocking & Non-Blocking / 동기 & 비동기"
summary: "Blocking & Non-Blocking / 동기 & 비동기"
thumbnail: "./블로킹,동기조합.png"
---

Expand Down
Binary file added contents/prettier에러.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added contents/줄끝스타일변경1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added contents/줄끝스타일변경2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 68c542e

Please sign in to comment.