Skip to content

Commit e498bea

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into feat-stats-nanrange
2 parents 9acdf11 + cb8dd72 commit e498bea

File tree

398 files changed

+18909
-1724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

398 files changed

+18909
-1724
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
type: amend-message
3+
---
4+
docs: improve doctests for complex number instances in `math/base/special/cflipsignf`
5+
6+
PR-URL: https://github.com/stdlib-js/stdlib/pull/9011
7+
Ref: https://github.com/stdlib-js/stdlib/issues/8641
8+
9+
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
type: amend-message
3+
---
4+
docs: improve doctests for complex number instances in `math/base/special/csignum`
5+
6+
PR-URL: https://github.com/stdlib-js/stdlib/pull/9012
7+
Ref: https://github.com/stdlib-js/stdlib/issues/8641
8+
9+
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
type: amend-message
3+
---
4+
docs: improve doctests for complex number instances in `math/base/special/cceil`
5+
6+
PR-URL: https://github.com/stdlib-js/stdlib/pull/9007
7+
Ref: https://github.com/stdlib-js/stdlib/issues/8641
8+
9+
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>

etc/eslint/.eslintrc.benchmarks.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ eslint.rules[ 'stdlib/jsdoc-doctest' ] = 'off';
126126
*/
127127
eslint.rules[ 'stdlib/no-unnecessary-nested-functions' ] = 'off';
128128

129+
/**
130+
* Warn when using string concatenation in benchmark descriptions.
131+
*
132+
* @private
133+
*/
134+
eslint.rules[ 'stdlib/no-bench-string-concat' ] = 'warn';
135+
129136

130137
// EXPORTS //
131138

etc/eslint/rules/stdlib.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,6 +4157,25 @@ rules[ 'stdlib/no-dynamic-require' ] = 'error';
41574157
*/
41584158
rules[ 'stdlib/no-empty-comments' ] = 'error';
41594159

4160+
/**
4161+
* Disallow string concatenation in error messages.
4162+
*
4163+
* @name no-error-string-concat
4164+
* @memberof rules
4165+
* @type {string}
4166+
* @default 'error'
4167+
*
4168+
* @example
4169+
* // Bad...
4170+
* throw new Error( 'invalid argument. Value: `' + value + '`.' );
4171+
*
4172+
* @example
4173+
* // Good...
4174+
* throw new Error( 'unexpected error.' );
4175+
* throw new Error( format( 'invalid argument. Value: `%s`.', value ) );
4176+
*/
4177+
rules[ 'stdlib/no-error-string-concat' ] = 'error';
4178+
41604179
/**
41614180
* Enforce that `require()` expressions are not immediately invoked.
41624181
*

lib/node_modules/@stdlib/_tools/eslint/rules/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ var eslint = rules;
5252
<div class="namespace-toc">
5353

5454
- <span class="signature">[`capitalized-comments`][@stdlib/_tools/eslint/rules/capitalized-comments]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that comments start with an uppercase letter.</span>
55+
- <span class="signature">[`doctest-annotation-spacing`][@stdlib/_tools/eslint/rules/doctest-annotation-spacing]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce spacing in return annotations in single-line comments.</span>
5556
- <span class="signature">[`doctest-marker`][@stdlib/_tools/eslint/rules/doctest-marker]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce marker style conventions for return annotations.</span>
5657
- <span class="signature">[`doctest-quote-props`][@stdlib/_tools/eslint/rules/doctest-quote-props]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that property names in return annotations are quoted using single quotes.</span>
5758
- <span class="signature">[`doctest`][@stdlib/_tools/eslint/rules/doctest]</span><span class="delimiter">: </span><span class="description">ESLint rule to ensure return annotations match the actual output.</span>
@@ -374,6 +375,8 @@ console.log( getKeys( rules ) );
374375

375376
[@stdlib/_tools/eslint/rules/capitalized-comments]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/capitalized-comments
376377

378+
[@stdlib/_tools/eslint/rules/doctest-annotation-spacing]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/doctest-annotation-spacing
379+
377380
[@stdlib/_tools/eslint/rules/doctest-marker]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/doctest-marker
378381

379382
[@stdlib/_tools/eslint/rules/doctest-quote-props]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/doctest-quote-props
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# doctest-annotation-spacing
22+
23+
> [ESLint rule][eslint-rules] to enforce spacing in return annotations in single-line comments.
24+
25+
<section class="intro">
26+
27+
</section>
28+
29+
<!-- /.intro -->
30+
31+
<section class="usage">
32+
33+
## Usage
34+
35+
```javascript
36+
var rule = require( '@stdlib/_tools/eslint/rules/doctest-annotation-spacing' );
37+
```
38+
39+
#### rule
40+
41+
[ESLint rule][eslint-rules] to enforce spacing in return annotations in single-line comments.
42+
43+
**Bad** (too many spaces after `returns`):
44+
45+
<!-- eslint-disable stdlib/doctest-annotation-spacing -->
46+
47+
```javascript
48+
var v = 3.14;
49+
// returns 3.14
50+
```
51+
52+
**Bad** (no space before `=>`):
53+
54+
<!-- eslint-disable stdlib/doctest-annotation-spacing, spaced-comment -->
55+
56+
```javascript
57+
console.log( 'beep' );
58+
//=> 'beep'
59+
```
60+
61+
**Bad** (too many spaces before `returns`):
62+
63+
<!-- eslint-disable stdlib/doctest-annotation-spacing, spaced-comment -->
64+
65+
```javascript
66+
var x = true;
67+
// returns true
68+
```
69+
70+
**Good**:
71+
72+
```javascript
73+
var v = 3.14;
74+
// returns 3.14
75+
76+
console.log( 'beep' );
77+
// => 'beep'
78+
```
79+
80+
</section>
81+
82+
<!-- /.usage -->
83+
84+
<section class="notes">
85+
86+
## Notes
87+
88+
- This rule only applies to single-line comments (starting with `//`). Multi-line comments (`/* ... */`) are ignored.
89+
90+
- The rule matches the following patterns:
91+
92+
- `// returns`
93+
- `// =>`
94+
- `// e.g., returns`
95+
- `// e.g., =>`
96+
97+
- The rule enforces two spacing requirements:
98+
99+
- Exactly 1 space between `//` and an annotation keyword (`returns`) or identifier (`=>`).
100+
- Exactly 1 space after the annotation keyword.
101+
102+
</section>
103+
104+
<!-- /.notes -->
105+
106+
<section class="examples">
107+
108+
## Examples
109+
110+
<!-- eslint no-undef: "error" -->
111+
112+
```javascript
113+
var Linter = require( 'eslint' ).Linter;
114+
var rule = require( '@stdlib/_tools/eslint/rules/doctest-annotation-spacing' );
115+
116+
var linter = new Linter();
117+
118+
var code = [
119+
'var v = foo();',
120+
'// returns \'beep\'',
121+
'',
122+
'console.log( bar() );',
123+
'// => \'boop\''
124+
].join( '\n' );
125+
126+
linter.defineRule( 'doctest-annotation-spacing', rule );
127+
128+
var result = linter.verify( code, {
129+
'rules': {
130+
'doctest-annotation-spacing': 'error'
131+
}
132+
});
133+
/* returns
134+
[
135+
{
136+
'ruleId': 'doctest-annotation-spacing',
137+
'severity': 2,
138+
'message': 'Return annotation keyword `returns` should be followed by 1 space. Found 13 space(s).',
139+
'line': 2,
140+
'column': 1,
141+
'nodeType': null,
142+
'endLine': 2,
143+
'endColumn': 30
144+
}
145+
]
146+
*/
147+
```
148+
149+
</section>
150+
151+
<!-- /.examples -->
152+
153+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
154+
155+
<section class="related">
156+
157+
</section>
158+
159+
<!-- /.related -->
160+
161+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
162+
163+
<section class="links">
164+
165+
[eslint-rules]: https://eslint.org/docs/developer-guide/working-with-rules
166+
167+
</section>
168+
169+
<!-- /.links -->
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
var Linter = require( 'eslint' ).Linter;
22+
var rule = require( './../lib' );
23+
24+
var linter = new Linter();
25+
26+
var code = [
27+
'var v = foo();',
28+
'// returns \'beep\'',
29+
'',
30+
'console.log( bar() );',
31+
'// => \'boop\''
32+
].join( '\n' );
33+
34+
linter.defineRule( 'doctest-annotation-spacing', rule );
35+
36+
var result = linter.verify( code, {
37+
'rules': {
38+
'doctest-annotation-spacing': 'error'
39+
}
40+
});
41+
console.log( result );
42+
/* =>
43+
[
44+
{
45+
'ruleId': 'doctest-annotation-spacing',
46+
'severity': 2,
47+
'message': 'Return annotation keyword `returns` should be followed by 1 space(s). Found 13 space(s).',
48+
'line': 2,
49+
'column': 1,
50+
'nodeType': null,
51+
'endLine': 2,
52+
'endColumn': 30
53+
}
54+
]
55+
*/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* ESLint rule to enforce spacing after return annotations in single-line comments.
23+
*
24+
* @module @stdlib/_tools/eslint/rules/doctest-annotation-spacing
25+
*
26+
* @example
27+
* var rule = require( '@stdlib/_tools/eslint/rules/doctest-annotation-spacing' );
28+
*
29+
* console.log( rule );
30+
*/
31+
32+
// MODULES //
33+
34+
var main = require( './main.js' );
35+
36+
37+
// EXPORTS //
38+
39+
module.exports = main;

0 commit comments

Comments
 (0)