π¦ eslint-plugin
ESLint is a tool that statically analyzes your code and reports problems or suggests best practices through editor hints and command line. λνμ¬μ°λ£¨μ€λ μ΅κ³ μ λνμ¬μ°λ£¨μ€ κ²½νμ μ μ©νκΈ° μν΄ ESLint νλ¬κ·ΈμΈμ μ§μν©λλ€.
μ€μΉβ
- npm
- Yarn
- pnpm
npm install --save-dev @docusaurus/eslint-plugin
yarn add --dev @docusaurus/eslint-plugin
pnpm add --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-text | JSXμ ν μ€νΈ λΌλ²¨μ΄ translate νΈμΆλ‘ λνλλλ‘ μ μ©ν©λλ€ | |
@docusaurus/string-literal-i18n-messages | μΌλ° ν μ€νΈ λΌλ²¨μ λν΄ λ²μ APIλ₯Ό κ°μ λ‘ νΈμΆν©λλ€. | β |
@docusaurus/no-html-links | Ensures @docusaurus/Link is used instead of <a> tags | β |
@docusaurus/prefer-docusaurus-heading | Ensures @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: ['Β·', 'β', 'Γ']},
],
},
};