Skip to content

Commit 08dea57

Browse files
Merge branch 'stdlib-js:develop' into pmf-3473
2 parents 56deca4 + 98fa29f commit 08dea57

File tree

826 files changed

+40109
-7843
lines changed

Some content is hidden

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

826 files changed

+40109
-7843
lines changed

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ REPL:
3535
Statistics:
3636
- changed-files:
3737
- any-glob-to-all-files: '**/stats/**/*'
38+
39+
Tools:
40+
- changed-files:
41+
- any-glob-to-all-files: '**/_tools/**/*'
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: update namespace TypeScript declarations
5+
PR-URL: #4266
6+
7+
Co-authored-by: Philipp Burckhardt <[email protected]>
8+
Reviewed-by: Philipp Burckhardt <[email protected]>
9+
Signed-off-by: stdlib-bot <[email protected]>

etc/eslint/rules/stdlib.js

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ rules[ 'stdlib/capitalized-comments' ] = [ 'warn', {
6969
'stdlib',
7070
'throws'
7171
]
72-
} ];
72+
}];
7373

7474
/**
7575
* Enforce that return annotation values match actual output.
@@ -244,7 +244,7 @@ rules[ 'stdlib/empty-line-before-comment' ] = 'error';
244244
* 'bar': true
245245
* }]);
246246
*/
247-
rules[ 'stdlib/eol-open-bracket-spacing' ] = 'error';
247+
rules[ 'stdlib/eol-open-bracket-spacing' ] = 'off'; // FIXME: temporarily disabled until bugs are fixed
248248

249249
/**
250250
* Require blockquotes to have `2` character indentation.
@@ -3861,6 +3861,52 @@ rules[ 'stdlib/jsdoc-unordered-list-marker-style' ] = [ 'error', '-' ];
38613861
*/
38623862
rules[ 'stdlib/jsdoc-main-export' ] = 'error';
38633863

3864+
/**
3865+
* Disallow spaces between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line.
3866+
*
3867+
* @name line-closing-bracket-spacing
3868+
* @memberof rules
3869+
* @type {string}
3870+
* @default 'error'
3871+
*
3872+
* @example
3873+
* // Bad...
3874+
* var log = require( '@stdlib/console/log' );
3875+
*
3876+
* log({
3877+
* 'foo': true
3878+
* } );
3879+
*
3880+
* log([
3881+
* 1,
3882+
* 2,
3883+
* 3
3884+
* ] );
3885+
*
3886+
* log([{
3887+
* 'bar': true
3888+
* } ] );
3889+
*
3890+
* @example
3891+
* // Good...
3892+
* var log = require( '@stdlib/console/log' );
3893+
*
3894+
* log({
3895+
* 'foo': true
3896+
* });
3897+
*
3898+
* log([
3899+
* 1,
3900+
* 2,
3901+
* 3
3902+
* ]);
3903+
*
3904+
* log([{
3905+
* 'bar': true
3906+
* }]);
3907+
*/
3908+
rules[ 'stdlib/line-closing-bracket-spacing' ] = 'error';
3909+
38643910
/**
38653911
* Enforce that export statements are placed at the end of a file.
38663912
*

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ var eslint = rules;
5858
- <span class="signature">[`empty-line-before-comment`][@stdlib/_tools/eslint/rules/empty-line-before-comment]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce empty lines before comments.</span>
5959
- <span class="signature">[`eol-open-bracket-spacing`][@stdlib/_tools/eslint/rules/eol-open-bracket-spacing]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression at the end of a line.</span>
6060
- <span class="signature">[`first-unit-test`][@stdlib/_tools/eslint/rules/first-unit-test]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that a tape file starts with the expected test.</span>
61+
- <span class="signature">[`line-closing-bracket-spacing`][@stdlib/_tools/eslint/rules/line-closing-bracket-spacing]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that no spaces are present between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line.</span>
6162
- <span class="signature">[`module-exports-last`][@stdlib/_tools/eslint/rules/module-exports-last]</span><span class="delimiter">: </span><span class="description">ESLint rule enforcing that export statements appear at the end of a file.</span>
6263
- <span class="signature">[`namespace-export-all`][@stdlib/_tools/eslint/rules/namespace-export-all]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that a namespace `index.js` exports all packages in the respective namespace directory.</span>
6364
- <span class="signature">[`namespace-index-order`][@stdlib/_tools/eslint/rules/namespace-index-order]</span><span class="delimiter">: </span><span class="description">ESLint rule to enforce that modules in a namespace `index.js` file are listed in alphabetical order according to module name.</span>
@@ -377,6 +378,8 @@ console.log( getKeys( rules ) );
377378

378379
[@stdlib/_tools/eslint/rules/first-unit-test]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/first-unit-test
379380

381+
[@stdlib/_tools/eslint/rules/line-closing-bracket-spacing]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/line-closing-bracket-spacing
382+
380383
[@stdlib/_tools/eslint/rules/module-exports-last]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/module-exports-last
381384

382385
[@stdlib/_tools/eslint/rules/namespace-export-all]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/_tools/eslint/rules/namespace-export-all

lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ function main( context ) {
9191
) {
9292
prevToken = source.getTokenBefore( args[ 0 ] );
9393
tokenAfter = source.getFirstToken( args[ 0 ] );
94-
if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
94+
if (
95+
prevToken.loc.end.line === tokenAfter.loc.end.line &&
96+
source.isSpaceBetween( prevToken, tokenAfter )
97+
) {
9598
report( node, prevToken, tokenAfter );
9699
}
97100
} else if ( args[ 0 ].type === 'ArrayExpression' ) {
@@ -102,7 +105,10 @@ function main( context ) {
102105
) {
103106
prevToken = source.getTokenBefore( args[ 0 ] );
104107
tokenAfter = source.getFirstToken( args[ 0 ] );
105-
if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
108+
if (
109+
prevToken.loc.end.line === tokenAfter.loc.end.line &&
110+
source.isSpaceBetween( prevToken, tokenAfter )
111+
) {
106112
report( node, prevToken, tokenAfter );
107113
}
108114
} else {
@@ -111,6 +117,7 @@ function main( context ) {
111117
nextToken = source.getTokenAfter( tokenAfter );
112118
if (
113119
tokenAfter.loc.end.line !== nextToken.loc.end.line &&
120+
prevToken.loc.end.line === tokenAfter.loc.end.line &&
114121
source.isSpaceBetween( prevToken, tokenAfter )
115122
) {
116123
report( node, prevToken, tokenAfter );
@@ -131,7 +138,10 @@ function main( context ) {
131138
prevToken = source.getFirstToken( node );
132139
tokenAfter = source.getFirstToken( elem );
133140

134-
if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
141+
if (
142+
prevToken.loc.end.line === tokenAfter.loc.end.line &&
143+
source.isSpaceBetween( prevToken, tokenAfter )
144+
) {
135145
report( node, prevToken, tokenAfter );
136146
}
137147
}

lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,79 @@ test = {
3333
'var arrSum = sum( [ 1, 2, 3, 4 ] );'
3434
].join( '\n' )
3535
};
36-
valid.push( test);
36+
valid.push( test );
3737

3838
test = {
3939
'code': [
4040
' var log = require( \'@stdlib/console/log\' );',
4141
' log( {} );'
4242
].join( '\n' )
4343
};
44-
valid.push( test);
44+
valid.push( test );
4545

4646
test = {
4747
'code': [
4848
'var arr = [ {}, 1, 2, 3, 4 ];'
4949
].join( '\n' )
5050
};
51-
valid.push( test);
51+
valid.push( test );
52+
53+
test = {
54+
'code': [
55+
' var log = require( \'@stdlib/console/log\' );',
56+
' log(',
57+
' {',
58+
' \'a\': 1',
59+
' }',
60+
' );'
61+
].join( '\n' )
62+
};
63+
valid.push( test );
64+
65+
test = {
66+
'code': [
67+
' var log = require( \'@stdlib/console/log\' );',
68+
' log(',
69+
' [',
70+
' 1,',
71+
' 2',
72+
' ]',
73+
' );'
74+
].join( '\n' )
75+
};
76+
valid.push( test );
77+
78+
test = {
79+
'code': [
80+
' var log = require( \'@stdlib/console/log\' );',
81+
' log(',
82+
' [',
83+
' {',
84+
' \'a\': 1',
85+
' }',
86+
' ]',
87+
' );'
88+
].join( '\n' )
89+
};
90+
valid.push( test );
91+
92+
test = {
93+
'code': [
94+
' var arr = [',
95+
' {',
96+
' \'a\': 1',
97+
' }',
98+
'];'
99+
].join( '\n' )
100+
};
101+
valid.push( test );
102+
103+
test = {
104+
'code': [
105+
' var x = array( [] );'
106+
].join( '\n' )
107+
};
108+
valid.push( test );
52109

53110

54111
// EXPORTS //

lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,15 @@ setReadOnly( rules, 'jsdoc-typedef-typos', require( '@stdlib/_tools/eslint/rules
765765
*/
766766
setReadOnly( rules, 'jsdoc-unordered-list-marker-style', require( '@stdlib/_tools/eslint/rules/jsdoc-unordered-list-marker-style' ) );
767767

768+
/**
769+
* @name line-closing-bracket-spacing
770+
* @memberof rules
771+
* @readonly
772+
* @type {Function}
773+
* @see {@link module:@stdlib/_tools/eslint/rules/line-closing-bracket-spacing}
774+
*/
775+
setReadOnly( rules, 'line-closing-bracket-spacing', require( '@stdlib/_tools/eslint/rules/line-closing-bracket-spacing' ) );
776+
768777
/**
769778
* @name module-exports-last
770779
* @memberof rules

0 commit comments

Comments
 (0)