From 0be7638141e036ee76c23e6ee1ede43a5ad26d5c Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Thu, 19 Dec 2024 15:47:50 +0000
Subject: [PATCH 1/7] feat: add eslint/rules/eol-open-bracket-spacing
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
- task: run_javascript_examples
status: passed
- task: run_c_examples
status: na
- task: run_cpp_examples
status: na
- task: run_javascript_readme_examples
status: passed
- task: run_c_benchmarks
status: na
- task: run_cpp_benchmarks
status: na
- task: run_fortran_benchmarks
status: na
- task: run_javascript_benchmarks
status: na
- task: run_julia_benchmarks
status: na
- task: run_python_benchmarks
status: na
- task: run_r_benchmarks
status: na
- task: run_javascript_tests
status: na
---
---
etc/eslint/rules/stdlib.js | 46 ++++
.../rules/eol-open-bracket-spacing/README.md | 165 +++++++++++++
.../examples/index.js | 68 ++++++
.../eol-open-bracket-spacing/lib/index.js | 39 +++
.../eol-open-bracket-spacing/lib/main.js | 158 ++++++++++++
.../eol-open-bracket-spacing/package.json | 63 +++++
.../test/fixtures/invalid.js | 230 ++++++++++++++++++
.../test/fixtures/unvalidated.js | 41 ++++
.../test/fixtures/valid.js | 97 ++++++++
.../eol-open-bracket-spacing/test/test.js | 86 +++++++
.../@stdlib/_tools/eslint/rules/lib/index.js | 9 +
11 files changed, 1002 insertions(+)
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/invalid.js
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/valid.js
create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
diff --git a/etc/eslint/rules/stdlib.js b/etc/eslint/rules/stdlib.js
index 5304d3895a5c..3e39be9e6d60 100644
--- a/etc/eslint/rules/stdlib.js
+++ b/etc/eslint/rules/stdlib.js
@@ -200,6 +200,52 @@ rules[ 'stdlib/doctest-quote-props' ] = 'error';
*/
rules[ 'stdlib/empty-line-before-comment' ] = 'error';
+/**
+* No spaces allowed between an opening parenthesis or bracket and a nested object or array expression.
+*
+* @name eol-open-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/eol-open-bracket-spacing' ] = 'error';
+
/**
* Require blockquotes to have `2` character indentation.
*
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
new file mode 100644
index 000000000000..6c3d4339a7ec
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
@@ -0,0 +1,165 @@
+
+
+# eol-open-bracket-spacing
+
+> [ESLint rule][eslint-rules] to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var rule = require( '@stdlib/_tools/eslint/rules/eol-open-bracket-spacing' );
+```
+
+#### rule
+
+[ESLint rule][eslint-rules] to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.
+
+**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/eol-open-bracket-spacing' );
+
+var linter = new Linter();
+var result;
+var code;
+
+code = [
+ 'function test() {',
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log( {',
+ ' "key": "value"',
+ ' });',
+ ' var arr = [ {',
+ ' "nested": true',
+ ' }];',
+ ' log( arr );',
+ '}'
+].join( '\n' );
+
+linter.defineRule( 'eol-open-bracket-spacing', rule );
+
+result = linter.verify( code, {
+ 'rules': {
+ 'eol-open-bracket-spacing': 'error'
+ }
+});
+/* returns
+ [
+ {
+ 'ruleId': 'eol-open-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'line': 3,
+ 'column': 3,
+ 'nodeType': 'CallExpression'
+ },
+ {
+ 'ruleId': 'eol-open-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ '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/eol-open-bracket-spacing/examples/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
new file mode 100644
index 000000000000..bee7455ed098
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
@@ -0,0 +1,68 @@
+/**
+* @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 result;
+var code;
+
+code = [
+ 'function test() {',
+ ' var log = require( \'@stdlib/console/log\' );',
+ ' log( {',
+ ' "key": "value"',
+ ' });',
+ ' var arr = [ {',
+ ' "nested": true',
+ ' }];',
+ ' log( arr );',
+ '}'
+].join( '\n' );
+
+linter.defineRule( 'eol-open-bracket-spacing', rule );
+
+result = linter.verify( code, {
+ 'rules': {
+ 'eol-open-bracket-spacing': 'error'
+ }
+});
+console.log( result );
+/* =>
+ [
+ {
+ 'ruleId': 'eol-open-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'line': 3,
+ 'column': 3,
+ 'nodeType': 'CallExpression'
+ },
+ {
+ 'ruleId': 'eol-open-bracket-spacing',
+ 'severity': 2,
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'line': 6,
+ 'column': 13,
+ 'nodeType': 'ArrayExpression'
+ }
+ ]
+*/
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js
new file mode 100644
index 000000000000..498a4635bcb7
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-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 an opening parenthesis or bracket and a nested object or array expression.
+*
+* @module @stdlib/_tools/eslint/rules/eol-open-bracket-spacing
+*
+* @example
+* var rule = require( '@stdlib/_tools/eslint/rules/eol-open-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/eol-open-bracket-spacing/lib/main.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js
new file mode 100644
index 000000000000..ee11db4cec78
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/main.js
@@ -0,0 +1,158 @@
+/**
+* @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 an opening parenthesis or bracket and a nested object or array expression.
+*
+* @private
+* @param {Object} context - ESLint context
+* @returns {Object} validators
+*/
+function main( context ) {
+ var source;
+
+ source = context.getSourceCode();
+
+ /**
+ * Reports the error message.
+ *
+ * @private
+ * @param {ASTNode} node - node to report
+ * @param {Object} prevToken - token before the space
+ * @param {Object} tokenAfter - token after the space
+ */
+ function report( node, prevToken, tokenAfter ) {
+ context.report({
+ 'node': node,
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'fix': fix
+ });
+
+ /**
+ * Fixes lint the error by removing the space before the object or array literal.
+ *
+ * @private
+ * @param {Object} fixer - ESLint fixer
+ * @returns {Object} fix
+ */
+ function fix( fixer ) {
+ var afterIdx;
+ var prevIdx;
+
+ prevIdx = source.getIndexFromLoc( prevToken.loc.end );
+ afterIdx = source.getIndexFromLoc( tokenAfter.loc.start );
+ return fixer.replaceTextRange( [ prevIdx, afterIdx ], '' );
+ }
+ }
+
+ /**
+ * Checks whether there are spaces present between an opening parenthesis or bracket and a nested object or array expression.
+ *
+ * @private
+ * @param {ASTNode} node - node to examine
+ */
+ function validate( node ) {
+ var tokenAfter;
+ var nextToken;
+ var prevToken;
+ var elem;
+ var args;
+
+ if (
+ node.type === 'CallExpression' &&
+ node.arguments.length > 0
+ ) {
+ args = node.arguments;
+ if ( args[ 0 ].type === 'ObjectExpression' ) {
+ prevToken = source.getTokenBefore( args[ 0 ] );
+ tokenAfter = source.getFirstToken( args[ 0 ] );
+ if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
+ report( node, prevToken, tokenAfter );
+ }
+ } else if ( args[ 0 ].type === 'ArrayExpression' ) {
+ elem = args[ 0 ].elements[ 0 ];
+ if ( elem.type === 'ObjectExpression' ) {
+ prevToken = source.getTokenBefore( args[ 0 ] );
+ tokenAfter = source.getFirstToken( args[ 0 ] );
+ if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
+ report( node, prevToken, tokenAfter );
+ }
+ } else {
+ prevToken = source.getTokenBefore( args[ 0 ] );
+ tokenAfter = source.getFirstToken( args[ 0 ] );
+ nextToken = source.getTokenAfter( tokenAfter );
+ if (
+ tokenAfter.loc.end.line !== nextToken.loc.end.line &&
+ source.isSpaceBetween( prevToken, tokenAfter )
+ ) {
+ report( node, prevToken, tokenAfter );
+ }
+ }
+ }
+ }
+
+ if (
+ node.type === 'ArrayExpression' &&
+ node.elements.length > 0
+ ) {
+ elem = node.elements[ 0 ];
+ if ( elem.type === 'ObjectExpression' ) {
+ prevToken = source.getFirstToken( node );
+ tokenAfter = source.getFirstToken( elem );
+
+ if ( source.isSpaceBetween( prevToken, tokenAfter ) ) {
+ report( node, prevToken, tokenAfter );
+ }
+ }
+ }
+ }
+
+ return {
+ 'CallExpression': validate,
+ 'ArrayExpression': validate
+ };
+}
+
+
+// MAIN //
+
+rule = {
+ 'meta': {
+ 'type': 'layout',
+ 'docs': {
+ 'description': 'enforce no spaces between an opening parenthesis or bracket and a nested object or array expression'
+ },
+ 'schema': [],
+ 'fixable': 'whitespace'
+ },
+ 'create': main
+};
+
+
+// EXPORTS //
+
+module.exports = rule;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json
new file mode 100644
index 000000000000..fc3259809964
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json
@@ -0,0 +1,63 @@
+{
+ "name": "@stdlib/_tools/eslint/rules/eol-open-bracket-spacing",
+ "version": "0.0.0",
+ "description": "ESLint rule to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.",
+ "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/eol-open-bracket-spacing/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/invalid.js
new file mode 100644
index 000000000000..1384fd7ffb95
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-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 an opening parenthesis or bracket and a nested object or array expression',
+ '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 an opening parenthesis or bracket and a nested object or array expression',
+ '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 an opening parenthesis or bracket and a nested object or array expression',
+ '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 an opening parenthesis or bracket and a nested object or array expression',
+ '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 an opening parenthesis or bracket and a nested object or array expression',
+ 'type': null
+ }, {
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ '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 an opening parenthesis or bracket and a nested object or array expression',
+ '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 an opening parenthesis or bracket and a nested object or array expression',
+ '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/eol-open-bracket-spacing/test/fixtures/unvalidated.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js
new file mode 100644
index 000000000000..c6c33b1faa84
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/unvalidated.js
@@ -0,0 +1,41 @@
+/**
+* @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);
+
+
+// EXPORTS //
+
+module.exports = valid;
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/valid.js
new file mode 100644
index 000000000000..761141fd2b28
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-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/eol-open-bracket-spacing/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
new file mode 100644
index 000000000000..dc466de3140c
--- /dev/null
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-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 an opening parenthesis or bracket and a nested object or array expression', function test( t ) {
+ var tester = new RuleTester();
+
+ try {
+ tester.run( 'eol-open-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 an opening parenthesis or bracket and a nested object or array expression', function test( t ) {
+ var tester = new RuleTester();
+
+ try {
+ tester.run( 'eol-open-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( 'eol-open-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/eslint/rules/lib/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js
index 3a8df9a27024..221f82484546 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js
@@ -81,6 +81,15 @@ setReadOnly( rules, 'doctest-quote-props', require( '@stdlib/_tools/eslint/rules
*/
setReadOnly( rules, 'empty-line-before-comment', require( '@stdlib/_tools/eslint/rules/empty-line-before-comment' ) );
+/**
+* @name eol-open-bracket-spacing
+* @memberof rules
+* @readonly
+* @type {Function}
+* @see {@link module:@stdlib/_tools/eslint/rules/eol-open-bracket-spacing}
+*/
+setReadOnly( rules, 'eol-open-bracket-spacing', require( '@stdlib/_tools/eslint/rules/eol-open-bracket-spacing' ) );
+
/**
* @name first-unit-test
* @memberof rules
From 148a60bb01c2fdfce8801f50213942a13a4da7d6 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Sun, 22 Dec 2024 17:24:24 +0000
Subject: [PATCH 2/7] refactor: apply code review suggestions
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: na
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_push_report
description: Results of running various checks prior to pushing changes.
report:
- task: run_javascript_examples
status: passed
- task: run_c_examples
status: na
- task: run_cpp_examples
status: na
- task: run_javascript_readme_examples
status: passed
- task: run_c_benchmarks
status: na
- task: run_cpp_benchmarks
status: na
- task: run_fortran_benchmarks
status: na
- task: run_javascript_benchmarks
status: na
- task: run_julia_benchmarks
status: na
- task: run_python_benchmarks
status: na
- task: run_r_benchmarks
status: na
- task: run_javascript_tests
status: na
---
---
etc/eslint/rules/stdlib.js | 2 +-
.../rules/eol-open-bracket-spacing/README.md | 12 +++++-------
.../eol-open-bracket-spacing/examples/index.js | 4 ++--
.../rules/eol-open-bracket-spacing/lib/index.js | 2 +-
.../rules/eol-open-bracket-spacing/lib/main.js | 14 ++++++--------
.../test/fixtures/invalid.js | 16 ++++++++--------
6 files changed, 23 insertions(+), 27 deletions(-)
diff --git a/etc/eslint/rules/stdlib.js b/etc/eslint/rules/stdlib.js
index 3e39be9e6d60..0de07ac30f90 100644
--- a/etc/eslint/rules/stdlib.js
+++ b/etc/eslint/rules/stdlib.js
@@ -201,7 +201,7 @@ rules[ 'stdlib/doctest-quote-props' ] = 'error';
rules[ 'stdlib/empty-line-before-comment' ] = 'error';
/**
-* No spaces allowed between an opening parenthesis or bracket and a nested object or array expression.
+* Disallow spaces between an opening parenthesis or bracket and a nested object or array expression at the end of a line.
*
* @name eol-open-bracket-spacing
* @memberof rules
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
index 6c3d4339a7ec..def7deb3c431 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
@@ -20,7 +20,7 @@ limitations under the License.
# eol-open-bracket-spacing
-> [ESLint rule][eslint-rules] to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.
+> [ESLint rule][eslint-rules] 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.
@@ -97,10 +97,8 @@ var Linter = require( 'eslint' ).Linter;
var rule = require( '@stdlib/_tools/eslint/rules/eol-open-bracket-spacing' );
var linter = new Linter();
-var result;
-var code;
-code = [
+var code = [
'function test() {',
' var log = require( \'@stdlib/console/log\' );',
' log( {',
@@ -115,7 +113,7 @@ code = [
linter.defineRule( 'eol-open-bracket-spacing', rule );
-result = linter.verify( code, {
+var result = linter.verify( code, {
'rules': {
'eol-open-bracket-spacing': 'error'
}
@@ -125,7 +123,7 @@ result = linter.verify( code, {
{
'ruleId': 'eol-open-bracket-spacing',
'severity': 2,
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'line': 3,
'column': 3,
'nodeType': 'CallExpression'
@@ -133,7 +131,7 @@ result = linter.verify( code, {
{
'ruleId': 'eol-open-bracket-spacing',
'severity': 2,
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'line': 6,
'column': 13,
'nodeType': 'ArrayExpression'
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
index bee7455ed098..6f2a3593d2c5 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
@@ -51,7 +51,7 @@ console.log( result );
{
'ruleId': 'eol-open-bracket-spacing',
'severity': 2,
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'line': 3,
'column': 3,
'nodeType': 'CallExpression'
@@ -59,7 +59,7 @@ console.log( result );
{
'ruleId': 'eol-open-bracket-spacing',
'severity': 2,
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'line': 6,
'column': 13,
'nodeType': 'ArrayExpression'
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js
index 498a4635bcb7..2353d04e43c6 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/lib/index.js
@@ -19,7 +19,7 @@
'use strict';
/**
-* ESLint rule to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.
+* 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.
*
* @module @stdlib/_tools/eslint/rules/eol-open-bracket-spacing
*
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 ee11db4cec78..59474cccfef8 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
@@ -26,16 +26,14 @@ var rule;
// FUNCTIONS //
/**
-* Rule for validating that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.
+* Rule for validating that no spaces are present between an opening parenthesis or bracket and a nested object or array expression at the end of a line.
*
* @private
* @param {Object} context - ESLint context
* @returns {Object} validators
*/
function main( context ) {
- var source;
-
- source = context.getSourceCode();
+ var source = context.getSourceCode();
/**
* Reports the error message.
@@ -48,12 +46,12 @@ function main( context ) {
function report( node, prevToken, tokenAfter ) {
context.report({
'node': node,
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'fix': fix
});
/**
- * Fixes lint the error by removing the space before the object or array literal.
+ * Fixes lint the error by removing the space before the object or array expression.
*
* @private
* @param {Object} fixer - ESLint fixer
@@ -70,7 +68,7 @@ function main( context ) {
}
/**
- * Checks whether there are spaces present between an opening parenthesis or bracket and a nested object or array expression.
+ * Checks whether there are spaces present between an opening parenthesis or bracket and a nested object or array expression at the end of a line.
*
* @private
* @param {ASTNode} node - node to examine
@@ -144,7 +142,7 @@ rule = {
'meta': {
'type': 'layout',
'docs': {
- 'description': 'enforce no spaces between an opening parenthesis or bracket and a nested object or array expression'
+ 'description': 'disallow spaces between an opening parenthesis or bracket and a nested object or array expression at the end of a line'
},
'schema': [],
'fixable': 'whitespace'
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/invalid.js
index 1384fd7ffb95..30fe652a99aa 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/invalid.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/fixtures/invalid.js
@@ -29,7 +29,7 @@ test = {
'}];'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
@@ -58,7 +58,7 @@ test = {
']);'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
@@ -92,7 +92,7 @@ test = {
'}]);'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
@@ -122,7 +122,7 @@ test = {
'}]);'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
@@ -152,10 +152,10 @@ test = {
'}]);'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}, {
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
@@ -186,7 +186,7 @@ test = {
'*/'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
@@ -212,7 +212,7 @@ test = {
'});'
].join( '\n' ),
'errors': [{
- 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression',
+ 'message': 'No spaces allowed between an opening parenthesis or bracket and a nested object or array expression at the end of a line',
'type': null
}],
'output': [
From 93cc1f244afcdb03732a1cb4ca72c6af89afc2b0 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 23 Dec 2024 00:02:41 +0500
Subject: [PATCH 3/7] docs: apply review suggestion
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../_tools/eslint/rules/eol-open-bracket-spacing/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
index def7deb3c431..721f820dae72 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/README.md
@@ -38,7 +38,7 @@ var rule = require( '@stdlib/_tools/eslint/rules/eol-open-bracket-spacing' );
#### rule
-[ESLint rule][eslint-rules] to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.
+[ESLint rule][eslint-rules] 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.
**Bad**:
From b9b3e55ff60f783b65e8289021cfe8ed75b36b18 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 23 Dec 2024 00:02:50 +0500
Subject: [PATCH 4/7] docs: apply review suggestion
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../_tools/eslint/rules/eol-open-bracket-spacing/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json
index fc3259809964..4773e06bbbbd 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/package.json
@@ -1,7 +1,7 @@
{
"name": "@stdlib/_tools/eslint/rules/eol-open-bracket-spacing",
"version": "0.0.0",
- "description": "ESLint rule to enforce that no spaces are present between an opening parenthesis or bracket and a nested object or array expression.",
+ "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.",
"license": "Apache-2.0",
"author": {
"name": "The Stdlib Authors",
From c705c62450a5a7f6f21fb736cd5fe4c319bdf3a4 Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 23 Dec 2024 00:02:59 +0500
Subject: [PATCH 5/7] docs: apply review suggestion
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../_tools/eslint/rules/eol-open-bracket-spacing/test/test.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
index dc466de3140c..c7b900a48f24 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
@@ -40,7 +40,7 @@ tape( 'main export is an object', function test( t ) {
t.end();
});
-tape( 'the function positively validates code where no spaces are present between an opening parenthesis or bracket and a nested object or array expression', function test( t ) {
+tape( 'the function positively validates code where no spaces are present between an opening parenthesis or bracket and a nested object or array expression at the end of a line', function test( t ) {
var tester = new RuleTester();
try {
From 92cea3cf25619f5378931f8e028f4743225bd08d Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 23 Dec 2024 00:03:09 +0500
Subject: [PATCH 6/7] docs: apply review suggestion
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../_tools/eslint/rules/eol-open-bracket-spacing/test/test.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
index c7b900a48f24..43153651efa8 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/test/test.js
@@ -55,7 +55,7 @@ tape( 'the function positively validates code where no spaces are present betwee
t.end();
});
-tape( 'the function negatively validates code where spaces are present between an opening parenthesis or bracket and a nested object or array expression', function test( t ) {
+tape( 'the function negatively validates code where spaces are present between an opening parenthesis or bracket and a nested object or array expression at the end of a line', function test( t ) {
var tester = new RuleTester();
try {
From c32193bcc2c889a0db23ba178d28fcc4ce334cbe Mon Sep 17 00:00:00 2001
From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
Date: Mon, 23 Dec 2024 00:11:03 +0500
Subject: [PATCH 7/7] refactor: apply review suggestion
Signed-off-by: Muhammad Haris <101793258+headlessNode@users.noreply.github.com>
---
.../eslint/rules/eol-open-bracket-spacing/examples/index.js | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
index 6f2a3593d2c5..9645f73f936d 100644
--- a/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
+++ b/lib/node_modules/@stdlib/_tools/eslint/rules/eol-open-bracket-spacing/examples/index.js
@@ -22,10 +22,8 @@ var Linter = require( 'eslint' ).Linter;
var rule = require( './../lib' );
var linter = new Linter();
-var result;
-var code;
-code = [
+var code = [
'function test() {',
' var log = require( \'@stdlib/console/log\' );',
' log( {',
@@ -40,7 +38,7 @@ code = [
linter.defineRule( 'eol-open-bracket-spacing', rule );
-result = linter.verify( code, {
+var result = linter.verify( code, {
'rules': {
'eol-open-bracket-spacing': 'error'
}