From 65350799b53853ba976b107ea4313a85873e6ce4 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 13 Dec 2025 16:15:11 -0600 Subject: [PATCH 1/3] build: add ESLint rule disallowing string concatenation in benchmark descriptions --- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- etc/eslint/.eslintrc.benchmarks.js | 7 + .../@stdlib/_tools/eslint/rules/lib/index.js | 9 ++ .../rules/no-bench-string-concat/README.md | 128 ++++++++++++++++++ .../no-bench-string-concat/examples/index.js | 51 +++++++ .../rules/no-bench-string-concat/lib/index.js | 39 ++++++ .../rules/no-bench-string-concat/lib/main.js | 116 ++++++++++++++++ .../rules/no-bench-string-concat/package.json | 65 +++++++++ .../test/fixtures/invalid.js | 74 ++++++++++ .../test/fixtures/valid.js | 56 ++++++++ .../rules/no-bench-string-concat/test/test.js | 70 ++++++++++ 10 files changed, 615 insertions(+) create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/index.js create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/main.js create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/package.json create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/invalid.js create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/valid.js create mode 100644 lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/test.js diff --git a/etc/eslint/.eslintrc.benchmarks.js b/etc/eslint/.eslintrc.benchmarks.js index 4edfff7d67aa..713fed264ecc 100644 --- a/etc/eslint/.eslintrc.benchmarks.js +++ b/etc/eslint/.eslintrc.benchmarks.js @@ -126,6 +126,13 @@ eslint.rules[ 'stdlib/jsdoc-doctest' ] = 'off'; */ eslint.rules[ 'stdlib/no-unnecessary-nested-functions' ] = 'off'; +/** +* Warn when using string concatenation in benchmark descriptions. +* +* @private +*/ +eslint.rules[ 'stdlib/no-bench-string-concat' ] = 'warn'; + // 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 817b943efba0..923ac122076a 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/lib/index.js @@ -837,6 +837,15 @@ setReadOnly( rules, 'new-cap-error', require( '@stdlib/_tools/eslint/rules/new-c */ setReadOnly( rules, 'new-cap-regexp', require( '@stdlib/_tools/eslint/rules/new-cap-regexp' ) ); +/** +* @name no-bench-string-concat +* @memberof rules +* @readonly +* @type {Function} +* @see {@link module:@stdlib/_tools/eslint/rules/no-bench-string-concat} +*/ +setReadOnly( rules, 'no-bench-string-concat', require( '@stdlib/_tools/eslint/rules/no-bench-string-concat' ) ); + /** * @name no-builtin-big-int * @memberof rules diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md new file mode 100644 index 000000000000..109bbd91fafc --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md @@ -0,0 +1,128 @@ + + +# no-bench-string-concat + +> [ESLint rule][eslint-rules] enforcing that `@stdlib/string/format` is used instead of string concatenation in benchmark descriptions. + +
+ +
+ + + +
+ +## Usage + +```javascript +var rule = require( '@stdlib/_tools/eslint/rules/no-bench-string-concat' ); +``` + +#### rule + +[ESLint rule][eslint-rules] enforcing that `@stdlib/string/format` is used instead of string concatenation in benchmark descriptions. + +**Bad**: + + + +```javascript +bench( pkg+':len='+len, function benchmark( b ) { + // ... +}); +``` + +**Good**: + + + +```javascript +var format = require( '@stdlib/string/format' ); + +bench( format( '%s:len=%d', pkg, len ), function benchmark( b ) { + // ... +}); +``` + +
+ + + +
+ +## Examples + + + +```javascript +var Linter = require( 'eslint' ).Linter; +var rule = require( '@stdlib/_tools/eslint/rules/no-bench-string-concat' ); + +var linter = new Linter(); +var result; +var code; + +code = 'bench( pkg+\':len=\'+len, f );'; + +linter.defineRule( 'no-bench-string-concat', rule ); + +result = linter.verify( code, { + 'rules': { + 'no-bench-string-concat': 'error' + } +}); +/* returns + [ + { + 'ruleId': 'no-bench-string-concat', + 'severity': 2, + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.', + 'line': 1, + 'column': 8, + 'nodeType': 'BinaryExpression', + 'endLine': 1, + 'endColumn': 23 + } + ] +*/ +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js new file mode 100644 index 000000000000..75b366ea2a71 --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js @@ -0,0 +1,51 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 = 'bench( pkg+\':len=\'+len, f );'; + +linter.defineRule( 'no-bench-string-concat', rule ); + +result = linter.verify( code, { + 'rules': { + 'no-bench-string-concat': 'error' + } +}); +console.log( result ); +/* => + [ + { + 'ruleId': 'no-bench-string-concat', + 'severity': 2, + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.', + 'line': 1, + 'column': 8, + 'nodeType': 'BinaryExpression', + 'endLine': 1, + 'endColumn': 23 + } + ] +*/ diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/index.js new file mode 100644 index 000000000000..5617f2db3075 --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 enforcing that string concatenation is not used in benchmark descriptions. +* +* @module @stdlib/_tools/eslint/rules/no-bench-string-concat +* +* @example +* var rule = require( '@stdlib/_tools/eslint/rules/no-bench-string-concat' ); +* +* console.log( rule ); +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/main.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/main.js new file mode 100644 index 000000000000..70407031495e --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/lib/main.js @@ -0,0 +1,116 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 // + +/** +* Checks whether a node is a BinaryExpression with a '+' operator. +* +* @private +* @param {ASTNode} node - AST node +* @returns {boolean} boolean indicating whether the node is a string concatenation +*/ +function isStringConcatenation( node ) { + if ( node.type !== 'BinaryExpression' ) { + return false; + } + if ( node.operator !== '+' ) { + return false; + } + return true; +} + +/** +* Rule for validating that `@stdlib/string/format` is used instead of string concatenation in benchmark descriptions. +* +* @param {Object} context - ESLint context +* @returns {Object} validators +*/ +function main( context ) { + /** + * Reports the error message. + * + * @private + * @param {ASTNode} node - node to report + */ + function report( node ) { + context.report({ + 'node': node, + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.' + }); + } + + /** + * Checks whether a `bench()` call uses string concatenation in its first argument. + * + * @private + * @param {ASTNode} node - CallExpression node to examine + */ + function validate( node ) { + var firstArg; + var callee; + + callee = node.callee; + + // Check if this is a call to `bench`: + if ( callee.type !== 'Identifier' || callee.name !== 'bench' ) { + return; + } + + // Check if there is at least one argument: + if ( node.arguments.length === 0 ) { + return; + } + + firstArg = node.arguments[ 0 ]; + + // Check if the first argument is string concatenation: + if ( isStringConcatenation( firstArg ) ) { + report( firstArg ); + } + } + + return { + 'CallExpression': validate + }; +} + + +// MAIN // + +rule = { + 'meta': { + 'docs': { + 'description': 'enforce that `@stdlib/string/format` is used instead of string concatenation in benchmark descriptions' + }, + 'schema': [] + }, + 'create': main +}; + + +// EXPORTS // + +module.exports = rule; diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/package.json b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/package.json new file mode 100644 index 000000000000..fb7a4f955dcc --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/_tools/eslint/rules/no-bench-string-concat", + "version": "0.0.0", + "description": "ESLint rule enforcing that `@stdlib/string/format` is used instead of string concatenation in benchmark descriptions.", + "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", + "plugin", + "benchmark", + "bench", + "string", + "concatenation", + "format" + ] +} diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/invalid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/invalid.js new file mode 100644 index 000000000000..5e7fe88ee79d --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/invalid.js @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 invalid = []; + +// Simple string concatenation: +var test = { + 'code': 'bench( pkg+\':len=\'+len, f );', + 'errors': [ + { + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.', + 'type': 'BinaryExpression' + } + ] +}; +invalid.push( test ); + +// String concatenation with dtype: +test = { + 'code': 'bench( pkg+\':dtype=\'+options.dtype+\',len=\'+len, f );', + 'errors': [ + { + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.', + 'type': 'BinaryExpression' + } + ] +}; +invalid.push( test ); + +// String concatenation with spaces: +test = { + 'code': 'bench( pkg + \':len=\' + len, f );', + 'errors': [ + { + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.', + 'type': 'BinaryExpression' + } + ] +}; +invalid.push( test ); + +// String concatenation with inline suffix: +test = { + 'code': 'bench( pkg+\'::inline\', f );', + 'errors': [ + { + 'message': 'Use `@stdlib/string/format` instead of string concatenation for benchmark descriptions.', + 'type': 'BinaryExpression' + } + ] +}; +invalid.push( test ); + + +// EXPORTS // + +module.exports = invalid; diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/valid.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/valid.js new file mode 100644 index 000000000000..cf3061a591bd --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/fixtures/valid.js @@ -0,0 +1,56 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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 = []; + +// Using format function: +var test = { + 'code': 'bench( format( \'%s:len=%d\', pkg, len ), f );' +}; +valid.push( test ); + +// Using just pkg variable: +test = { + 'code': 'bench( pkg, f );' +}; +valid.push( test ); + +// Using a string literal: +test = { + 'code': 'bench( \'my-benchmark\', f );' +}; +valid.push( test ); + +// String concatenation in other function calls (not bench): +test = { + 'code': 'console.log( pkg + \':len=\' + len );' +}; +valid.push( test ); + +// Format with multiple parameters: +test = { + 'code': 'bench( format( \'%s:dtype=%s,len=%d\', pkg, dtype, len ), f );' +}; +valid.push( test ); + + +// EXPORTS // + +module.exports = valid; diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/test.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/test.js new file mode 100644 index 000000000000..7c4dc28dc5b8 --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/test/test.js @@ -0,0 +1,70 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 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' ); + + +// TESTS // + +tape( 'main export is an object', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof rule, 'object', 'main export is an object' ); + t.end(); +}); + +tape( 'the rule positively validates code using `format` instead of string concatenation in benchmark descriptions', function test( t ) { + var tester = new RuleTester(); + + try { + tester.run( 'no-bench-string-concat', rule, { + 'valid': valid, + 'invalid': [] + }); + t.pass( 'passed without errors' ); + } catch ( err ) { + t.fail( 'encountered an error: ' + err.message ); + } + t.end(); +}); + +tape( 'the rule negatively validates code using string concatenation instead of `format` in benchmark descriptions', function test( t ) { + var tester = new RuleTester(); + + try { + tester.run( 'no-bench-string-concat', rule, { + 'valid': [], + 'invalid': invalid + }); + t.pass( 'passed without errors' ); + } catch ( err ) { + t.fail( 'encountered an error: ' + err.message ); + } + t.end(); +}); From 49bd663376003f7f208b604095edaa0967c2ac12 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Sat, 13 Dec 2025 16:30:10 -0600 Subject: [PATCH 2/3] chore: add run-disable directives to `no-bench-string-concat` README examples --- 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: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- .../_tools/eslint/rules/no-bench-string-concat/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md index 109bbd91fafc..ec5a69ada04d 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md @@ -42,6 +42,8 @@ var rule = require( '@stdlib/_tools/eslint/rules/no-bench-string-concat' ); **Bad**: + + ```javascript @@ -52,6 +54,8 @@ bench( pkg+':len='+len, function benchmark( b ) { **Good**: + + ```javascript From 4a362fe104054dc65e88b03e6280fc27d2e19dc8 Mon Sep 17 00:00:00 2001 From: Athan Date: Mon, 15 Dec 2025 18:50:40 -0800 Subject: [PATCH 3/3] Apply suggestions from code review Signed-off-by: Athan --- .../_tools/eslint/rules/no-bench-string-concat/README.md | 8 ++------ .../eslint/rules/no-bench-string-concat/examples/index.js | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md index ec5a69ada04d..3463fb4ef644 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/README.md @@ -81,14 +81,10 @@ var Linter = require( 'eslint' ).Linter; var rule = require( '@stdlib/_tools/eslint/rules/no-bench-string-concat' ); var linter = new Linter(); -var result; -var code; - -code = 'bench( pkg+\':len=\'+len, f );'; - linter.defineRule( 'no-bench-string-concat', rule ); -result = linter.verify( code, { +var code = 'bench( pkg+\':len=\'+len, f );'; +var result = linter.verify( code, { 'rules': { 'no-bench-string-concat': 'error' } diff --git a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js index 75b366ea2a71..bbe984d16302 100644 --- a/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js +++ b/lib/node_modules/@stdlib/_tools/eslint/rules/no-bench-string-concat/examples/index.js @@ -22,14 +22,10 @@ var Linter = require( 'eslint' ).Linter; var rule = require( './../lib' ); var linter = new Linter(); -var result; -var code; - -code = 'bench( pkg+\':len=\'+len, f );'; - linter.defineRule( 'no-bench-string-concat', rule ); -result = linter.verify( code, { +var code = 'bench( pkg+\':len=\'+len, f );'; +var result = linter.verify( code, { 'rules': { 'no-bench-string-concat': 'error' }