ESLint, Prettier๋ JavaScript / TypeScript ํ๋ก์ ํธ์์ ์ฝ๋ ํ์ง๊ณผ ์ผ๊ด์ฑ์ ์ ์งํ๊ธฐ ์ํด ๊ฑฐ์ ํ์์ ์ผ๋ก ์ฐ์ด๋ ๋๊ตฌ์ ๋๋ค.
ESLint : JavaScript / TypeScript ์ฝ๋์์ ๋ฌธ๋ฒ ์ค๋ฅ๋ ์ ์ฌ์ ์ธ ๋ฌธ์ ๋ฅผ ์ฐพ์์ฃผ๋ ๋ฆฐํฐ
Prettier : ์ฝ๋์ ์คํ์ผ์ ์๋์ผ๋ก ์ ๋ฆฌํด์ฃผ๋ ํฌ๋งคํฐ
VS Code์์ ์๋ ํฌ๋งคํ ์ค์ ํ๊ธฐ
View -> Command Palette
Preference: Open User Settings (JSON) ์ด๊ธฐ
// setting.json
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
editor.formatOnSave - ์ ์ฅ ์ ์๋ ํฌ๋งทํ
editor.defaultFormatter - ์ด๋ค ํฌ๋งทํฐ๋ฅผ ์ธ์ง ์ง์ (Prettier)
eslint.validate - ์ด๋ค ํ์ผ์ ESLint๋ฅผ ์ ์ฉํ ์ง ์ค์
editor.codeActionsOnSave.source.fixAll.eslint - ์ ์ฅ ์ ESLint ์๋ ์์ ์ ์ฉ