Skip to content

Commit d264b7c

Browse files
s-rigaudSamuel Rigaud
and
Samuel Rigaud
authored
Eslint: remove old .apply syntax (mrdoob#30513)
Co-authored-by: Samuel Rigaud <[email protected]>
1 parent 1805ecd commit d264b7c

File tree

9 files changed

+23
-22
lines changed

9 files changed

+23
-22
lines changed

.eslintrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"no-duplicate-imports": [
6666
"error"
6767
],
68+
"prefer-spread": "error",
6869
"valid-jsdoc": [
6970
"error",
7071
{

examples/jsm/loaders/ColladaLoader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3971,7 +3971,7 @@ class ColladaLoader extends Loader {
39713971
} else {
39723972

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

39763976
}
39773977

examples/webgl_geometry_text_shapes.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
}
106106

107-
shapes.push.apply( shapes, holeShapes );
107+
shapes.push( ...holeShapes );
108108

109109
const lineText = new THREE.Object3D();
110110

examples/webgl_geometry_text_stroke.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105

106106
}
107107

108-
shapes.push.apply( shapes, holeShapes );
108+
shapes.push( ...holeShapes );
109109

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

src/animation/AnimationUtils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function flattenJSON( jsonKeys, times, values, valuePropertyName ) {
9090
if ( value !== undefined ) {
9191

9292
times.push( key.time );
93-
values.push.apply( values, value ); // push all elements
93+
values.push( ...value ); // push all elements
9494

9595
}
9696

src/helpers/SkeletonHelper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function getBoneList( object ) {
116116

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

119-
boneList.push.apply( boneList, getBoneList( object.children[ i ] ) );
119+
boneList.push( ...getBoneList( object.children[ i ] ) );
120120

121121
}
122122

src/renderers/WebGLRenderer.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ class WebGLRenderer {
522522

523523
this.setClearColor = function () {
524524

525-
background.setClearColor.apply( background, arguments );
525+
background.setClearColor( ...arguments );
526526

527527
};
528528

@@ -534,7 +534,7 @@ class WebGLRenderer {
534534

535535
this.setClearAlpha = function () {
536536

537-
background.setClearAlpha.apply( background, arguments );
537+
background.setClearAlpha( ...arguments );
538538

539539
};
540540

src/renderers/webgl/WebGLState.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ function WebGLState( gl, extensions ) {
980980

981981
try {
982982

983-
gl.compressedTexImage2D.apply( gl, arguments );
983+
gl.compressedTexImage2D( ...arguments );
984984

985985
} catch ( error ) {
986986

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

995995
try {
996996

997-
gl.compressedTexImage3D.apply( gl, arguments );
997+
gl.compressedTexImage3D( ...arguments );
998998

999999
} catch ( error ) {
10001000

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

10091009
try {
10101010

1011-
gl.texSubImage2D.apply( gl, arguments );
1011+
gl.texSubImage2D( ...arguments );
10121012

10131013
} catch ( error ) {
10141014

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

10231023
try {
10241024

1025-
gl.texSubImage3D.apply( gl, arguments );
1025+
gl.texSubImage3D( ...arguments );
10261026

10271027
} catch ( error ) {
10281028

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

10371037
try {
10381038

1039-
gl.compressedTexSubImage2D.apply( gl, arguments );
1039+
gl.compressedTexSubImage2D( ...arguments );
10401040

10411041
} catch ( error ) {
10421042

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

10511051
try {
10521052

1053-
gl.compressedTexSubImage3D.apply( gl, arguments );
1053+
gl.compressedTexSubImage3D( ...arguments );
10541054

10551055
} catch ( error ) {
10561056

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

10651065
try {
10661066

1067-
gl.texStorage2D.apply( gl, arguments );
1067+
gl.texStorage2D( ...arguments );
10681068

10691069
} catch ( error ) {
10701070

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

10791079
try {
10801080

1081-
gl.texStorage3D.apply( gl, arguments );
1081+
gl.texStorage3D( ...arguments );
10821082

10831083
} catch ( error ) {
10841084

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

10931093
try {
10941094

1095-
gl.texImage2D.apply( gl, arguments );
1095+
gl.texImage2D( ...arguments );
10961096

10971097
} catch ( error ) {
10981098

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

11071107
try {
11081108

1109-
gl.texImage3D.apply( gl, arguments );
1109+
gl.texImage3D( ...arguments );
11101110

11111111
} catch ( error ) {
11121112

test/unit/utils/console-wrapper.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,30 @@ console._debug = console.debug;
3333
// Wrap console methods
3434
console.error = function () {
3535

36-
if ( this.level >= CONSOLE_LEVEL.ERROR ) this._error.apply( this, arguments );
36+
if ( this.level >= CONSOLE_LEVEL.ERROR ) this._error( ...arguments );
3737

3838
};
3939

4040
console.warn = function () {
4141

42-
if ( this.level >= CONSOLE_LEVEL.WARN ) this._warn.apply( this, arguments );
42+
if ( this.level >= CONSOLE_LEVEL.WARN ) this._warn( ...arguments );
4343

4444
};
4545

4646
console.log = function () {
4747

48-
if ( this.level >= CONSOLE_LEVEL.LOG ) this._log.apply( this, arguments );
48+
if ( this.level >= CONSOLE_LEVEL.LOG ) this._log( ...arguments );
4949

5050
};
5151

5252
console.info = function () {
5353

54-
if ( this.level >= CONSOLE_LEVEL.INFO ) this._info.apply( this, arguments );
54+
if ( this.level >= CONSOLE_LEVEL.INFO ) this._info( ...arguments );
5555

5656
};
5757

5858
console.debug = function () {
5959

60-
if ( this.level >= CONSOLE_LEVEL.DEBUG ) this._debug.apply( this, arguments );
60+
if ( this.level >= CONSOLE_LEVEL.DEBUG ) this._debug( ...arguments );
6161

6262
};

0 commit comments

Comments
 (0)