diff --git a/.github/labeler.yml b/.github/labeler.yml
index 01711a0fb732..2994baf6234e 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -35,3 +35,7 @@ REPL:
Statistics:
- changed-files:
- any-glob-to-all-files: '**/stats/**/*'
+
+Tools:
+- changed-files:
+ - any-glob-to-all-files: '**/_tools/**/*'
diff --git a/etc/eslint/rules/stdlib.js b/etc/eslint/rules/stdlib.js
index 0de07ac30f90..09d3f9d7e717 100644
--- a/etc/eslint/rules/stdlib.js
+++ b/etc/eslint/rules/stdlib.js
@@ -69,7 +69,7 @@ rules[ 'stdlib/capitalized-comments' ] = [ 'warn', {
'stdlib',
'throws'
]
-} ];
+}];
/**
* Enforce that return annotation values match actual output.
@@ -3861,6 +3861,52 @@ rules[ 'stdlib/jsdoc-unordered-list-marker-style' ] = [ 'error', '-' ];
*/
rules[ 'stdlib/jsdoc-main-export' ] = 'error';
+/**
+* Disallow spaces between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line.
+*
+* @name line-closing-bracket-spacing
+* @memberof rules
+* @type {string}
+* @default 'error'
+*
+* @example
+* // Bad...
+* var log = require( '@stdlib/console/log' );
+*
+* log({
+* 'foo': true
+* } );
+*
+* log([
+* 1,
+* 2,
+* 3
+* ] );
+*
+* log([{
+* 'bar': true
+* } ] );
+*
+* @example
+* // Good...
+* var log = require( '@stdlib/console/log' );
+*
+* log({
+* 'foo': true
+* });
+*
+* log([
+* 1,
+* 2,
+* 3
+* ]);
+*
+* log([{
+* 'bar': true
+* }]);
+*/
+rules[ 'stdlib/line-closing-bracket-spacing' ] = 'error';
+
/**
* Enforce that export statements are placed at the end of a file.
*
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js
index 8cd70482498e..0655164d9324 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js
@@ -91,7 +91,10 @@ function main( context ) {
) {
prevToken = source.getTokenBefore( args[ 0 ] );
tokenAfter = source.getFirstToken( args[ 0 ] );
- if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
+ if (
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
report( node, prevToken, tokenAfter );
}
} else if ( args[ 0 ].type === 'ArrayExpression' ) {
@@ -102,7 +105,10 @@ function main( context ) {
) {
prevToken = source.getTokenBefore( args[ 0 ] );
tokenAfter = source.getFirstToken( args[ 0 ] );
- if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
+ if (
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
report( node, prevToken, tokenAfter );
}
} else {
@@ -111,6 +117,7 @@ function main( context ) {
nextToken = source.getTokenAfter( tokenAfter );
if (
tokenAfter.loc.end.line !== nextToken.loc.end.line &&
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
source.isSpaceBetween( prevToken, tokenAfter )
) {
report( node, prevToken, tokenAfter );
@@ -131,7 +138,10 @@ function main( context ) {
prevToken = source.getFirstToken( node );
tokenAfter = source.getFirstToken( elem );
- if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
+ if (
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
report( node, prevToken, tokenAfter );
}
}
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js
index e99ae557b430..d6b9c4fa4ac8 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js
@@ -50,6 +50,56 @@ test = {
};
valid.push( test);
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log(',
+ ' {',
+ ' \'a\': 1',
+ ' }',
+ ' );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log(',
+ ' [',
+ ' 1,',
+ ' 2',
+ ' ]',
+ ' );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log(',
+ ' [',
+ ' {',
+ ' \'a\': 1',
+ ' }',
+ ' ]',
+ ' );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var arr = [',
+ ' {',
+ ' \'a\': 1',
+ ' }',
+ '];'
+ ].join( '\n' )
+};
+valid.push( test);
+
// EXPORTS //
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js
index 221f82484546..8b029f004377 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js
@@ -765,6 +765,15 @@ setReadOnly( rules, 'jsdoc-typedef-typos', require( '@stdlib/_tools/eslint/rules
*/
setReadOnly( rules, 'jsdoc-unordered-list-marker-style', require( '@stdlib/_tools/eslint/rules/jsdoc-unordered-list-marker-style' ) );
+/**
+* @name line-closing-bracket-spacing
+* @memberof rules
+* @readonly
+* @type {Function}
+* @see {@link module:@stdlib/_tools/eslint/rules/line-closing-bracket-spacing}
+*/
+setReadOnly( rules, 'line-closing-bracket-spacing', require( '@stdlib/_tools/eslint/rules/line-closing-bracket-spacing' ) );
+
/**
* @name module-exports-last
* @memberof rules
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/README.md
new file mode 100644
index 000000000000..3eb00ea1186f
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/README.md
@@ -0,0 +1,163 @@
+
+
+# line-closing-bracket-spacing
+
+> [ESLint rule][eslint-rules] 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.
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var rule = require( '@stdlib/_tools/eslint/rules/line-closing-bracket-spacing' );
+```
+
+#### rule
+
+[ESLint rule][eslint-rules] 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.
+
+**Bad**:
+
+
+
+```javascript
+var log = require( '@stdlib/console/log' );
+
+log({
+ 'foo': true
+} );
+
+log([
+ 1,
+ 2,
+ 3
+] );
+
+log([{
+ 'bar': true
+} ] );
+```
+
+**Good**:
+
+```javascript
+var log = require( '@stdlib/console/log' );
+
+log({
+ 'foo': true
+});
+
+log([
+ 1,
+ 2,
+ 3
+]);
+
+log([{
+ 'bar': true
+}]);
+```
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var Linter = require( 'eslint' ).Linter;
+var rule = require( '@stdlib/_tools/eslint/rules/line-closing-bracket-spacing' );
+
+var linter = new Linter();
+
+var code = [
+ 'function test() {',
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log({',
+ ' "key": "value"',
+ ' } );',
+ ' var arr = [{',
+ ' "nested": true',
+ ' } ];',
+ ' log( arr );',
+ '}'
+].join( '\n' );
+
+linter.defineRule( 'line-closing-bracket-spacing', rule );
+
+var result = linter.verify( code, {
+ 'rules': {
+ 'line-closing-bracket-spacing': 'error'
+ }
+});
+/* returns
+ [
+ {
+ 'ruleId': 'line-closing-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'line': 3,
+ 'column': 3,
+ 'nodeType': 'CallExpression'
+ },
+ {
+ 'ruleId': 'line-closing-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'line': 6,
+ 'column': 13,
+ 'nodeType': 'ArrayExpression'
+ }
+ ]
+*/
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[eslint-rules]: https://eslint.org/docs/developer-guide/working-with-rules
+
+
+
+
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/examples/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/examples/index.js
new file mode 100644
index 000000000000..bcf3c22419df
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/examples/index.js
@@ -0,0 +1,66 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var Linter = require( 'eslint' ).Linter;
+var rule = require( './../lib' );
+
+var linter = new Linter();
+
+var code = [
+ 'function test() {',
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log({',
+ ' "key": "value"',
+ ' } );',
+ ' var arr = [{',
+ ' "nested": true',
+ ' } ];',
+ ' log( arr );',
+ '}'
+].join( '\n' );
+
+linter.defineRule( 'line-closing-bracket-spacing', rule );
+
+var result = linter.verify( code, {
+ 'rules': {
+ 'line-closing-bracket-spacing': 'error'
+ }
+});
+console.log( result );
+/* =>
+ [
+ {
+ 'ruleId': 'line-closing-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'line': 3,
+ 'column': 3,
+ 'nodeType': 'CallExpression'
+ },
+ {
+ 'ruleId': 'line-closing-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'line': 6,
+ 'column': 13,
+ 'nodeType': 'ArrayExpression'
+ }
+ ]
+*/
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/lib/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/lib/index.js
new file mode 100644
index 000000000000..73a632bf9f55
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/lib/index.js
@@ -0,0 +1,39 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* 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.
+*
+* @module @stdlib/_tools/eslint/rules/line-closing-bracket-spacing
+*
+* @example
+* var rule = require( '@stdlib/_tools/eslint/rules/line-closing-bracket-spacing' );
+*
+* console.log( rule );
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/lib/main.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/lib/main.js
new file mode 100644
index 000000000000..e5124581c845
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/lib/main.js
@@ -0,0 +1,175 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// VARIABLES //
+
+var rule;
+
+
+// FUNCTIONS //
+
+/**
+* Rule for validating that no spaces are present between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line.
+*
+* @private
+* @param {Object} context - ESLint context
+* @returns {Object} validators
+*/
+function main( context ) {
+ var source = context.getSourceCode();
+
+ /**
+ * Reports the error message.
+ *
+ * @private
+ * @param {ASTNode} node - node to report
+ * @param {Object} tokenBefore - token before the space
+ * @param {Object} lastToken - token after the space
+ */
+ function report( node, tokenBefore, lastToken ) {
+ context.report({
+ 'node': node,
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'fix': fix
+ });
+
+ /**
+ * Fixes lint the error by removing the space after the object or array expression.
+ *
+ * @private
+ * @param {Object} fixer - ESLint fixer
+ * @returns {Object} fix
+ */
+ function fix( fixer ) {
+ var afterIdx;
+ var prevIdx;
+
+ prevIdx = source.getIndexFromLoc( tokenBefore.loc.end );
+ afterIdx = source.getIndexFromLoc( lastToken.loc.start );
+ return fixer.replaceTextRange( [ prevIdx, afterIdx ], '' );
+ }
+ }
+
+ /**
+ * Checks whether there are spaces present between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line.
+ *
+ * @private
+ * @param {ASTNode} node - node to examine
+ */
+ function validate( node ) {
+ var tokenBefore;
+ var tokenAfter;
+ var prevToken;
+ var lastElem;
+ var elem;
+ var args;
+
+ if (
+ node.type === 'CallExpression' &&
+ node.arguments.length > 0
+ ) {
+ args = node.arguments;
+ lastElem = args[ args.length - 1 ];
+ if (
+ lastElem.type === 'ObjectExpression' &&
+ lastElem.properties.length > 0
+ ) {
+ prevToken = source.getLastToken( lastElem );
+ tokenAfter = source.getTokenAfter( prevToken );
+ if (
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
+ report( node, prevToken, tokenAfter );
+ }
+ } else if ( lastElem.type === 'ArrayExpression' ) {
+ elem = lastElem.elements[ lastElem.elements.length - 1 ];
+ if (
+ elem.type === 'ObjectExpression' &&
+ elem.properties.length > 0
+ ) {
+ prevToken = source.getLastToken( lastElem );
+ tokenAfter = source.getTokenAfter( prevToken );
+ if (
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
+ report( node, prevToken, tokenAfter );
+ }
+ } else {
+ prevToken = source.getLastToken( lastElem );
+ tokenBefore = source.getTokenBefore( prevToken );
+ tokenAfter = source.getTokenAfter( prevToken );
+ if (
+ tokenBefore.loc.end.line !== prevToken.loc.end.line &&
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
+ report( node, prevToken, tokenAfter );
+ }
+ }
+ }
+ }
+
+ if (
+ node.type === 'ArrayExpression' &&
+ node.elements.length > 0
+ ) {
+ elem = node.elements[ node.elements.length - 1 ];
+ if (
+ elem.type === 'ObjectExpression' &&
+ elem.properties.length > 0
+ ) {
+ prevToken = source.getLastToken( elem );
+ tokenAfter = source.getTokenAfter( prevToken );
+ if (
+ prevToken.loc.end.line === tokenAfter.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
+ report( node, prevToken, tokenAfter );
+ }
+ }
+ }
+ }
+ return {
+ 'CallExpression': validate,
+ 'ArrayExpression': validate
+ };
+}
+
+
+// MAIN //
+
+rule = {
+ 'meta': {
+ 'type': 'layout',
+ 'docs': {
+ 'description': 'disallow spaces between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line'
+ },
+ 'schema': [],
+ 'fixable': 'whitespace'
+ },
+ 'create': main
+};
+
+
+// EXPORTS //
+
+module.exports = rule;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/package.json b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/package.json
new file mode 100644
index 000000000000..95deaaa40c21
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "@stdlib/_tools/eslint/rules/line-closing-bracket-spacing",
+ "version": "0.0.0",
+ "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.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "bin": {},
+ "main": "./lib",
+ "directories": {
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "tools",
+ "tool",
+ "eslint",
+ "lint",
+ "custom",
+ "rules",
+ "rule",
+ "array",
+ "object",
+ "plugin",
+ "whitespace"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/invalid.js
new file mode 100644
index 000000000000..2675a13bd9a1
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/invalid.js
@@ -0,0 +1,230 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var valid = [];
+var test;
+
+test = {
+ 'code': [
+ 'var arr = [{',
+ ' key1: "value1",',
+ ' key2: "value2"',
+ '} ];'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'var arr = [{',
+ ' key1: "value1",',
+ ' key2: "value2"',
+ '}];'
+ ].join( '\n' )
+};
+valid.push( test );
+
+test = {
+ 'code': [
+ 'function sum( x ) {',
+ ' var sum = 0;',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' sum += x[ i ];',
+ ' }',
+ ' return sum;',
+ '}',
+ 'var arrSum = sum([',
+ ' 1,',
+ ' 2,',
+ ' 3,',
+ ' 4',
+ '] );'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'function sum( x ) {',
+ ' var sum = 0;',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' sum += x[ i ];',
+ ' }',
+ ' return sum;',
+ '}',
+ 'var arrSum = sum([',
+ ' 1,',
+ ' 2,',
+ ' 3,',
+ ' 4',
+ ']);'
+ ].join( '\n' )
+};
+valid.push( test );
+
+test = {
+ 'code': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '}] );'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '}]);'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '} ]);'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '}]);'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '} ] );'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }, {
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '}]);'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ 'console.log([',
+ ' Math.random(),',
+ ' Math.random()',
+ '] );',
+ '/* e.g., =>',
+ ' [',
+ ' 0.2580887012988746,',
+ ' 0.128454513229588',
+ ' ]',
+ '*/'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'console.log([',
+ ' Math.random(),',
+ ' Math.random()',
+ ']);',
+ '/* e.g., =>',
+ ' [',
+ ' 0.2580887012988746,',
+ ' 0.128454513229588',
+ ' ]',
+ '*/'
+ ].join( '\n' )
+};
+valid.push( test );
+
+test = {
+ 'code': [
+ 'console.log({',
+ ' a: Math.random(),',
+ ' b: Math.random()',
+ '} );'
+ ].join( '\n' ),
+ 'errors': [{
+ 'message': 'No spaces allowed between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line',
+ 'type': null
+ }],
+ 'output': [
+ 'console.log({',
+ ' a: Math.random(),',
+ ' b: Math.random()',
+ '});'
+ ].join( '\n' )
+};
+valid.push( test );
+
+
+// EXPORTS //
+
+module.exports = valid;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/unvalidated.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/unvalidated.js
new file mode 100644
index 000000000000..1661199904a5
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/unvalidated.js
@@ -0,0 +1,106 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var valid = [];
+var test;
+
+test = {
+ 'code': [
+ 'function sum( x ) {',
+ ' var sum = 0;',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' sum += x[ i ];',
+ ' }',
+ ' return sum;',
+ '}',
+ 'var arrSum = sum( [ 1, 2, 3, 4 ] );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log( {} );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ 'var arr = [ 1, 2, 3, 4, {} ];'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log(',
+ ' {',
+ ' \'a\': 1',
+ ' }',
+ ' );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log(',
+ ' [',
+ ' 1,',
+ ' 2',
+ ' ]',
+ ' );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log(',
+ ' [',
+ ' {',
+ ' \'a\': 1',
+ ' }',
+ ' ]',
+ ' );'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ ' var arr = [',
+ ' {',
+ ' \'a\': 1',
+ ' }',
+ '];'
+ ].join( '\n' )
+};
+valid.push( test);
+
+
+// EXPORTS //
+
+module.exports = valid;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/valid.js
new file mode 100644
index 000000000000..761141fd2b28
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/fixtures/valid.js
@@ -0,0 +1,97 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var valid = [];
+var test;
+
+test = {
+ 'code': [
+ 'var arr = [{',
+ ' key1: "value1",',
+ ' key2: "value2"',
+ '}];'
+ ].join( '\n' )
+};
+valid.push( test );
+
+test = {
+ 'code': [
+ 'function sum( x ) {',
+ ' var sum = 0;',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' sum += x[ i ];',
+ ' }',
+ ' return sum;',
+ '}',
+ 'var arrSum = sum([',
+ ' 1,',
+ ' 2,',
+ ' 3,',
+ ' 4',
+ ']);'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ 'function log( x ) {',
+ ' for ( var i = 0; i < x.length; i++ ) {',
+ ' console.log( x[ i ] );',
+ ' }',
+ '}',
+ 'log([{',
+ ' a: 1,',
+ ' b: 2',
+ '}]);'
+ ].join( '\n' )
+};
+valid.push( test);
+
+test = {
+ 'code': [
+ 'console.log([',
+ ' Math.random(),',
+ ' Math.random()',
+ ']);',
+ '/* e.g., =>',
+ ' [',
+ ' 0.2580887012988746,',
+ ' 0.128454513229588',
+ ' ]',
+ '*/'
+ ].join( '\n' )
+};
+valid.push( test );
+
+test = {
+ 'code': [
+ 'console.log({',
+ ' a: Math.random(),',
+ ' b: Math.random()',
+ '});'
+ ].join( '\n' )
+};
+valid.push( test );
+
+
+// EXPORTS //
+
+module.exports = valid;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/test.js
new file mode 100644
index 000000000000..8211342fc34f
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/line-closing-bracket-spacing/test/test.js
@@ -0,0 +1,86 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var RuleTester = require( 'eslint' ).RuleTester;
+var rule = require( './../lib' );
+
+
+// FIXTURES //
+
+var valid = require( './fixtures/valid.js' );
+var invalid = require( './fixtures/invalid.js' );
+var unvalidated = require( './fixtures/unvalidated.js' );
+
+
+// TESTS //
+
+tape( 'main export is an object', function test( t ) {
+ t.ok( true, __filename );
+ t.equal( typeof rule, 'object', 'main export is an object' );
+ t.end();
+});
+
+tape( 'the function positively validates code where no spaces are present between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line', function test( t ) {
+ var tester = new RuleTester();
+
+ try {
+ tester.run( 'line-closing-bracket-spacing', rule, {
+ 'valid': valid,
+ 'invalid': []
+ });
+ t.pass( 'passed without errors' );
+ } catch ( err ) {
+ t.fail( 'encountered an error: ' + err.message );
+ }
+ t.end();
+});
+
+tape( 'the function negatively validates code where spaces are present between a closing parenthesis or bracket and a nested object or array expression at the beginning of a line', function test( t ) {
+ var tester = new RuleTester();
+
+ try {
+ tester.run( 'line-closing-bracket-spacing', rule, {
+ 'valid': [],
+ 'invalid': invalid
+ });
+ t.pass( 'passed without errors' );
+ } catch ( err ) {
+ t.fail( 'encountered an error: ' + err.message );
+ }
+ t.end();
+});
+
+tape( 'the function does not validate non-object or non-array or inline array expressions', function test( t ) {
+ var tester = new RuleTester();
+
+ try {
+ tester.run( 'line-closing-bracket-spacing', rule, {
+ 'valid': unvalidated,
+ 'invalid': []
+ });
+ t.pass( 'passed without errors' );
+ } catch ( err ) {
+ t.fail( 'encountered an error: ' + err.message );
+ }
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/examples/fixtures/math_markup.txt b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/examples/fixtures/math_markup.txt
new file mode 100644
index 000000000000..e635e534455b
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/examples/fixtures/math_markup.txt
@@ -0,0 +1,22 @@
+# Absolute Value
+
+
+
+The absolute value is defined as
+
+
+
+```math
+|x| = \begin{cases} x & \textrm{if}\ x \geq 0 \\ -x & \textrm{if}\ x < 0\end{cases}
+```
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/examples/math_markup.js b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/examples/math_markup.js
new file mode 100644
index 000000000000..137d2aeda7bc
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/examples/math_markup.js
@@ -0,0 +1,42 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var readFileSync = require( 'fs' ).readFileSync;
+var join = require( 'path' ).join;
+var remark = require( 'remark' );
+var insertEquations = require( './../lib' );
+
+// Load a Markdown file...
+var fpath = join( __dirname, 'fixtures/math_markup.txt' );
+var opts = {
+ 'encoding': 'utf8'
+};
+var file = readFileSync( fpath, opts );
+
+// Insert equations:
+remark().use( insertEquations ).process( file, done );
+
+function done( error, out ) {
+ if ( error ) {
+ throw error;
+ }
+ // Output the processed Markdown file:
+ console.log( out.contents );
+}
diff --git a/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/lib/transformer.js b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/lib/transformer.js
index a6c369363f04..a59854994fef 100644
--- a/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/lib/transformer.js
+++ b/lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations/lib/transformer.js
@@ -203,7 +203,7 @@ function transformer( tree, file, clbk ) {
// Note: we don't splice--we simply replace--in order to avoid invalidating the indices of the equation elements in the AST. If we were to remove children, a subsequent resolved equation index would no longer be accurate...
parent.children[ i+1 ] = newNode;
- parent.children[ i+1 ] = {
+ parent.children[ i+2 ] = {
'type': 'html',
'value': ''
};