Skip to content

Commit 78f7992

Browse files
committed
docs: formatting & phrasing edits; closes #432
Incorporates changes of #432 with a few minor modifications.
1 parent 31c9789 commit 78f7992

File tree

3 files changed

+65
-48
lines changed

3 files changed

+65
-48
lines changed

.README/README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ Or one may set the targeted tag to an object with a custom `message`, but withou
198198
Note that the preferred tags indicated in the `settings.jsdoc.tagNamePreference`
199199
map will be assumed to be defined by `check-tag-names`.
200200

201+
#### Default Preferred Aliases
202+
201203
The defaults in `eslint-plugin-jsdoc` (for tags which offer
202204
aliases) are as follows:
203205

@@ -287,22 +289,28 @@ The format of the configuration is as follows:
287289
- `false` to forbid the type
288290
- a string to indicate the type that should be preferred in its place
289291
(and which `fix` mode can replace); this can be one of the formats
290-
of the keys described above. Note that the format will not be changed
291-
unless you use a pseudo-type in the replacement (e.g.,
292-
`'Array.<>': 'MyArray'` will change `Array.<string>` to `MyArray.<string>`,
293-
preserving the dot; to get rid of the dot, you must use the pseudo-type:
294-
`'Array.<>': 'MyArray<>'` which will change `Array.<string>` to
295-
`MyArray<string>`). If you use a bare pseudo-type in the replacement,
296-
e.g., `'MyArray.<>': '<>'`, the type will be converted to the format
297-
of the pseudo-type without changing the type name, i.e., `MyArray.<string>`
298-
will become `MyArray<string>` but `Array.<string>` will not be modified.
299-
- an object with the key `message` to provide a specific error message
300-
when encountering the discouraged type and, if a type is to be preferred
301-
in its place, the key `replacement` to indicate the type that should be
302-
used in its place (and which `fix` mode can replace) or `false` if
303-
forbidding the type. The message string will have the substrings with
304-
special meaning, `{{tagName}}` and `{{tagValue}}`, replaced with their
305-
corresponding value.
292+
of the keys described above.
293+
- Note that the format will not be changed unless you use a pseudo-type
294+
in the replacement. (For example, `'Array.<>': 'MyArray'` will change
295+
`Array.<string>` to `MyArray.<string>`, preserving the dot. To get rid
296+
of the dot, you must use the pseudo-type with `<>`, i.e.,
297+
`'Array.<>': 'MyArray<>'`, which will change `Array.<string>` to
298+
`MyArray<string>`).
299+
- If you use a _bare_ pseudo-type in the replacement (e.g.,
300+
`'MyArray.<>': '<>'`), the type will be converted to the format
301+
of the pseudo-type without changing the type name. For example,
302+
`MyArray.<string>` will become `MyArray<string>` but `Array.<string>`
303+
will not be modified.
304+
- an object with:
305+
- the key `message` to provide a specific error message
306+
when encountering the discouraged type.
307+
- The message string will have the substrings with special meaning,
308+
`{{tagName}}` and `{{tagValue}}`, replaced with their
309+
corresponding value.
310+
- an optional key `replacement` with either of the following values:
311+
- a string type to be preferred in its place (and which `fix` mode
312+
can replace)
313+
- `false` (for forbidding the type)
306314

307315
Note that the preferred types indicated as targets in `settings.jsdoc.preferredTypes`
308316
map will be assumed to be defined by `no-undefined-types`.

.README/rules/check-examples.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,15 @@ decreasing precedence:
9898
* `eslintrcForExamples` - Defaults to `true` in adding rules
9999
based on an `.eslintrc.*` file. Setting to `false` corresponds to
100100
ESLint's [`--no-eslintrc`](https://eslint.org/docs/user-guide/command-line-interface#--no-eslintrc).
101-
* `baseConfig` - An object of rules with the same schema
102-
as `.eslintrc.*` for defaults
101+
* `baseConfig` - Set to an object of rules with the same schema
102+
as `.eslintrc.*` for defaults.
103103

104104
##### Rules Disabled by Default Unless `noDefaultExampleRules` is Set to `true`
105105

106106
* `eol-last` - Insisting that a newline "always" be at the end is less likely
107-
to be desired in sample code as with the code file convention
108-
* `no-console` - Unlikely to have inadvertent temporary debugging within
109-
examples
107+
to be desired in sample code as with the code file convention.
108+
* `no-console` - This rule is unlikely to have inadvertent temporary debugging
109+
within examples.
110110
* `no-undef` - Many variables in examples will be `undefined`.
111111
* `no-unused-vars` - It is common to define variables for clarity without always
112112
using them within examples.
@@ -115,9 +115,9 @@ decreasing precedence:
115115
* `import/no-unresolved` - One wouldn't generally expect example paths to
116116
resolve relative to the current JavaScript file as one would with real code.
117117
* `import/unambiguous` - Snippets in examples are likely too short to always
118-
include full import/export info
119-
* `node/no-missing-import` - See `import/no-unresolved`
120-
* `node/no-missing-require` - See `import/no-unresolved`
118+
include full import/export info.
119+
* `node/no-missing-import` - See `import/no-unresolved`.
120+
* `node/no-missing-require` - See `import/no-unresolved`.
121121

122122
|||
123123
|---|---|

README.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ Or one may set the targeted tag to an object with a custom `message`, but withou
246246
Note that the preferred tags indicated in the `settings.jsdoc.tagNamePreference`
247247
map will be assumed to be defined by `check-tag-names`.
248248

249+
<a name="eslint-plugin-jsdoc-settings-alias-preference-default-preferred-aliases"></a>
250+
#### Default Preferred Aliases
251+
249252
The defaults in `eslint-plugin-jsdoc` (for tags which offer
250253
aliases) are as follows:
251254

@@ -337,22 +340,28 @@ The format of the configuration is as follows:
337340
- `false` to forbid the type
338341
- a string to indicate the type that should be preferred in its place
339342
(and which `fix` mode can replace); this can be one of the formats
340-
of the keys described above. Note that the format will not be changed
341-
unless you use a pseudo-type in the replacement (e.g.,
342-
`'Array.<>': 'MyArray'` will change `Array.<string>` to `MyArray.<string>`,
343-
preserving the dot; to get rid of the dot, you must use the pseudo-type:
344-
`'Array.<>': 'MyArray<>'` which will change `Array.<string>` to
345-
`MyArray<string>`). If you use a bare pseudo-type in the replacement,
346-
e.g., `'MyArray.<>': '<>'`, the type will be converted to the format
347-
of the pseudo-type without changing the type name, i.e., `MyArray.<string>`
348-
will become `MyArray<string>` but `Array.<string>` will not be modified.
349-
- an object with the key `message` to provide a specific error message
350-
when encountering the discouraged type and, if a type is to be preferred
351-
in its place, the key `replacement` to indicate the type that should be
352-
used in its place (and which `fix` mode can replace) or `false` if
353-
forbidding the type. The message string will have the substrings with
354-
special meaning, `{{tagName}}` and `{{tagValue}}`, replaced with their
355-
corresponding value.
343+
of the keys described above.
344+
- Note that the format will not be changed unless you use a pseudo-type
345+
in the replacement. (For example, `'Array.<>': 'MyArray'` will change
346+
`Array.<string>` to `MyArray.<string>`, preserving the dot. To get rid
347+
of the dot, you must use the pseudo-type with `<>`, i.e.,
348+
`'Array.<>': 'MyArray<>'`, which will change `Array.<string>` to
349+
`MyArray<string>`).
350+
- If you use a _bare_ pseudo-type in the replacement (e.g.,
351+
`'MyArray.<>': '<>'`), the type will be converted to the format
352+
of the pseudo-type without changing the type name. For example,
353+
`MyArray.<string>` will become `MyArray<string>` but `Array.<string>`
354+
will not be modified.
355+
- an object with:
356+
- the key `message` to provide a specific error message
357+
when encountering the discouraged type.
358+
- The message string will have the substrings with special meaning,
359+
`{{tagName}}` and `{{tagValue}}`, replaced with their
360+
corresponding value.
361+
- an optional key `replacement` with either of the following values:
362+
- a string type to be preferred in its place (and which `fix` mode
363+
can replace)
364+
- `false` (for forbidding the type)
356365

357366
Note that the preferred types indicated as targets in `settings.jsdoc.preferredTypes`
358367
map will be assumed to be defined by `no-undefined-types`.
@@ -732,16 +741,16 @@ decreasing precedence:
732741
* `eslintrcForExamples` - Defaults to `true` in adding rules
733742
based on an `.eslintrc.*` file. Setting to `false` corresponds to
734743
ESLint's [`--no-eslintrc`](https://eslint.org/docs/user-guide/command-line-interface#--no-eslintrc).
735-
* `baseConfig` - An object of rules with the same schema
736-
as `.eslintrc.*` for defaults
744+
* `baseConfig` - Set to an object of rules with the same schema
745+
as `.eslintrc.*` for defaults.
737746

738747
<a name="eslint-plugin-jsdoc-rules-check-examples-options-for-determining-eslint-rule-applicability-allowinlineconfig-nodefaultexamplerules-matchingfilename-configfile-eslintrcforexamples-and-baseconfig-rules-disabled-by-default-unless-nodefaultexamplerules-is-set-to-true"></a>
739748
##### Rules Disabled by Default Unless <code>noDefaultExampleRules</code> is Set to <code>true</code>
740749

741750
* `eol-last` - Insisting that a newline "always" be at the end is less likely
742-
to be desired in sample code as with the code file convention
743-
* `no-console` - Unlikely to have inadvertent temporary debugging within
744-
examples
751+
to be desired in sample code as with the code file convention.
752+
* `no-console` - This rule is unlikely to have inadvertent temporary debugging
753+
within examples.
745754
* `no-undef` - Many variables in examples will be `undefined`.
746755
* `no-unused-vars` - It is common to define variables for clarity without always
747756
using them within examples.
@@ -750,9 +759,9 @@ decreasing precedence:
750759
* `import/no-unresolved` - One wouldn't generally expect example paths to
751760
resolve relative to the current JavaScript file as one would with real code.
752761
* `import/unambiguous` - Snippets in examples are likely too short to always
753-
include full import/export info
754-
* `node/no-missing-import` - See `import/no-unresolved`
755-
* `node/no-missing-require` - See `import/no-unresolved`
762+
include full import/export info.
763+
* `node/no-missing-import` - See `import/no-unresolved`.
764+
* `node/no-missing-require` - See `import/no-unresolved`.
756765

757766
|||
758767
|---|---|

0 commit comments

Comments
 (0)