From 9639c45cdfb1f29e969f39a54dbea7fd8f83fe6e Mon Sep 17 00:00:00 2001 From: Lachlan Heywood Date: Wed, 2 Nov 2022 11:09:32 -0400 Subject: [PATCH 1/2] add eslint plugin to config and update docs --- packages/eslint-plugin/src/index.ts | 2 ++ website/docs/api/misc/eslint-plugin/README.md | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/eslint-plugin/src/index.ts b/packages/eslint-plugin/src/index.ts index 1274bc31dfee..022604341bef 100644 --- a/packages/eslint-plugin/src/index.ts +++ b/packages/eslint-plugin/src/index.ts @@ -11,11 +11,13 @@ export = { rules, configs: { recommended: { + plugins: ['@docusaurus'], rules: { '@docusaurus/string-literal-i18n-messages': 'error', }, }, all: { + plugins: ['@docusaurus'], rules: { '@docusaurus/string-literal-i18n-messages': 'error', '@docusaurus/no-untranslated-text': 'warn', diff --git a/website/docs/api/misc/eslint-plugin/README.md b/website/docs/api/misc/eslint-plugin/README.md index 9d0d2236846c..ad53e84f4368 100644 --- a/website/docs/api/misc/eslint-plugin/README.md +++ b/website/docs/api/misc/eslint-plugin/README.md @@ -15,15 +15,9 @@ npm install --save-dev @docusaurus/eslint-plugin ## Usage -Add `@docusaurus` to the plugins section of your `.eslintrc` configuration file: +### Recommended Config -```json title=".eslintrc" -{ - "plugins": ["@docusaurus"] -} -``` - -Then, you can extend one of the configs (e.g. the `recommended` config): +Add `plugin:@docusaurus/recommended` to the `extends` section of your `.eslintrc` configuration file: ```json title=".eslintrc" { @@ -31,10 +25,15 @@ Then, you can extend one of the configs (e.g. the `recommended` config): } ``` -Each config contains a set of rules. For more fine-grained control, you can also configure the rules you want to use directly: +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" @@ -63,7 +62,6 @@ Here's an example configuration: ```js title=".eslintrc.js" module.exports = { extends: ['plugin:@docusaurus/recommended'], - plugins: ['@docusaurus'], rules: { '@docusaurus/no-untranslated-text': [ 'warn', From abefed2b9c3004cf06d4e7d405283653107df061 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Fri, 2 Dec 2022 19:35:50 -0500 Subject: [PATCH 2/2] Update README.md --- website/docs/api/misc/eslint-plugin/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/website/docs/api/misc/eslint-plugin/README.md b/website/docs/api/misc/eslint-plugin/README.md index ad53e84f4368..436355a025e3 100644 --- a/website/docs/api/misc/eslint-plugin/README.md +++ b/website/docs/api/misc/eslint-plugin/README.md @@ -15,7 +15,7 @@ npm install --save-dev @docusaurus/eslint-plugin ## Usage -### Recommended Config +### Recommended config Add `plugin:@docusaurus/recommended` to the `extends` section of your `.eslintrc` configuration file: @@ -25,9 +25,9 @@ Add `plugin:@docusaurus/recommended` to the `extends` section of your `.eslintrc } ``` -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. +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 +### Manual config For more fine-grained control, you can also enable the plugin manually and configure the rules you want to use directly: @@ -41,12 +41,12 @@ For more fine-grained control, you can also enable the plugin manually and confi } ``` -## Supported Configs +## 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 +## Supported rules | Name | Description | | | --- | --- | --- |