From d46432bc47dd3b73c42f99fe87407b78a1416459 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 5 Feb 2024 13:12:23 -0500 Subject: [PATCH] chore: postprocess with prettier in eslint-doc-generator --- .eslint-doc-generatorrc.js | 7 + README.md | 149 ++++++++++---------- docs/rules/consistent-output.md | 6 +- docs/rules/meta-property-ordering.md | 2 +- docs/rules/no-deprecated-context-methods.md | 42 +++--- docs/rules/no-deprecated-report-api.md | 8 +- docs/rules/no-missing-message-ids.md | 6 +- docs/rules/no-missing-placeholders.md | 2 +- docs/rules/no-unused-message-ids.md | 6 +- docs/rules/no-unused-placeholders.md | 4 +- docs/rules/no-useless-token-range.md | 4 +- docs/rules/prefer-message-ids.md | 12 +- docs/rules/prefer-object-rule.md | 4 +- docs/rules/prefer-placeholders.md | 6 +- docs/rules/prefer-replace-text.md | 2 +- docs/rules/report-message-format.md | 12 +- docs/rules/require-meta-docs-description.md | 8 +- docs/rules/require-meta-docs-url.md | 9 +- docs/rules/require-meta-fixable.md | 4 +- docs/rules/require-meta-has-suggestions.md | 4 +- docs/rules/require-meta-schema.md | 2 +- docs/rules/require-meta-type.md | 12 +- docs/rules/test-case-property-ordering.md | 2 +- docs/rules/test-case-shorthand-strings.md | 18 +-- 24 files changed, 169 insertions(+), 162 deletions(-) diff --git a/.eslint-doc-generatorrc.js b/.eslint-doc-generatorrc.js index 5c4ef3b6..3279eca8 100644 --- a/.eslint-doc-generatorrc.js +++ b/.eslint-doc-generatorrc.js @@ -1,5 +1,7 @@ 'use strict'; +const prettier = require('prettier'); + /** @type {import('eslint-doc-generator').GenerateOptions} */ module.exports = { ignoreConfig: [ @@ -9,6 +11,11 @@ module.exports = { 'tests', 'tests-recommended', ], + postprocess: async (content, path) => + prettier.format(content, { + ...(await prettier.resolveConfig(path)), + parser: 'markdown', + }), ruleDocSectionInclude: ['Rule Details'], ruleListSplit: 'meta.docs.category', urlConfigs: diff --git a/README.md b/README.md index 18728fed..9a7b4b52 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,13 @@ An ESLint plugin for linting ESLint plugins. Rules written in CJS, ESM, and TypeScript are all supported. -* [Installation](#Installation) -* [Usage](#Usage) -* [Rules](#Rules) -* [Presets](#Presets) - * [Semantic versioning policy](#Semanticversioningpolicy) - * [Preset usage](#Presetusage) + +- [Installation](#Installation) +- [Usage](#Usage) +- [Rules](#Rules) +- [Presets](#Presets) + - [Semantic versioning policy](#Semanticversioningpolicy) + - [Preset usage](#Presetusage) ## Presets -| | Name | Description | -|:--|:--------------------|:--------------------------------------------------------------------------| -| ✅ | `recommended` | enables all recommended rules in this plugin | -| | `rules-recommended` | enables all recommended rules that are aimed at linting ESLint rule files | -| | `tests-recommended` | enables all recommended rules that are aimed at linting ESLint test files | -| | `all` | enables all rules in this plugin | -| | `rules` | enables all rules that are aimed at linting ESLint rule files | -| | `tests` | enables all rules that are aimed at linting ESLint test files | +| | Name | Description | +| :-- | :------------------ | :------------------------------------------------------------------------ | +| ✅ | `recommended` | enables all recommended rules in this plugin | +| | `rules-recommended` | enables all recommended rules that are aimed at linting ESLint rule files | +| | `tests-recommended` | enables all recommended rules that are aimed at linting ESLint test files | +| | `all` | enables all rules in this plugin | +| | `rules` | enables all rules that are aimed at linting ESLint rule files | +| | `tests` | enables all rules that are aimed at linting ESLint test files | ### Semantic versioning policy @@ -137,9 +136,7 @@ Presets are enabled by adding a line to the `extends` list in your config file. ```json { - "extends": [ - "plugin:eslint-plugin/recommended" - ] + "extends": ["plugin:eslint-plugin/recommended"] } ``` @@ -147,15 +144,15 @@ Or to apply linting only to the appropriate rule or test files: ```json { - "overrides": [ - { - "files": ["lib/rules/*.{js,ts}"], - "extends": ["plugin:eslint-plugin/rules-recommended"] - }, - { - "files": ["tests/lib/rules/*.{js,ts}"], - "extends": ["plugin:eslint-plugin/tests-recommended"] - }, - ] + "overrides": [ + { + "files": ["lib/rules/*.{js,ts}"], + "extends": ["plugin:eslint-plugin/rules-recommended"] + }, + { + "files": ["tests/lib/rules/*.{js,ts}"], + "extends": ["plugin:eslint-plugin/tests-recommended"] + } + ] } ``` diff --git a/docs/rules/consistent-output.md b/docs/rules/consistent-output.md index aae5ca8d..c5d69f32 100644 --- a/docs/rules/consistent-output.md +++ b/docs/rules/consistent-output.md @@ -66,8 +66,8 @@ new RuleTester().run('example-rule', rule, { This rule takes an optional string enum option with one of the following values: -* `"consistent"` - (default) if any invalid test cases have output assertions, then all invalid test cases must have output assertions -* `"always"` - always require invalid test cases to have output assertions +- `"consistent"` - (default) if any invalid test cases have output assertions, then all invalid test cases must have output assertions +- `"always"` - always require invalid test cases to have output assertions ## When Not To Use It @@ -77,4 +77,4 @@ As mentioned in the introduction, the need for this rule is reduced as of ESLint ## Further Reading -* [`RuleTester` documentation](http://eslint.org/docs/developer-guide/working-with-plugins#testing) +- [`RuleTester` documentation](http://eslint.org/docs/developer-guide/working-with-plugins#testing) diff --git a/docs/rules/meta-property-ordering.md b/docs/rules/meta-property-ordering.md index 2593d6d9..973138f5 100644 --- a/docs/rules/meta-property-ordering.md +++ b/docs/rules/meta-property-ordering.md @@ -12,7 +12,7 @@ This rule enforces that meta properties of a rule are placed in a consistent ord This rule has an array option: -* `['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in. +- `['type', 'docs', 'fixable', 'hasSuggestions', 'schema', 'messages', 'deprecated', 'replacedBy']` (default): The order that the properties of `meta` should be placed in. Examples of **incorrect** code for this rule: diff --git a/docs/rules/no-deprecated-context-methods.md b/docs/rules/no-deprecated-context-methods.md index 16d999d6..50795425 100644 --- a/docs/rules/no-deprecated-context-methods.md +++ b/docs/rules/no-deprecated-context-methods.md @@ -10,26 +10,26 @@ This rule disallows the use of deprecated methods on rule `context` objects. The deprecated methods are: -* `getSource` -* `getSourceLines` -* `getAllComments` -* `getNodeByRangeIndex` -* `getComments` -* `getCommentsBefore` -* `getCommentsAfter` -* `getCommentsInside` -* `getJSDocComment` -* `getFirstToken` -* `getFirstTokens` -* `getLastToken` -* `getLastTokens` -* `getTokenAfter` -* `getTokenBefore` -* `getTokenByRangeStart` -* `getTokens` -* `getTokensAfter` -* `getTokensBefore` -* `getTokensBetween` +- `getSource` +- `getSourceLines` +- `getAllComments` +- `getNodeByRangeIndex` +- `getComments` +- `getCommentsBefore` +- `getCommentsAfter` +- `getCommentsInside` +- `getJSDocComment` +- `getFirstToken` +- `getFirstTokens` +- `getLastToken` +- `getLastTokens` +- `getTokenAfter` +- `getTokenBefore` +- `getTokenByRangeStart` +- `getTokens` +- `getTokensAfter` +- `getTokensBefore` +- `getTokensBetween` Instead of using these methods, you should use the equivalent methods on [`SourceCode`](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode), e.g. `context.getSourceCode().getText()` instead of `context.getSource()`. @@ -71,4 +71,4 @@ If you need to support very old versions of ESLint where `SourceCode` doesn't ex ## Further Reading -* [`SourceCode` API](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode) +- [`SourceCode` API](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode) diff --git a/docs/rules/no-deprecated-report-api.md b/docs/rules/no-deprecated-report-api.md index 1bac7e94..407faf61 100644 --- a/docs/rules/no-deprecated-report-api.md +++ b/docs/rules/no-deprecated-report-api.md @@ -8,8 +8,8 @@ ESLint has two APIs that rules can use to report problems. -* The [deprecated API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated) accepts multiple arguments: `context.report(node, [loc], message)`. -* The ["new API"](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) accepts a single argument: an object containing information about the reported problem. +- The [deprecated API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated) accepts multiple arguments: `context.report(node, [loc], message)`. +- The ["new API"](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) accepts a single argument: an object containing information about the reported problem. It is recommended that all rules use the new API. @@ -41,5 +41,5 @@ module.exports = { ## Further Reading -* [Deprecated rule API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated) -* [New rule API](http://eslint.org/docs/developer-guide/working-with-rules) +- [Deprecated rule API](http://eslint.org/docs/developer-guide/working-with-rules-deprecated) +- [New rule API](http://eslint.org/docs/developer-guide/working-with-rules) diff --git a/docs/rules/no-missing-message-ids.md b/docs/rules/no-missing-message-ids.md index 592d6d24..383ecf1b 100644 --- a/docs/rules/no-missing-message-ids.md +++ b/docs/rules/no-missing-message-ids.md @@ -58,6 +58,6 @@ module.exports = { ## Further Reading -* [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids) -* [no-unused-message-ids](./no-unused-message-ids.md) rule -* [prefer-message-ids](./prefer-message-ids.md) rule +- [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids) +- [no-unused-message-ids](./no-unused-message-ids.md) rule +- [prefer-message-ids](./prefer-message-ids.md) rule diff --git a/docs/rules/no-missing-placeholders.md b/docs/rules/no-missing-placeholders.md index 6e2ac6ca..acead6a3 100644 --- a/docs/rules/no-missing-placeholders.md +++ b/docs/rules/no-missing-placeholders.md @@ -74,4 +74,4 @@ If you want to use rule messages that actually contain double-curly bracket text ## Further Reading -* [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) +- [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) diff --git a/docs/rules/no-unused-message-ids.md b/docs/rules/no-unused-message-ids.md index c691d67c..99660b00 100644 --- a/docs/rules/no-unused-message-ids.md +++ b/docs/rules/no-unused-message-ids.md @@ -59,6 +59,6 @@ module.exports = { ## Further Reading -* [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids) -* [no-missing-message-ids](./no-missing-message-ids.md) rule -* [prefer-message-ids](./prefer-message-ids.md) rule +- [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids) +- [no-missing-message-ids](./no-missing-message-ids.md) rule +- [prefer-message-ids](./prefer-message-ids.md) rule diff --git a/docs/rules/no-unused-placeholders.md b/docs/rules/no-unused-placeholders.md index fb2df80f..0f5454e1 100644 --- a/docs/rules/no-unused-placeholders.md +++ b/docs/rules/no-unused-placeholders.md @@ -57,5 +57,5 @@ If you want to allow unused placeholders, you should turn off this rule. ## Further Reading -* [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) -* [no-missing-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-placeholders.md) +- [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) +- [no-missing-placeholders](https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/no-missing-placeholders.md) diff --git a/docs/rules/no-useless-token-range.md b/docs/rules/no-useless-token-range.md index e1bfaade..cb935d72 100644 --- a/docs/rules/no-useless-token-range.md +++ b/docs/rules/no-useless-token-range.md @@ -44,8 +44,8 @@ module.exports = { ## Known Limitations -* To ensure that your `SourceCode` instances can be detected, your rule must assign `context.getSourceCode()` to a variable somewhere. +- To ensure that your `SourceCode` instances can be detected, your rule must assign `context.getSourceCode()` to a variable somewhere. ## Further Reading -* [`SourceCode` API](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode) +- [`SourceCode` API](https://eslint.org/docs/developer-guide/working-with-rules#contextgetsourcecode) diff --git a/docs/rules/prefer-message-ids.md b/docs/rules/prefer-message-ids.md index 59a2d7ea..45ea9d86 100644 --- a/docs/rules/prefer-message-ids.md +++ b/docs/rules/prefer-message-ids.md @@ -6,9 +6,9 @@ When reporting a rule violation, it's preferred to provide the violation message with the `messageId` property instead of the `message` property. Message IDs provide the following benefits: -* Rule violation messages can be stored in a central `meta.messages` object for convenient management -* Rule violation messages do not need to be repeated in both the rule file and rule test file -* As a result, the barrier for changing rule violation messages is lower, encouraging more frequent contributions to improve and optimize them for the greatest clarity and usefulness +- Rule violation messages can be stored in a central `meta.messages` object for convenient management +- Rule violation messages do not need to be repeated in both the rule file and rule test file +- As a result, the barrier for changing rule violation messages is lower, encouraging more frequent contributions to improve and optimize them for the greatest clarity and usefulness ## Rule Details @@ -59,6 +59,6 @@ module.exports = { ## Further Reading -* [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids) -* [no-invalid-message-ids](./no-invalid-message-ids.md) rule -* [no-missing-message-ids](./no-missing-message-ids.md) rule +- [messageIds API](https://eslint.org/docs/developer-guide/working-with-rules#messageids) +- [no-invalid-message-ids](./no-invalid-message-ids.md) rule +- [no-missing-message-ids](./no-missing-message-ids.md) rule diff --git a/docs/rules/prefer-object-rule.md b/docs/rules/prefer-object-rule.md index a3a1b66a..fa3df403 100644 --- a/docs/rules/prefer-object-rule.md +++ b/docs/rules/prefer-object-rule.md @@ -34,7 +34,9 @@ Examples of **correct** code for this rule: /* eslint eslint-plugin/prefer-object-rule: error */ module.exports = { - meta: { /* ... */ }, + meta: { + /* ... */ + }, create(context) { return { Program() { diff --git a/docs/rules/prefer-placeholders.md b/docs/rules/prefer-placeholders.md index 3b6de5ce..20e29822 100644 --- a/docs/rules/prefer-placeholders.md +++ b/docs/rules/prefer-placeholders.md @@ -14,8 +14,8 @@ context.report({ Using placeholders is often preferred over using dynamic report messages, for a few reasons: -* They can help enforce a separation of the message and the data. -* It will be easier to migrate when ESLint starts supporting placing lint messages in metadata (see [#6740](https://github.com/eslint/eslint/issues/6740)) +- They can help enforce a separation of the message and the data. +- It will be easier to migrate when ESLint starts supporting placing lint messages in metadata (see [#6740](https://github.com/eslint/eslint/issues/6740)) ## Rule Details @@ -63,4 +63,4 @@ If you need to use string concatenation in your report messages for some reason, ## Further Reading -* [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) +- [context.report() API](http://eslint.org/docs/developer-guide/working-with-rules#contextreport) diff --git a/docs/rules/prefer-replace-text.md b/docs/rules/prefer-replace-text.md index eec386f4..7d233ae1 100644 --- a/docs/rules/prefer-replace-text.md +++ b/docs/rules/prefer-replace-text.md @@ -53,4 +53,4 @@ module.exports = { ## Further Reading -* [Applying Fixes](https://eslint.org/docs/developer-guide/working-with-rules#applying-fixes) +- [Applying Fixes](https://eslint.org/docs/developer-guide/working-with-rules#applying-fixes) diff --git a/docs/rules/report-message-format.md b/docs/rules/report-message-format.md index b73b4dde..aa324885 100644 --- a/docs/rules/report-message-format.md +++ b/docs/rules/report-message-format.md @@ -16,16 +16,14 @@ For example, in order to mandate that all report messages begin with a capital l ```json { - "rules": { - "eslint-plugin/report-message-format": ["error", "^[A-Z].*\\.$"] - }, - "plugins": [ - "eslint-plugin" - ] + "rules": { + "eslint-plugin/report-message-format": ["error", "^[A-Z].*\\.$"] + }, + "plugins": ["eslint-plugin"] } ``` -Note that since this rule uses static analysis and does not actually run your code, it will attempt to match report messages *before* placeholders are inserted. +Note that since this rule uses static analysis and does not actually run your code, it will attempt to match report messages _before_ placeholders are inserted. Examples of **incorrect** code for this rule: diff --git a/docs/rules/require-meta-docs-description.md b/docs/rules/require-meta-docs-description.md index 252d15f8..8de51bb9 100644 --- a/docs/rules/require-meta-docs-description.md +++ b/docs/rules/require-meta-docs-description.md @@ -6,9 +6,9 @@ Defining a clear and consistent description for each rule helps developers under In particular, each rule description should begin with an allowed prefix: -* `enforce` -* `require` -* `disallow` +- `enforce` +- `require` +- `disallow` ## Rule Details @@ -59,4 +59,4 @@ module.exports = { ## Further Reading -* [working-with-rules#options-schemas](https://eslint.org/docs/developer-guide/working-with-rules#options-schemas) +- [working-with-rules#options-schemas](https://eslint.org/docs/developer-guide/working-with-rules#options-schemas) diff --git a/docs/rules/require-meta-docs-url.md b/docs/rules/require-meta-docs-url.md index 22dd0fd5..4bb71a41 100644 --- a/docs/rules/require-meta-docs-url.md +++ b/docs/rules/require-meta-docs-url.md @@ -87,9 +87,12 @@ module.exports = { ```json { - "eslint-plugin/require-meta-docs-url": ["error", { - "pattern": "https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/{{name}}.md" - }] + "eslint-plugin/require-meta-docs-url": [ + "error", + { + "pattern": "https://github.com/eslint-community/eslint-plugin-eslint-plugin/blob/master/docs/rules/{{name}}.md" + } + ] } ``` diff --git a/docs/rules/require-meta-fixable.md b/docs/rules/require-meta-fixable.md index 81ccf77c..e5f52ee9 100644 --- a/docs/rules/require-meta-fixable.md +++ b/docs/rules/require-meta-fixable.md @@ -102,5 +102,5 @@ module.exports = { ## Further Reading -* [ESLint's autofix API](http://eslint.org/docs/developer-guide/working-with-rules#applying-fixes) -* [ESLint's rule basics mentioning `meta.fixable`](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) +- [ESLint's autofix API](http://eslint.org/docs/developer-guide/working-with-rules#applying-fixes) +- [ESLint's rule basics mentioning `meta.fixable`](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) diff --git a/docs/rules/require-meta-has-suggestions.md b/docs/rules/require-meta-has-suggestions.md index c64846f8..89c59e5a 100644 --- a/docs/rules/require-meta-has-suggestions.md +++ b/docs/rules/require-meta-has-suggestions.md @@ -88,5 +88,5 @@ module.exports = { ## Further Reading -* [ESLint's suggestion API](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions) -* [ESLint rule basics describing the `meta.hasSuggestions` property](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) +- [ESLint's suggestion API](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions) +- [ESLint rule basics describing the `meta.hasSuggestions` property](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) diff --git a/docs/rules/require-meta-schema.md b/docs/rules/require-meta-schema.md index 5b768087..de1b6825 100644 --- a/docs/rules/require-meta-schema.md +++ b/docs/rules/require-meta-schema.md @@ -89,4 +89,4 @@ As mentioned in the introduction, the need for this rule is reduced as of ESLint ## Further Reading -* [working-with-rules#options-schemas](https://eslint.org/docs/developer-guide/working-with-rules#options-schemas) +- [working-with-rules#options-schemas](https://eslint.org/docs/developer-guide/working-with-rules#options-schemas) diff --git a/docs/rules/require-meta-type.md b/docs/rules/require-meta-type.md index 672fcb0d..92f18265 100644 --- a/docs/rules/require-meta-type.md +++ b/docs/rules/require-meta-type.md @@ -12,9 +12,9 @@ Fixes in custom rules will not be applied when using `--fix-type` unless they in This rule aims to require ESLint rules to have a valid `meta.type` property with one of the following values: -* `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve. -* `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn't changed. -* `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren't specified in the AST. +- `"problem"` means the rule is identifying code that either will cause an error or may cause a confusing behavior. Developers should consider this a high priority to resolve. +- `"suggestion"` means the rule is identifying something that could be done in a better way but no errors will occur if the code isn't changed. +- `"layout"` means the rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts of the program that determine how the code looks rather than how it executes. These rules work on parts of the code that aren't specified in the AST. Examples of **incorrect** code for this rule: @@ -51,6 +51,6 @@ module.exports = { ## Further Reading -* [command-line-interface#--fix-type](https://eslint.org/docs/user-guide/command-line-interface#--fix-type) -* [working-with-rules#rule-basics](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) -* [ESLint v5.9.0 released](https://eslint.org/blog/2018/11/eslint-v5.9.0-released#the-fix-type-option) +- [command-line-interface#--fix-type](https://eslint.org/docs/user-guide/command-line-interface#--fix-type) +- [working-with-rules#rule-basics](https://eslint.org/docs/developer-guide/working-with-rules#rule-basics) +- [ESLint v5.9.0 released](https://eslint.org/blog/2018/11/eslint-v5.9.0-released#the-fix-type-option) diff --git a/docs/rules/test-case-property-ordering.md b/docs/rules/test-case-property-ordering.md index 1a308249..19b895ef 100644 --- a/docs/rules/test-case-property-ordering.md +++ b/docs/rules/test-case-property-ordering.md @@ -12,7 +12,7 @@ This rule enforces that the properties of RuleTester test cases are arranged in This rule has an array option: -* `["code", "output", "options", "parserOptions", "errors"]` (default): The properties of a test case should be placed in a consistent order. +- `["code", "output", "options", "parserOptions", "errors"]` (default): The properties of a test case should be placed in a consistent order. Examples of **incorrect** code for this rule: diff --git a/docs/rules/test-case-shorthand-strings.md b/docs/rules/test-case-shorthand-strings.md index f0133895..0eb4acb8 100644 --- a/docs/rules/test-case-shorthand-strings.md +++ b/docs/rules/test-case-shorthand-strings.md @@ -33,10 +33,10 @@ This rule aims to enforce or disallow the use of strings as test cases. This rule has a string option: -* `as-needed` (default): Requires the use of shorthand strings wherever possible. -* `never`: Disallows the use of shorthand strings. -* `consistent`: Requires that either all valid test cases use shorthand strings, or that no valid test cases use them. -* `consistent-as-needed`: Requires that all valid test cases use the longer object form if there are any valid test cases that require the object form. Otherwise, requires all valid test cases to use shorthand strings. +- `as-needed` (default): Requires the use of shorthand strings wherever possible. +- `never`: Disallows the use of shorthand strings. +- `consistent`: Requires that either all valid test cases use shorthand strings, or that no valid test cases use them. +- `consistent-as-needed`: Requires that all valid test cases use the longer object form if there are any valid test cases that require the object form. Otherwise, requires all valid test cases to use shorthand strings. #### `as-needed` @@ -237,10 +237,10 @@ ruleTester.run('example-rule', rule, { ## Known Limitations -* Test cases which are neither object literals nor string literals are ignored by this rule. -* In order to find your test cases, your test file needs to match the following common pattern: - * `new RuleTester()` or `new (require('eslint')).RuleTester()` is called at the top level of the file - * `ruleTester.run` is called at the top level with the same variable (or in the same expression) as the `new RuleTester` instantiation +- Test cases which are neither object literals nor string literals are ignored by this rule. +- In order to find your test cases, your test file needs to match the following common pattern: + - `new RuleTester()` or `new (require('eslint')).RuleTester()` is called at the top level of the file + - `ruleTester.run` is called at the top level with the same variable (or in the same expression) as the `new RuleTester` instantiation ## When Not To Use It @@ -248,4 +248,4 @@ If you don't care about consistent usage of shorthand strings, you should not tu ## Further Reading -* [`RuleTester` documentation](http://eslint.org/docs/developer-guide/working-with-plugins#testing) +- [`RuleTester` documentation](http://eslint.org/docs/developer-guide/working-with-plugins#testing)