You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/node_modules/@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest/README.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,9 @@ limitations under the License.
18
18
19
19
-->
20
20
21
-
# tsdoc-doctest
21
+
# tsdoc-declarations-doctest
22
22
23
-
> [ESLint rule][eslint-rules] to ensure that return annotations in TSDoc examples match the actual output.
23
+
> [ESLint rule][eslint-rules] to ensure that return annotations in TSDoc examples match the actual output in TypeScript declaration files (`.d.ts`).
24
24
25
25
<sectionclass="intro">
26
26
@@ -33,16 +33,16 @@ limitations under the License.
33
33
## Usage
34
34
35
35
```javascript
36
-
var rule =require( '@stdlib/_tools/eslint/rules/tsdoc-doctest' );
36
+
var rule =require( '@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest' );
37
37
```
38
38
39
39
#### rule
40
40
41
-
[ESLint rule][eslint-rules] to ensure that return annotations in TSDoc examples match the actual output. Return annotations may start with `returns`, `throws`, or `=>`. `returns` follow variable declarations or assignment expressions, whereas `=>` follow expression-only forms including `console.log` calls. The rule validates `@example` blocks in TSDoc comments within `.d.ts` files by automatically resolving the corresponding implementation via the nearest `package.json` file.
41
+
[ESLint rule][eslint-rules] to ensure that return annotations in TSDoc examples match the actual output in TypeScript declaration files (`.d.ts`). Return annotations may start with `returns`, `throws`, or `=>`. `returns` follow variable declarations or assignment expressions, whereas `=>` follow expression-only forms including `console.log` calls. The rule validates `@example` blocks in TSDoc comments within `.d.ts` files by automatically resolving the corresponding implementation via the nearest `package.json` file.
'message': 'Displayed return value is `2`, but expected `3` instead',
140
140
'line': 9,
@@ -158,6 +158,7 @@ var result = linter.verify( code, {
158
158
- The rule automatically resolves the implementation path by traversing up the directory tree to find the nearest `package.json` file and using its `main` field.
159
159
- The rule skips validation if the `package.json` file cannot be found or if the resolved implementation cannot be loaded.
160
160
- Examples are executed in a sandboxed VM context with limited globals for security.
161
+
- This rule is specifically designed for TypeScript declaration files and will only process files with a `.d.ts` extension.
0 commit comments