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
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ var rule = require( '@stdlib/_tools/eslint/rules/tsdoc-declarations-doctest' );
38
38
39
39
#### rule
40
40
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.
41
+
[ESLint rule][eslint-rules] to ensure that return annotations in TSDoc examples match the actual output in TypeScript declaration files (`*.d.ts`).
42
42
43
43
**Bad**:
44
44
@@ -84,6 +84,20 @@ export = add;
84
84
85
85
<!-- /.usage -->
86
86
87
+
<sectionclass="notes">
88
+
89
+
## Notes
90
+
91
+
- Return annotations may start with `returns`, `throws`, or `=>`. `returns` follow variable declarations or assignment expressions, whereas `=>` follow expression-only forms including `console.log` calls.
92
+
- The rule validates `@example` blocks in TSDoc comments within `*.d.ts` files by resolving the corresponding implementation via the nearest `package.json` file in the same or a parent directory and using its `main` field.
93
+
- The rule skips validation if the `package.json` file cannot be found or if the resolved implementation cannot be loaded.
94
+
- Examples are executed in a sandboxed VM context with limited globals for security.
95
+
- This rule is specifically designed for TypeScript declaration files and will only process files with a `*.d.ts` filename extension.
96
+
97
+
</section>
98
+
99
+
<!-- /.notes -->
100
+
87
101
<sectionclass="examples">
88
102
89
103
## Examples
@@ -151,19 +165,6 @@ var result = linter.verify( code, {
151
165
152
166
<!-- /.examples -->
153
167
154
-
<sectionclass="notes">
155
-
156
-
## Notes
157
-
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
-
- The rule skips validation if the `package.json` file cannot be found or if the resolved implementation cannot be loaded.
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.
162
-
163
-
</section>
164
-
165
-
<!-- /.notes -->
166
-
167
168
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
0 commit comments