mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
chore: release Docusaurus 3.7.0 (#10812)
This commit is contained in:
parent
cacb973326
commit
71d682c53b
153 changed files with 21809 additions and 232 deletions
|
@ -0,0 +1,74 @@
|
|||
---
|
||||
sidebar_position: 1
|
||||
slug: /api/misc/@docusaurus/eslint-plugin
|
||||
---
|
||||
|
||||
# 📦 eslint-plugin
|
||||
|
||||
[ESLint](https://eslint.org/) is a tool that statically analyzes your code and reports problems or suggests best practices through editor hints and command line. Docusaurus provides an ESLint plugin to enforce best Docusaurus practices.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash npm2yarn
|
||||
npm install --save-dev @docusaurus/eslint-plugin
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Recommended config
|
||||
|
||||
Add `plugin:@docusaurus/recommended` to the `extends` section of your `.eslintrc` configuration file:
|
||||
|
||||
```json title=".eslintrc"
|
||||
{
|
||||
"extends": ["plugin:@docusaurus/recommended"]
|
||||
}
|
||||
```
|
||||
|
||||
This will enable the `@docusaurus` eslint plugin and use the `recommended` config. See [Supported rules](#supported-rules) below for a list of rules that this will enable.
|
||||
|
||||
### Manual config
|
||||
|
||||
For more fine-grained control, you can also enable the plugin manually and configure the rules you want to use directly:
|
||||
|
||||
```json title=".eslintrc"
|
||||
{
|
||||
"plugins": ["@docusaurus"],
|
||||
"rules": {
|
||||
"@docusaurus/string-literal-i18n-messages": "error",
|
||||
"@docusaurus/no-untranslated-text": "warn"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Supported configs
|
||||
|
||||
- Recommended: recommended rule set for most Docusaurus sites that should be extended from.
|
||||
- All: **all** rules enabled. This will change between minor versions, so you should not use this if you want to avoid unexpected breaking changes.
|
||||
|
||||
## Supported rules
|
||||
|
||||
| Name | Description | |
|
||||
| --- | --- | --- |
|
||||
| [`@docusaurus/no-untranslated-text`](./no-untranslated-text.mdx) | Enforce text labels in JSX to be wrapped by translate calls | |
|
||||
| [`@docusaurus/string-literal-i18n-messages`](./string-literal-i18n-messages.mdx) | Enforce translate APIs to be called on plain text labels | ✅ |
|
||||
| [`@docusaurus/no-html-links`](./no-html-links.mdx) | Ensures @docusaurus/Link is used instead of `<a>` tags | ✅ |
|
||||
| [`@docusaurus/prefer-docusaurus-heading`](./prefer-docusaurus-heading.mdx) | Ensures @theme/Heading is used instead of `<hn>` tags for headings | ✅ |
|
||||
|
||||
✅ = recommended
|
||||
|
||||
## Example configuration
|
||||
|
||||
Here's an example configuration:
|
||||
|
||||
```js title=".eslintrc.js"
|
||||
module.exports = {
|
||||
extends: ['plugin:@docusaurus/recommended'],
|
||||
rules: {
|
||||
'@docusaurus/no-untranslated-text': [
|
||||
'warn',
|
||||
{ignoredStrings: ['·', '—', '×']},
|
||||
],
|
||||
},
|
||||
};
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue