From 78ecfe0e52c0e5780fefc8dc9a98864e48de6637 Mon Sep 17 00:00:00 2001 From: Percy Ma Date: Tue, 10 Jan 2023 17:46:43 +0800 Subject: [PATCH] docs: use inline code for rule options name (#16768) --- docs/src/rules/class-methods-use-this.md | 4 ++-- docs/src/rules/eqeqeq.md | 2 +- docs/src/rules/func-name-matching.md | 2 +- docs/src/rules/generator-star-spacing.md | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/src/rules/class-methods-use-this.md b/docs/src/rules/class-methods-use-this.md index 7461830af85..2269fac8eff 100644 --- a/docs/src/rules/class-methods-use-this.md +++ b/docs/src/rules/class-methods-use-this.md @@ -118,9 +118,9 @@ This rule has two options: "class-methods-use-this": [, { "exceptMethods": [<...exceptions>] }] ``` -The `exceptMethods` option allows you to pass an array of method names for which you would like to ignore warnings. For example, you might have a spec from an external library that requires you to overwrite a method as a regular function (and not as a static method) and does not use `this` inside the function body. In this case, you can add that method to ignore in the warnings. +The `"exceptMethods"` option allows you to pass an array of method names for which you would like to ignore warnings. For example, you might have a spec from an external library that requires you to overwrite a method as a regular function (and not as a static method) and does not use `this` inside the function body. In this case, you can add that method to ignore in the warnings. -Examples of **incorrect** code for this rule when used without exceptMethods: +Examples of **incorrect** code for this rule when used without `"exceptMethods"`: ::: incorrect diff --git a/docs/src/rules/eqeqeq.md b/docs/src/rules/eqeqeq.md index de2a6b086c8..3243844f102 100644 --- a/docs/src/rules/eqeqeq.md +++ b/docs/src/rules/eqeqeq.md @@ -139,7 +139,7 @@ foo == null ### allow-null -**Deprecated:** Instead of using this option use "always" and pass a "null" option property with value "ignore". This will tell ESLint to always enforce strict equality except when comparing with the `null` literal. +**Deprecated:** Instead of using this option use `"always"` and pass a `"null"` option property with value `"ignore"`. This will tell ESLint to always enforce strict equality except when comparing with the `null` literal. ```js ["error", "always", {"null": "ignore"}] diff --git a/docs/src/rules/func-name-matching.md b/docs/src/rules/func-name-matching.md index 26fe408bd80..8ef1a1c8540 100644 --- a/docs/src/rules/func-name-matching.md +++ b/docs/src/rules/func-name-matching.md @@ -145,7 +145,7 @@ module['exports'] = function foo(name) {}; ## Options -This rule takes an optional string of "always" or "never" (when omitted, it defaults to "always"), and an optional options object with two properties `considerPropertyDescriptor` and `includeCommonJSModuleExports`. +This rule takes an optional string of `"always"` or `"never"` (when omitted, it defaults to `"always"`), and an optional options object with two properties `considerPropertyDescriptor` and `includeCommonJSModuleExports`. ### considerPropertyDescriptor diff --git a/docs/src/rules/generator-star-spacing.md b/docs/src/rules/generator-star-spacing.md index 3a71b7e1849..3ef58d86da6 100644 --- a/docs/src/rules/generator-star-spacing.md +++ b/docs/src/rules/generator-star-spacing.md @@ -51,14 +51,14 @@ This rule aims to enforce spacing around the `*` of generator functions. ## Options -The rule takes one option, an object, which has two keys `before` and `after` having boolean values `true` or `false`. +The rule takes one option, an object, which has two keys `"before"` and `"after"` having boolean values `true` or `false`. -* `before` enforces spacing between the `*` and the `function` keyword. +* `"before"` enforces spacing between the `*` and the `function` keyword. If it is `true`, a space is required, otherwise spaces are disallowed. In object literal shorthand methods, spacing before the `*` is not checked, as they lack a `function` keyword. -* `after` enforces spacing between the `*` and the function name (or the opening parenthesis for anonymous generator functions). +* `"after"` enforces spacing between the `*` and the function name (or the opening parenthesis for anonymous generator functions). If it is `true`, a space is required, otherwise spaces are disallowed. The default is `{"before": true, "after": false}`. @@ -99,9 +99,9 @@ An example of a configuration with overrides: }] ``` -In the example configuration above, the top level "before" and "after" options define the default behavior of -the rule, while the "anonymous" and "method" options override the default behavior. -Overrides can be either an object with "before" and "after", or a shorthand string as above. +In the example configuration above, the top level `"before"` and `"after"` options define the default behavior of +the rule, while the `"anonymous"` and `"method"` options override the default behavior. +Overrides can be either an object with `"before"` and `"after"`, or a shorthand string as above. ## Examples