Skip to content

Commit

Permalink
Eslint: remove old .apply syntax (mrdoob#30513)
Browse files Browse the repository at this point in the history
Co-authored-by: Samuel Rigaud <[email protected]>
  • Loading branch information
s-rigaud and Samuel Rigaud authored Feb 15, 2025
1 parent 1805ecd commit d264b7c
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"no-duplicate-imports": [
"error"
],
"prefer-spread": "error",
"valid-jsdoc": [
"error",
{
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3971,7 +3971,7 @@ class ColladaLoader extends Loader {
} else {

result += '\n';
stack.push.apply( stack, node.childNodes );
stack.push( ...node.childNodes );

}

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometry_text_shapes.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

}

shapes.push.apply( shapes, holeShapes );
shapes.push( ...holeShapes );

const lineText = new THREE.Object3D();

Expand Down
2 changes: 1 addition & 1 deletion examples/webgl_geometry_text_stroke.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

}

shapes.push.apply( shapes, holeShapes );
shapes.push( ...holeShapes );

const style = SVGLoader.getStrokeStyle( 5, color.getStyle() );

Expand Down
2 changes: 1 addition & 1 deletion src/animation/AnimationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function flattenJSON( jsonKeys, times, values, valuePropertyName ) {
if ( value !== undefined ) {

times.push( key.time );
values.push.apply( values, value ); // push all elements
values.push( ...value ); // push all elements

}

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/SkeletonHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function getBoneList( object ) {

for ( let i = 0; i < object.children.length; i ++ ) {

boneList.push.apply( boneList, getBoneList( object.children[ i ] ) );
boneList.push( ...getBoneList( object.children[ i ] ) );

}

Expand Down
4 changes: 2 additions & 2 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ class WebGLRenderer {

this.setClearColor = function () {

background.setClearColor.apply( background, arguments );
background.setClearColor( ...arguments );

};

Expand All @@ -534,7 +534,7 @@ class WebGLRenderer {

this.setClearAlpha = function () {

background.setClearAlpha.apply( background, arguments );
background.setClearAlpha( ...arguments );

};

Expand Down
20 changes: 10 additions & 10 deletions src/renderers/webgl/WebGLState.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ function WebGLState( gl, extensions ) {

try {

gl.compressedTexImage2D.apply( gl, arguments );
gl.compressedTexImage2D( ...arguments );

} catch ( error ) {

Expand All @@ -994,7 +994,7 @@ function WebGLState( gl, extensions ) {

try {

gl.compressedTexImage3D.apply( gl, arguments );
gl.compressedTexImage3D( ...arguments );

} catch ( error ) {

Expand All @@ -1008,7 +1008,7 @@ function WebGLState( gl, extensions ) {

try {

gl.texSubImage2D.apply( gl, arguments );
gl.texSubImage2D( ...arguments );

} catch ( error ) {

Expand All @@ -1022,7 +1022,7 @@ function WebGLState( gl, extensions ) {

try {

gl.texSubImage3D.apply( gl, arguments );
gl.texSubImage3D( ...arguments );

} catch ( error ) {

Expand All @@ -1036,7 +1036,7 @@ function WebGLState( gl, extensions ) {

try {

gl.compressedTexSubImage2D.apply( gl, arguments );
gl.compressedTexSubImage2D( ...arguments );

} catch ( error ) {

Expand All @@ -1050,7 +1050,7 @@ function WebGLState( gl, extensions ) {

try {

gl.compressedTexSubImage3D.apply( gl, arguments );
gl.compressedTexSubImage3D( ...arguments );

} catch ( error ) {

Expand All @@ -1064,7 +1064,7 @@ function WebGLState( gl, extensions ) {

try {

gl.texStorage2D.apply( gl, arguments );
gl.texStorage2D( ...arguments );

} catch ( error ) {

Expand All @@ -1078,7 +1078,7 @@ function WebGLState( gl, extensions ) {

try {

gl.texStorage3D.apply( gl, arguments );
gl.texStorage3D( ...arguments );

} catch ( error ) {

Expand All @@ -1092,7 +1092,7 @@ function WebGLState( gl, extensions ) {

try {

gl.texImage2D.apply( gl, arguments );
gl.texImage2D( ...arguments );

} catch ( error ) {

Expand All @@ -1106,7 +1106,7 @@ function WebGLState( gl, extensions ) {

try {

gl.texImage3D.apply( gl, arguments );
gl.texImage3D( ...arguments );

} catch ( error ) {

Expand Down
10 changes: 5 additions & 5 deletions test/unit/utils/console-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@ console._debug = console.debug;
// Wrap console methods
console.error = function () {

if ( this.level >= CONSOLE_LEVEL.ERROR ) this._error.apply( this, arguments );
if ( this.level >= CONSOLE_LEVEL.ERROR ) this._error( ...arguments );

};

console.warn = function () {

if ( this.level >= CONSOLE_LEVEL.WARN ) this._warn.apply( this, arguments );
if ( this.level >= CONSOLE_LEVEL.WARN ) this._warn( ...arguments );

};

console.log = function () {

if ( this.level >= CONSOLE_LEVEL.LOG ) this._log.apply( this, arguments );
if ( this.level >= CONSOLE_LEVEL.LOG ) this._log( ...arguments );

};

console.info = function () {

if ( this.level >= CONSOLE_LEVEL.INFO ) this._info.apply( this, arguments );
if ( this.level >= CONSOLE_LEVEL.INFO ) this._info( ...arguments );

};

console.debug = function () {

if ( this.level >= CONSOLE_LEVEL.DEBUG ) this._debug.apply( this, arguments );
if ( this.level >= CONSOLE_LEVEL.DEBUG ) this._debug( ...arguments );

};

0 comments on commit d264b7c

Please sign in to comment.