ํฐ์คํ ๋ฆฌ ๋ทฐ
[ESLint & Prettier] expected indentation of 2 spaces but found 4.
Carrot๐ฅ 2020. 6. 27. 05:23
ESLint ์ฌ์ฉ ์ค
expected indentation of 2 spaces but found 4. eslint(indent) ๋ผ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํด์
์ธ์ ์ฌ๊ธฐ์ ๊ธฐ ์๋ป๊ฒ๊ฒ ๋ฐ์ค์ด ์๊ฒผ๋ค.
VSC ์ค์ ์ค Tab Size ๋ฅผ 4๋ก ์ค์ ํด์์ธ๊ฐ?!๐
๋ผ๊ณ ์๊ฐํ์ง๋ง ์ด๊ฑธ ์์ ํด๋ ์ค๋ฅ๋ ์ฌ์ ํ๋ค.
๊ตฌ๊ธ๋ง ํด๋ณธ ๊ฒฐ๊ณผ ESLint ์ Prettier ์ ํฌ๋งทํ ์ ์ถฉ๋๋ก ๋ณด์ธ๋ค๊ณ ๋ค ํ๋ค.
๊ฐ๋จํ ํด๊ฒฐ ๋ฐฉ๋ฒ์ผ๋ก๋ .eslintrc.js ํ์ผ์์ ์๋ก์ผ indent ๋ถ๋ถ๋ง off ํ๋ฉด ๋์ง๋ง,
rules: {
indent: 'off',
}
๋ค๋ฅธ ํฌ๋งทํ
์์๋ ์ถฉ๋ ํ ์ ์๊ธฐ ๋๋ฌธ์,
์๋์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ์ฌ eslint์ ์ค์ ์ค, prettier์ ์ถฉ๋ํ๋ rule๋ง off ํ ์ ์๋ค.
eslint-config-prettier : Turns off all rules that are unnecessary or might conflict with Prettier.
ํฐ๋ฏธ๋์์ eslint-config-prettier ๋ฅผ ์ค์นํ๋ค.
npm install --save-dev eslint-config-prettier
๊ทธ๋ฆฌ๊ณ .eslintrc.* ํ์ผ์ extends ์์ญ array ๊ฐ ๋ง์ง๋ง์ "prettier" ์ ์ถ๊ฐํ๋ค.
{
"extends": [ "some-other-config-you-use", "prettier" ]
}
ํด๊ฒฐ ์๋ฃ
๋ต๋ตํด ๋ค์ง๋์ค ์์๋ค
์ถ์ฒ : https://github.com/prettier/eslint-config-prettier
prettier/eslint-config-prettier
Turns off all rules that are unnecessary or might conflict with Prettier. - prettier/eslint-config-prettier
github.com
expected indentation of 2 spaces but found 4.
VSC ESLint ๋ค์ฌ์ฐ๊ธฐ ์ค๋ฅ
VSC ESLint ํญ
'๊ณต๋ถ > JS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JS] ์์ฑ์ํจ์์ return ๊ฐ (0) | 2020.07.06 |
---|---|
[JS] forEach, for in, for of (์์์ Array empty ์์ ์ํ) (2) | 2020.07.06 |
[JS] String.slice() ์ String.substring() ๋น๊ต (0) | 2020.07.02 |
[์คํฌ๋ฉ] 5 Tips to Write Better Conditionals in JavaScript (0) | 2020.06.27 |
[JS] A standard IF statement (1) | 2020.04.24 |
- eventlistener
- ๋ฐ๋๋ผ์ฝ๋ฉ
- HTML
- css
- string
- ๋ถํธ์บ ํ
- VSC
- ์ฝ๋ฉ๋ถํธ์บ ํ
- DOM
- KEYBOARD
- stackoverflow
- ๋ฐ๋๋ผ์ฝ๋ฉ ํ๊ธฐ
- book
- array
- eslint
- Stash
- js
- GIT
- review
- ์์ฑ์ํจ์
- Total
- Today
- Yesterday