From 1a59a00a75c9936265c5726d6bd17c3cb858d2ba Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 23 May 2026 14:19:24 +0000 Subject: [PATCH] fix(@stdlib/plot/components/svg): replace `new Array()` with array literal in `defs`, `background`, and `path` The `lint_random_files` workflow on `develop` fails with `stdlib/no-new-array` violations in these three SVG component files. The `onRender()` callback in each pre-allocates `args = new Array( arguments.length+1 )`, sets `args[0] = 'render'`, and fills indices 1..N by position before passing to `self.emit.apply( self, args )`. The pattern is semantically correct but violates the project `no-new-array` rule, which is set to `error`. Replace with an array literal `[ 'render' ]` pre-seeded with the event name, then append forwarded arguments via `push()`. Both approaches produce the same dense array `['render', ...forwardedArgs]` for all values of `arguments.length`, including zero. The `emit.apply` call contract is unchanged. This follows the identical fix applied to the sibling `canvas` component in PR #12244, which explicitly left these three files as a follow-up. The `clip-path` and `marks` siblings do not require changes (they already use the corrected pattern or do not have the violation). Ref: https://github.com/stdlib-js/stdlib/actions/runs/26260926243 --- .../@stdlib/plot/components/svg/background/lib/main.js | 5 ++--- .../@stdlib/plot/components/svg/defs/lib/main.js | 5 ++--- .../@stdlib/plot/components/svg/path/lib/main.js | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js index 4f9050b878f3..47ffcc4ebc0b 100644 --- a/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js +++ b/lib/node_modules/@stdlib/plot/components/svg/background/lib/main.js @@ -121,10 +121,9 @@ function Background( options ) { var args; var i; debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; + args = [ 'render' ]; for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; + args.push( arguments[ i ] ); } self.emit.apply( self, args ); } diff --git a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js index 0d2917570fe1..a1631bdacf9c 100644 --- a/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js +++ b/lib/node_modules/@stdlib/plot/components/svg/defs/lib/main.js @@ -76,10 +76,9 @@ function Defs() { var args; var i; debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; + args = [ 'render' ]; for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; + args.push( arguments[ i ] ); } self.emit.apply( self, args ); } diff --git a/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js b/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js index d2eaa36951cb..3b58bf1677a6 100644 --- a/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js +++ b/lib/node_modules/@stdlib/plot/components/svg/path/lib/main.js @@ -176,10 +176,9 @@ function Path( options ) { var args; var i; debug( 'Received a render event. Re-emitting...' ); - args = new Array( arguments.length+1 ); - args[ 0 ] = 'render'; + args = [ 'render' ]; for ( i = 0; i < arguments.length; i++ ) { - args[ i+1 ] = arguments[ i ]; + args.push( arguments[ i ] ); } self.emit.apply( self, args ); }