ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

expected indentation of 2 spaces but found 4.

 

ESLint ์‚ฌ์šฉ ์ค‘
expected indentation of 2 spaces but found 4. eslint(indent) ๋ผ๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ด์„œ
์„ธ์ƒ ์—ฌ๊ธฐ์ €๊ธฐ ์‹œ๋ป˜๊ฒ‹๊ฒŒ ๋ฐ‘์ค„์ด ์ƒ๊ฒผ๋‹ค.

VSC ์„ค์ • ์ค‘ Tab Size ๋ฅผ 4๋กœ ์„ค์ •ํ•ด์„œ์ธ๊ฐ€?!๐Ÿ™„
๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์ง€๋งŒ ์ด๊ฑธ ์ˆ˜์ •ํ•ด๋„ ์˜ค๋ฅ˜๋Š” ์—ฌ์ „ํ–ˆ๋‹ค.

VSC - Settings - Editor: Tab Size

 

 

๊ตฌ๊ธ€๋ง ํ•ด๋ณธ ๊ฒฐ๊ณผ 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 ํƒญ 

๋Œ“๊ธ€