๋ฉ”์ธ ์ปจํ…์ธ ๋กœ ์ด๋™
๋ฒ„์ „: 3.6.3

๐Ÿ“ฆ eslint ํ”Œ๋Ÿฌ๊ทธ์ธ

ESLint is a tool that statically analyzes your code and reports problems or suggests best practices through editor hints and command line. ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค๋Š” ์ตœ๊ณ ์˜ ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค ๊ฒฝํ—˜์„ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด ESLint ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

์„ค์น˜โ€‹

npm install --save-dev @docusaurus/eslint-plugin

์‚ฌ์šฉ๋ฒ•โ€‹

๊ถŒ์žฅ ์„ค์ •โ€‹

Add plugin:@docusaurus/recommended to the extends section of your .eslintrc configuration file:

.eslintrc
{
"extends": ["plugin:@docusaurus/recommended"]
}

This will enable the @docusaurus eslint plugin and use the recommended config. See Supported rules below for a list of rules that this will enable.

์ˆ˜๋™ ์„ค์ •โ€‹

๋ณด๋‹ค ์„ธ๋ถ„ํ™”๋œ ์ œ์–ด๋ฅผ ์œ„ํ•ด ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์ˆ˜๋™์œผ๋กœ ํ™œ์„ฑํ™”ํ•˜๊ณ  ์ง์ ‘ ์‚ฌ์šฉํ•  ๊ทœ์น™์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

.eslintrc
{
"plugins": ["@docusaurus"],
"rules": {
"@docusaurus/string-literal-i18n-messages": "error",
"@docusaurus/no-untranslated-text": "warn"
}
}

์ง€์›ํ•˜๋Š” ์„ค์ •โ€‹

  • Recommended: ํ™•์žฅ๋˜์–ด์•ผ ํ•˜๋Š” ๋Œ€๋ถ€๋ถ„์˜ ๋„ํ์‚ฌ์šฐ๋ฃจ์Šค ์‚ฌ์ดํŠธ์— ๋Œ€ํ•œ ๊ถŒ์žฅ ๊ทœ์น™ ์ง‘ํ•ฉ๋‹ˆ๋‹ค.
  • All: all rules enabled. ์ด๊ฒƒ์€ ๋งˆ์ด๋„ˆ ๋ฒ„์ „ ๊ฐ„์— ๋ณ€๊ฒฝ๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์˜ˆ๊ธฐ์น˜ ์•Š์€ ์ฃผ์š” ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ๋ฐฉ์ง€ํ•˜๋ ค๋ฉด ํ•ด๋‹น ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜์ง€ ๋งˆ์„ธ์š”.

์ง€์›ํ•˜๋Š” ๊ทœ์น™โ€‹

์˜ต์…˜๋ช…์„ค๋ช…
@docusaurus/no-untranslated-textJSX์˜ ํ…์ŠคํŠธ ๋ผ๋ฒจ์ด translate ํ˜ธ์ถœ๋กœ ๋ž˜ํ•‘๋˜๋„๋ก ์ ์šฉํ•ฉ๋‹ˆ๋‹ค
@docusaurus/string-literal-i18n-messages์ผ๋ฐ˜ ํ…์ŠคํŠธ ๋ผ๋ฒจ์— ๋Œ€ํ•ด ๋ฒˆ์—ญ API๋ฅผ ๊ฐ•์ œ๋กœ ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.โœ…
@docusaurus/no-html-linksEnsures @docusaurus/Link is used instead of <a> tagsโœ…
@docusaurus/prefer-docusaurus-headingEnsures @theme/Heading is used instead of <hn> tags for headingsโœ…

โœ… = recommended

์„ค์ • ์˜ˆ์‹œโ€‹

๋‹ค์Œ์€ ์„ค์ • ์˜ˆ์‹œ์ž…๋‹ˆ๋‹ค:

.eslintrc.js
module.exports = {
extends: ['plugin:@docusaurus/recommended'],
rules: {
'@docusaurus/no-untranslated-text': [
'warn',
{ignoredStrings: ['ยท', 'โ€”', 'ร—']},
],
},
};