Best JavaScript code snippet using differencify
Three.Legacy.js
Source:Three.Legacy.js
...3 */4Object.defineProperties( THREE.Box2.prototype, {5 empty: {6 value: function () {7 console.warn( 'THREE.Box2: .empty() has been renamed to .isEmpty().' );8 return this.isEmpty();9 }10 },11 isIntersectionBox: {12 value: function ( box ) {13 console.warn( 'THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().' );14 return this.intersectsBox( box );15 }16 }17} );18Object.defineProperties( THREE.Box3.prototype, {19 empty: {20 value: function () {21 console.warn( 'THREE.Box3: .empty() has been renamed to .isEmpty().' );22 return this.isEmpty();23 }24 },25 isIntersectionBox: {26 value: function ( box ) {27 console.warn( 'THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().' );28 return this.intersectsBox( box );29 }30 },31 isIntersectionSphere: {32 value: function ( sphere ) {33 console.warn( 'THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().' );34 return this.intersectsSphere( sphere );35 }36 }37} );38Object.defineProperties( THREE.Matrix3.prototype, {39 multiplyVector3: {40 value: function ( vector ) {41 console.warn( 'THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.' );42 return vector.applyMatrix3( this );43 }44 },45 multiplyVector3Array: {46 value: function ( a ) {47 console.warn( 'THREE.Matrix3: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );48 return this.applyToVector3Array( a );49 }50 }51} );52Object.defineProperties( THREE.Matrix4.prototype, {53 extractPosition: {54 value: function ( m ) {55 console.warn( 'THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().' );56 return this.copyPosition( m );57 }58 },59 setRotationFromQuaternion: {60 value: function ( q ) {61 console.warn( 'THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().' );62 return this.makeRotationFromQuaternion( q );63 }64 },65 multiplyVector3: {66 value: function ( vector ) {67 console.warn( 'THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.' );68 return vector.applyProjection( this );69 }70 },71 multiplyVector4: {72 value: function ( vector ) {73 console.warn( 'THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.' );74 return vector.applyMatrix4( this );75 }76 },77 multiplyVector3Array: {78 value: function ( a ) {79 console.warn( 'THREE.Matrix4: .multiplyVector3Array() has been renamed. Use matrix.applyToVector3Array( array ) instead.' );80 return this.applyToVector3Array( a );81 }82 },83 rotateAxis: {84 value: function ( v ) {85 console.warn( 'THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.' );86 v.transformDirection( this );87 }88 },89 crossVector: {90 value: function ( vector ) {91 console.warn( 'THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.' );92 return vector.applyMatrix4( this );93 }94 },95 translate: {96 value: function ( v ) {97 console.error( 'THREE.Matrix4: .translate() has been removed.' );98 }99 },100 rotateX: {101 value: function ( angle ) {102 console.error( 'THREE.Matrix4: .rotateX() has been removed.' );103 }104 },105 rotateY: {106 value: function ( angle ) {107 console.error( 'THREE.Matrix4: .rotateY() has been removed.' );108 }109 },110 rotateZ: {111 value: function ( angle ) {112 console.error( 'THREE.Matrix4: .rotateZ() has been removed.' );113 }114 },115 rotateByAxis: {116 value: function ( axis, angle ) {117 console.error( 'THREE.Matrix4: .rotateByAxis() has been removed.' );118 }119 }120} );121Object.defineProperties( THREE.Plane.prototype, {122 isIntersectionLine: {123 value: function ( line ) {124 console.warn( 'THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().' );125 return this.intersectsLine( line );126 }127 }128} );129Object.defineProperties( THREE.Quaternion.prototype, {130 multiplyVector3: {131 value: function ( vector ) {132 console.warn( 'THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.' );133 return vector.applyQuaternion( this );134 }135 }136} );137Object.defineProperties( THREE.Ray.prototype, {138 isIntersectionBox: {139 value: function ( box ) {140 console.warn( 'THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().' );141 return this.intersectsBox( box );142 }143 },144 isIntersectionPlane: {145 value: function ( plane ) {146 console.warn( 'THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().' );147 return this.intersectsPlane( plane );148 }149 },150 isIntersectionSphere: {151 value: function ( sphere ) {152 console.warn( 'THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().' );153 return this.intersectsSphere( sphere );154 }155 }156} );157Object.defineProperties( THREE.Vector3.prototype, {158 setEulerFromRotationMatrix: {159 value: function () {160 console.error( 'THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.' );161 }162 },163 setEulerFromQuaternion: {164 value: function () {165 console.error( 'THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.' );166 }167 },168 getPositionFromMatrix: {169 value: function ( m ) {170 console.warn( 'THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().' );171 return this.setFromMatrixPosition( m );172 }173 },174 getScaleFromMatrix: {175 value: function ( m ) {176 console.warn( 'THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().' );177 return this.setFromMatrixScale( m );178 }179 },180 getColumnFromMatrix: {181 value: function ( index, matrix ) {182 console.warn( 'THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().' );183 return this.setFromMatrixColumn( index, matrix );184 }185 }186} );187//188THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {189 console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );190 return new THREE.Face3( a, b, c, normal, color, materialIndex );191};192THREE.Vertex = function ( x, y, z ) {193 console.warn( 'THREE.Vertex has been removed. Use THREE.Vector3 instead.' );194 return new THREE.Vector3( x, y, z );195};196//197Object.defineProperties( THREE.Object3D.prototype, {198 eulerOrder: {199 get: function () {200 console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );201 return this.rotation.order;202 },203 set: function ( value ) {204 console.warn( 'THREE.Object3D: .eulerOrder is now .rotation.order.' );205 this.rotation.order = value;206 }207 },208 getChildByName: {209 value: function ( name ) {210 console.warn( 'THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().' );211 return this.getObjectByName( name );212 }213 },214 renderDepth: {215 set: function ( value ) {216 console.warn( 'THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.' );217 }218 },219 translate: {220 value: function ( distance, axis ) {221 console.warn( 'THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.' );222 return this.translateOnAxis( axis, distance );223 }224 },225 useQuaternion: {226 get: function () {227 console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );228 },229 set: function ( value ) {230 console.warn( 'THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.' );231 }232 }233} );234//235Object.defineProperties( THREE, {236 PointCloud: {237 value: function ( geometry, material ) {238 console.warn( 'THREE.PointCloud has been renamed to THREE.Points.' );239 return new THREE.Points( geometry, material );240 }241 },242 ParticleSystem: {243 value: function ( geometry, material ) {244 console.warn( 'THREE.ParticleSystem has been renamed to THREE.Points.' );245 return new THREE.Points( geometry, material );246 }247 }248} );249//250Object.defineProperties( THREE.Light.prototype, {251 onlyShadow: {252 set: function ( value ) {253 console.warn( 'THREE.Light: .onlyShadow has been removed.' );254 }255 },256 shadowCameraFov: {257 set: function ( value ) {258 console.warn( 'THREE.Light: .shadowCameraFov is now .shadow.camera.fov.' );259 this.shadow.camera.fov = value;260 }261 },262 shadowCameraLeft: {263 set: function ( value ) {264 console.warn( 'THREE.Light: .shadowCameraLeft is now .shadow.camera.left.' );265 this.shadow.camera.left = value;266 }267 },268 shadowCameraRight: {269 set: function ( value ) {270 console.warn( 'THREE.Light: .shadowCameraRight is now .shadow.camera.right.' );271 this.shadow.camera.right = value;272 }273 },274 shadowCameraTop: {275 set: function ( value ) {276 console.warn( 'THREE.Light: .shadowCameraTop is now .shadow.camera.top.' );277 this.shadow.camera.top = value;278 }279 },280 shadowCameraBottom: {281 set: function ( value ) {282 console.warn( 'THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.' );283 this.shadow.camera.bottom = value;284 }285 },286 shadowCameraNear: {287 set: function ( value ) {288 console.warn( 'THREE.Light: .shadowCameraNear is now .shadow.camera.near.' );289 this.shadow.camera.near = value;290 }291 },292 shadowCameraFar: {293 set: function ( value ) {294 console.warn( 'THREE.Light: .shadowCameraFar is now .shadow.camera.far.' );295 this.shadow.camera.far = value;296 }297 },298 shadowCameraVisible: {299 set: function ( value ) {300 console.warn( 'THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.' );301 }302 },303 shadowBias: {304 set: function ( value ) {305 console.warn( 'THREE.Light: .shadowBias is now .shadow.bias.' );306 this.shadow.bias = value;307 }308 },309 shadowDarkness: {310 set: function ( value ) {311 console.warn( 'THREE.Light: .shadowDarkness has been removed.' );312 }313 },314 shadowMapWidth: {315 set: function ( value ) {316 console.warn( 'THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.' );317 this.shadow.mapSize.width = value;318 }319 },320 shadowMapHeight: {321 set: function ( value ) {322 console.warn( 'THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.' );323 this.shadow.mapSize.height = value;324 }325 }326} );327//328Object.defineProperties( THREE.BufferAttribute.prototype, {329 length: {330 get: function () {331 console.warn( 'THREE.BufferAttribute: .length has been deprecated. Please use .count.' );332 return this.array.length;333 }334 }335} );336Object.defineProperties( THREE.BufferGeometry.prototype, {337 drawcalls: {338 get: function () {339 console.error( 'THREE.BufferGeometry: .drawcalls has been renamed to .groups.' );340 return this.groups;341 }342 },343 offsets: {344 get: function () {345 console.warn( 'THREE.BufferGeometry: .offsets has been renamed to .groups.' );346 return this.groups;347 }348 },349 addIndex: {350 value: function ( index ) {351 console.warn( 'THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().' );352 this.setIndex( index );353 }354 },355 addDrawCall: {356 value: function ( start, count, indexOffset ) {357 if ( indexOffset !== undefined ) {358 console.warn( 'THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.' );359 }360 console.warn( 'THREE.BufferGeometry: .addDrawCall() is now .addGroup().' );361 this.addGroup( start, count );362 }363 },364 clearDrawCalls: {365 value: function () {366 console.warn( 'THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().' );367 this.clearGroups();368 }369 },370 computeTangents: {371 value: function () {372 console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );373 }374 },375 computeOffsets: {376 value: function () {377 console.warn( 'THREE.BufferGeometry: .computeOffsets() has been removed.' );378 }379 }380} );381//382Object.defineProperties( THREE.Material.prototype, {383 wrapAround: {384 get: function () {385 console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );386 },387 set: function ( value ) {388 console.warn( 'THREE.' + this.type + ': .wrapAround has been removed.' );389 }390 },391 wrapRGB: {392 get: function () {393 console.warn( 'THREE.' + this.type + ': .wrapRGB has been removed.' );394 return new THREE.Color();395 }396 }397} );398Object.defineProperties( THREE, {399 PointCloudMaterial: {400 value: function ( parameters ) {401 console.warn( 'THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial.' );402 return new THREE.PointsMaterial( parameters );403 }404 },405 ParticleBasicMaterial: {406 value: function ( parameters ) {407 console.warn( 'THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial.' );408 return new THREE.PointsMaterial( parameters );409 }410 },411 ParticleSystemMaterial:{412 value: function ( parameters ) {413 console.warn( 'THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial.' );414 return new THREE.PointsMaterial( parameters );415 }416 }417} );418Object.defineProperties( THREE.MeshPhongMaterial.prototype, {419 metal: {420 get: function () {421 console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );422 return false;423 },424 set: function ( value ) {425 console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );426 }427 }428} );429Object.defineProperties( THREE.ShaderMaterial.prototype, {430 derivatives: {431 get: function () {432 console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );433 return this.extensions.derivatives;434 },435 set: function ( value ) {436 console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );437 this.extensions.derivatives = value;438 }439 }440} );441//442Object.defineProperties( THREE.WebGLRenderer.prototype, {443 supportsFloatTextures: {444 value: function () {445 console.warn( 'THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).' );446 return this.extensions.get( 'OES_texture_float' );447 }448 },449 supportsHalfFloatTextures: {450 value: function () {451 console.warn( 'THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).' );452 return this.extensions.get( 'OES_texture_half_float' );453 }454 },455 supportsStandardDerivatives: {456 value: function () {457 console.warn( 'THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).' );458 return this.extensions.get( 'OES_standard_derivatives' );459 }460 },461 supportsCompressedTextureS3TC: {462 value: function () {463 console.warn( 'THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).' );464 return this.extensions.get( 'WEBGL_compressed_texture_s3tc' );465 }466 },467 supportsCompressedTexturePVRTC: {468 value: function () {469 console.warn( 'THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).' );470 return this.extensions.get( 'WEBGL_compressed_texture_pvrtc' );471 }472 },473 supportsBlendMinMax: {474 value: function () {475 console.warn( 'THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).' );476 return this.extensions.get( 'EXT_blend_minmax' );477 }478 },479 supportsVertexTextures: {480 value: function () {481 return this.capabilities.vertexTextures;482 }483 },484 supportsInstancedArrays: {485 value: function () {486 console.warn( 'THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).' );487 return this.extensions.get( 'ANGLE_instanced_arrays' );488 }489 },490 enableScissorTest: {491 value: function ( boolean ) {492 console.warn( 'THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().' );493 this.setScissorTest( boolean );494 }495 },496 initMaterial: {497 value: function () {498 console.warn( 'THREE.WebGLRenderer: .initMaterial() has been removed.' );499 }500 },501 addPrePlugin: {502 value: function () {503 console.warn( 'THREE.WebGLRenderer: .addPrePlugin() has been removed.' );504 }505 },506 addPostPlugin: {507 value: function () {508 console.warn( 'THREE.WebGLRenderer: .addPostPlugin() has been removed.' );509 }510 },511 updateShadowMap: {512 value: function () {513 console.warn( 'THREE.WebGLRenderer: .updateShadowMap() has been removed.' );514 }515 },516 shadowMapEnabled: {517 get: function () {518 return this.shadowMap.enabled;519 },520 set: function ( value ) {521 console.warn( 'THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.' );522 this.shadowMap.enabled = value;523 }524 },525 shadowMapType: {526 get: function () {527 return this.shadowMap.type;528 },529 set: function ( value ) {530 console.warn( 'THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.' );531 this.shadowMap.type = value;532 }533 },534 shadowMapCullFace: {535 get: function () {536 return this.shadowMap.cullFace;537 },538 set: function ( value ) {539 console.warn( 'THREE.WebGLRenderer: .shadowMapCullFace is now .shadowMap.cullFace.' );540 this.shadowMap.cullFace = value;541 }542 }543} );544//545Object.defineProperties( THREE.WebGLRenderTarget.prototype, {546 wrapS: {547 get: function () {548 console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );549 return this.texture.wrapS;550 },551 set: function ( value ) {552 console.warn( 'THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.' );553 this.texture.wrapS = value;554 }555 },556 wrapT: {557 get: function () {558 console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );559 return this.texture.wrapT;560 },561 set: function ( value ) {562 console.warn( 'THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.' );563 this.texture.wrapT = value;564 }565 },566 magFilter: {567 get: function () {568 console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );569 return this.texture.magFilter;570 },571 set: function ( value ) {572 console.warn( 'THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.' );573 this.texture.magFilter = value;574 }575 },576 minFilter: {577 get: function () {578 console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );579 return this.texture.minFilter;580 },581 set: function ( value ) {582 console.warn( 'THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.' );583 this.texture.minFilter = value;584 }585 },586 anisotropy: {587 get: function () {588 console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );589 return this.texture.anisotropy;590 },591 set: function ( value ) {592 console.warn( 'THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.' );593 this.texture.anisotropy = value;594 }595 },596 offset: {597 get: function () {598 console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );599 return this.texture.offset;600 },601 set: function ( value ) {602 console.warn( 'THREE.WebGLRenderTarget: .offset is now .texture.offset.' );603 this.texture.offset = value;604 }605 },606 repeat: {607 get: function () {608 console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );609 return this.texture.repeat;610 },611 set: function ( value ) {612 console.warn( 'THREE.WebGLRenderTarget: .repeat is now .texture.repeat.' );613 this.texture.repeat = value;614 }615 },616 format: {617 get: function () {618 console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );619 return this.texture.format;620 },621 set: function ( value ) {622 console.warn( 'THREE.WebGLRenderTarget: .format is now .texture.format.' );623 this.texture.format = value;624 }625 },626 type: {627 get: function () {628 console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );629 return this.texture.type;630 },631 set: function ( value ) {632 console.warn( 'THREE.WebGLRenderTarget: .type is now .texture.type.' );633 this.texture.type = value;634 }635 },636 generateMipmaps: {637 get: function () {638 console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );639 return this.texture.generateMipmaps;640 },641 set: function ( value ) {642 console.warn( 'THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.' );643 this.texture.generateMipmaps = value;644 }645 }646} );647//648THREE.GeometryUtils = {649 merge: function ( geometry1, geometry2, materialIndexOffset ) {650 console.warn( 'THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.' );651 var matrix;652 if ( geometry2 instanceof THREE.Mesh ) {653 geometry2.matrixAutoUpdate && geometry2.updateMatrix();654 matrix = geometry2.matrix;655 geometry2 = geometry2.geometry;656 }657 geometry1.merge( geometry2, matrix, materialIndexOffset );658 },659 center: function ( geometry ) {660 console.warn( 'THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.' );661 return geometry.center();662 }663};664THREE.ImageUtils = {665 crossOrigin: undefined,666 loadTexture: function ( url, mapping, onLoad, onError ) {667 console.warn( 'THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.' );668 var loader = new THREE.TextureLoader();669 loader.setCrossOrigin( this.crossOrigin );670 var texture = loader.load( url, onLoad, undefined, onError );671 if ( mapping ) texture.mapping = mapping;672 return texture;673 },674 loadTextureCube: function ( urls, mapping, onLoad, onError ) {675 console.warn( 'THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.' );676 var loader = new THREE.CubeTextureLoader();677 loader.setCrossOrigin( this.crossOrigin );678 var texture = loader.load( urls, onLoad, undefined, onError );679 if ( mapping ) texture.mapping = mapping;680 return texture;681 },682 loadCompressedTexture: function () {683 console.error( 'THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.' );684 },685 loadCompressedTextureCube: function () {686 console.error( 'THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.' );687 }688};689//690THREE.Projector = function () {691 console.error( 'THREE.Projector has been moved to /examples/js/renderers/Projector.js.' );692 this.projectVector = function ( vector, camera ) {693 console.warn( 'THREE.Projector: .projectVector() is now vector.project().' );694 vector.project( camera );695 };696 this.unprojectVector = function ( vector, camera ) {697 console.warn( 'THREE.Projector: .unprojectVector() is now vector.unproject().' );698 vector.unproject( camera );699 };700 this.pickingRay = function ( vector, camera ) {701 console.error( 'THREE.Projector: .pickingRay() is now raycaster.setFromCamera().' );702 };703};704//705THREE.CanvasRenderer = function () {706 console.error( 'THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js' );707 this.domElement = document.createElement( 'canvas' );708 this.clear = function () {};709 this.render = function () {};710 this.setClearColor = function () {};711 this.setSize = function () {};...
index.js
Source:index.js
1/**2 * Copyright (c) 2015-present, Facebook, Inc.3 *4 * This source code is licensed under the MIT license found in the5 * LICENSE file in the root directory of this source tree.6 */7'use strict';8// Inspired by https://github.com/airbnb/javascript but less opinionated.9// We use eslint-loader so even warnings are very visible.10// This is why we prefer to use "WARNING" level for potential errors,11// and we try not to use "ERROR" level at all.12// In the future, we might create a separate list of rules for production.13// It would probably be more strict.14// The ESLint browser environment defines all browser globals as valid,15// even though most people don't know some of them exist (e.g. `name` or `status`).16// This is dangerous as it hides accidentally undefined variables.17// We blacklist the globals that we deem potentially confusing.18// To use them, explicitly reference them, e.g. `window.name` or `window.status`.19const restrictedGlobals = require('confusing-browser-globals');20module.exports = {21 extends: [require.resolve('./base')],22 plugins: ['import', 'flowtype', 'jsx-a11y', 'react-hooks'],23 overrides: [24 {25 files: ['**/*.ts?(x)'],26 parser: '@typescript-eslint/parser',27 parserOptions: {28 ecmaVersion: 2018,29 sourceType: 'module',30 ecmaFeatures: {31 jsx: true,32 },33 // typescript-eslint specific options34 warnOnUnsupportedTypeScriptVersion: true,35 },36 plugins: ['@typescript-eslint'],37 // If adding a typescript-eslint version of an existing ESLint rule,38 // make sure to disable the ESLint rule here.39 rules: {40 // TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)41 'default-case': 'off',42 // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)43 'no-dupe-class-members': 'off',44 // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)45 'no-undef': 'off',46 // Add TypeScript specific rules (and turn off ESLint equivalents)47 '@typescript-eslint/consistent-type-assertions': 'warn',48 'no-array-constructor': 'off',49 '@typescript-eslint/no-array-constructor': 'warn',50 'no-redeclare': 'off',51 '@typescript-eslint/no-redeclare': 'warn',52 'no-use-before-define': 'off',53 '@typescript-eslint/no-use-before-define': [54 'warn',55 {56 functions: false,57 classes: false,58 variables: false,59 typedefs: false,60 },61 ],62 'no-unused-expressions': 'off',63 '@typescript-eslint/no-unused-expressions': [64 'error',65 {66 allowShortCircuit: true,67 allowTernary: true,68 allowTaggedTemplates: true,69 },70 ],71 'no-unused-vars': 'off',72 '@typescript-eslint/no-unused-vars': [73 'warn',74 {75 args: 'none',76 ignoreRestSiblings: true,77 },78 ],79 'no-useless-constructor': 'off',80 '@typescript-eslint/no-useless-constructor': 'warn',81 },82 },83 ],84 // NOTE: When adding rules here, you need to make sure they are compatible with85 // `typescript-eslint`, as some rules such as `no-array-constructor` aren't compatible.86 rules: {87 // http://eslint.org/docs/rules/88 'array-callback-return': 'warn',89 'default-case': ['warn', { commentPattern: '^no default$' }],90 'dot-location': ['warn', 'property'],91 eqeqeq: ['warn', 'smart'],92 'new-parens': 'warn',93 'no-array-constructor': 'warn',94 'no-caller': 'warn',95 'no-cond-assign': ['warn', 'except-parens'],96 'no-const-assign': 'warn',97 'no-control-regex': 'warn',98 'no-delete-var': 'warn',99 'no-dupe-args': 'warn',100 'no-dupe-class-members': 'warn',101 'no-dupe-keys': 'warn',102 'no-duplicate-case': 'warn',103 'no-empty-character-class': 'warn',104 'no-empty-pattern': 'warn',105 'no-eval': 'warn',106 'no-ex-assign': 'warn',107 'no-extend-native': 'warn',108 'no-extra-bind': 'warn',109 'no-extra-label': 'warn',110 'no-fallthrough': 'warn',111 'no-func-assign': 'warn',112 'no-implied-eval': 'warn',113 'no-invalid-regexp': 'warn',114 'no-iterator': 'warn',115 'no-label-var': 'warn',116 'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],117 'no-lone-blocks': 'warn',118 'no-loop-func': 'warn',119 'no-mixed-operators': [120 'warn',121 {122 groups: [123 ['&', '|', '^', '~', '<<', '>>', '>>>'],124 ['==', '!=', '===', '!==', '>', '>=', '<', '<='],125 ['&&', '||'],126 ['in', 'instanceof'],127 ],128 allowSamePrecedence: false,129 },130 ],131 'no-multi-str': 'warn',132 'no-native-reassign': 'warn',133 'no-negated-in-lhs': 'warn',134 'no-new-func': 'warn',135 'no-new-object': 'warn',136 'no-new-symbol': 'warn',137 'no-new-wrappers': 'warn',138 'no-obj-calls': 'warn',139 'no-octal': 'warn',140 'no-octal-escape': 'warn',141 'no-redeclare': 'warn',142 'no-regex-spaces': 'warn',143 'no-restricted-syntax': ['warn', 'WithStatement'],144 'no-script-url': 'warn',145 'no-self-assign': 'warn',146 'no-self-compare': 'warn',147 'no-sequences': 'warn',148 'no-shadow-restricted-names': 'warn',149 'no-sparse-arrays': 'warn',150 'no-template-curly-in-string': 'warn',151 'no-this-before-super': 'warn',152 'no-throw-literal': 'warn',153 'no-undef': 'error',154 'no-restricted-globals': ['error'].concat(restrictedGlobals),155 'no-unreachable': 'warn',156 'no-unused-expressions': [157 'error',158 {159 allowShortCircuit: true,160 allowTernary: true,161 allowTaggedTemplates: true,162 },163 ],164 'no-unused-labels': 'warn',165 'no-unused-vars': [166 'warn',167 {168 args: 'none',169 ignoreRestSiblings: true,170 },171 ],172 'no-use-before-define': [173 'warn',174 {175 functions: false,176 classes: false,177 variables: false,178 },179 ],180 'no-useless-computed-key': 'warn',181 'no-useless-concat': 'warn',182 'no-useless-constructor': 'warn',183 'no-useless-escape': 'warn',184 'no-useless-rename': [185 'warn',186 {187 ignoreDestructuring: false,188 ignoreImport: false,189 ignoreExport: false,190 },191 ],192 'no-with': 'warn',193 'no-whitespace-before-property': 'warn',194 'react-hooks/exhaustive-deps': 'warn',195 'require-yield': 'warn',196 'rest-spread-spacing': ['warn', 'never'],197 strict: ['warn', 'never'],198 'unicode-bom': ['warn', 'never'],199 'use-isnan': 'warn',200 'valid-typeof': 'warn',201 'no-restricted-properties': [202 'error',203 {204 object: 'require',205 property: 'ensure',206 message:207 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',208 },209 {210 object: 'System',211 property: 'import',212 message:213 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',214 },215 ],216 'getter-return': 'warn',217 // https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules218 'import/first': 'error',219 'import/no-amd': 'error',220 'import/no-anonymous-default-export': 'warn',221 'import/no-webpack-loader-syntax': 'error',222 // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules223 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],224 'react/jsx-no-comment-textnodes': 'warn',225 'react/jsx-no-duplicate-props': 'warn',226 'react/jsx-no-target-blank': 'warn',227 'react/jsx-no-undef': 'error',228 'react/jsx-pascal-case': [229 'warn',230 {231 allowAllCaps: true,232 ignore: [],233 },234 ],235 'react/no-danger-with-children': 'warn',236 // Disabled because of undesirable warnings237 // See https://github.com/facebook/create-react-app/issues/5204 for238 // blockers until its re-enabled239 // 'react/no-deprecated': 'warn',240 'react/no-direct-mutation-state': 'warn',241 'react/no-is-mounted': 'warn',242 'react/no-typos': 'error',243 'react/require-render-return': 'error',244 'react/style-prop-object': 'warn',245 // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules246 'jsx-a11y/alt-text': 'warn',247 'jsx-a11y/anchor-has-content': 'warn',248 'jsx-a11y/anchor-is-valid': [249 'warn',250 {251 aspects: ['noHref', 'invalidHref'],252 },253 ],254 'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',255 'jsx-a11y/aria-props': 'warn',256 'jsx-a11y/aria-proptypes': 'warn',257 'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],258 'jsx-a11y/aria-unsupported-elements': 'warn',259 'jsx-a11y/heading-has-content': 'warn',260 'jsx-a11y/iframe-has-title': 'warn',261 'jsx-a11y/img-redundant-alt': 'warn',262 'jsx-a11y/no-access-key': 'warn',263 'jsx-a11y/no-distracting-elements': 'warn',264 'jsx-a11y/no-redundant-roles': 'warn',265 'jsx-a11y/role-has-required-aria-props': 'warn',266 'jsx-a11y/role-supports-aria-props': 'warn',267 'jsx-a11y/scope': 'warn',268 // https://github.com/facebook/react/tree/master/packages/eslint-plugin-react-hooks269 'react-hooks/rules-of-hooks': 'error',270 // https://github.com/gajus/eslint-plugin-flowtype271 'flowtype/define-flow-type': 'warn',272 'flowtype/require-valid-file-annotation': 'warn',273 'flowtype/use-flow-type': 'warn',274 },...
.eslintrc.js
Source:.eslintrc.js
1module.exports = {2 'env': {3 'browser': true,4 'es6': true,5 'node': true,6 'mocha': true7 },8 'extends': 'eslint:recommended',9 'plugins': ['import'],10 "parser": "babel-eslint",11 'parserOptions': {12 'sourceType': 'module'13 },14 'globals': {15 'jpeg': true,16 'JpegImage': true,17 'JpxImage': true,18 'CharLS': true,19 'OpenJPEG': true20 },21 'rules': {22 'accessor-pairs': 'warn',23 'array-bracket-spacing': 'warn',24 'array-callback-return': 'warn',25 'arrow-body-style': 'warn',26 'arrow-parens': 'warn',27 'arrow-spacing': 'warn',28 //'block-scoped-var': 'warn',29 'block-spacing': 'warn',30 'brace-style': 'warn',31 'callback-return': 'warn',32 //'camelcase': 'warn',33 //'capitalized-comments': 'warn',34 'class-methods-use-this': 'warn',35 'comma-dangle': 'warn',36 'comma-spacing': [37 'warn',38 {39 'after': true,40 'before': false41 }42 ],43 'comma-style': 'warn',44 'complexity': 'warn',45 'computed-property-spacing': 'warn',46 //'consistent-return': 'warn',47 'consistent-this': 'warn',48 'curly': 'warn',49 //'default-case': 'warn',50 'dot-location': 'warn',51 'dot-notation': 'warn',52 'eol-last': 'warn',53 'eqeqeq': 'warn',54 'func-call-spacing': 'warn',55 'func-name-matching': 'warn',56 'func-names': [57 'warn',58 'never'59 ],60 //'func-style': 'warn',61 'generator-star-spacing': 'warn',62 'global-require': 'warn',63 //'guard-for-in': 'warn',64 'handle-callback-err': 'warn',65 'id-blacklist': 'warn',66 'id-length': 'off',67 'id-match': 'warn',68 'indent': ['warn', 2],69 //'init-declarations': 'warn',70 'import/default': 'warn',71 'import/export': 'warn',72 'import/extensions': ['warn', { "js": "always" }],73 'import/first': 'warn',74 'import/named': 'warn',75 'import/namespace': 'warn',76 'import/newline-after-import': 'warn',77 'import/no-unresolved': 'warn',78 'import/no-webpack-loader-syntax': 'warn',79 'jsx-quotes': 'warn',80 'key-spacing': 'warn',81 'keyword-spacing': [82 'warn',83 {84 'after': true,85 'before': true86 }87 ],88 //'line-comment-position': 'warn',89 'linebreak-style': [90 'warn',91 'unix'92 ],93 'lines-around-comment': 'warn',94 'lines-around-directive': 'warn',95 'max-depth': 'warn',96 /*'max-len': ['warn', {97 'code': 100,98 'tabWidth': 2,99 'comments': 80,100 'ignoreComments': false,101 'ignoreTrailingComments': true,102 'ignoreUrls': true,103 'ignoreTemplateLiterals': false,104 'ignoreRegExpLiterals': true105 }],*/106 //'max-lines': 'warn',107 'max-nested-callbacks': 'warn',108 //'max-params': 'warn',109 //'max-statements': 'warn',110 'max-statements-per-line': 'warn',111 'multiline-ternary': 'off',112 //'new-cap': 'warn',113 'new-parens': 'warn',114 'newline-after-var': 'warn',115 'newline-before-return': 'warn',116 //'newline-per-chained-call': 'warn',117 'no-alert': 'warn',118 'no-array-constructor': 'warn',119 'no-bitwise': 'warn',120 'no-caller': 'warn',121 'no-catch-shadow': 'warn',122 'no-confusing-arrow': 'warn',123 'no-console': 'off',124 //'no-continue': 'warn',125 'no-div-regex': 'warn',126 'no-duplicate-imports': 'warn',127 'no-else-return': 'warn',128 'no-empty-function': 'off',129 'no-eq-null': 'warn',130 'no-eval': 'warn',131 'no-extend-native': 'warn',132 'no-extra-bind': 'warn',133 'no-extra-label': 'warn',134 'no-extra-parens': 'off',135 'no-floating-decimal': 'warn',136 'no-implicit-coercion': 'warn',137 'no-implicit-globals': 'warn',138 'no-implied-eval': 'warn',139 //'no-inline-comments': 'warn',140 'no-invalid-this': 'off',141 'no-iterator': 'warn',142 'no-label-var': 'warn',143 'no-labels': 'warn',144 'no-lone-blocks': 'warn',145 'no-lonely-if': 'warn',146 'no-loop-func': 'warn',147 'no-magic-numbers': 'off',148 //'no-mixed-operators': 'warn',149 'no-mixed-requires': 'warn',150 'no-multi-spaces': 'warn',151 'no-multi-str': 'warn',152 'no-multiple-empty-lines': 'warn',153 'no-native-reassign': 'warn',154 'no-negated-condition': 'warn',155 'no-negated-in-lhs': 'warn',156 'no-nested-ternary': 'warn',157 //'no-new': 'warn',158 'no-new-func': 'warn',159 'no-new-object': 'warn',160 'no-new-require': 'warn',161 'no-new-wrappers': 'warn',162 'no-octal-escape': 'warn',163 //'no-param-reassign': 'warn',164 'no-path-concat': 'warn',165 //'no-plusplus': 'warn',166 'no-process-env': 'warn',167 'no-process-exit': 'warn',168 'no-proto': 'warn',169 //'no-prototype-builtins': 'warn',170 'no-restricted-globals': 'warn',171 'no-restricted-imports': 'warn',172 'no-restricted-modules': 'warn',173 'no-restricted-properties': 'warn',174 'no-restricted-syntax': 'warn',175 'no-return-assign': 'warn',176 'no-return-await': 'warn',177 'no-script-url': 'warn',178 'no-self-compare': 'warn',179 'no-sequences': 'warn',180 //'no-shadow': 'warn',181 'no-shadow-restricted-names': 'warn',182 'no-spaced-func': 'warn',183 'no-sync': 'warn',184 'no-tabs': 'warn',185 'no-template-curly-in-string': 'warn',186 'no-ternary': 'off',187 'no-throw-literal': 'warn',188 'no-trailing-spaces': 'warn',189 'no-undef': 'error',190 'no-undef-init': 'warn',191 'no-undefined': 'off',192 'no-unused-vars': 'warn',193 //'no-underscore-dangle': 'warn',194 'no-unmodified-loop-condition': 'warn',195 'no-unneeded-ternary': 'warn',196 'no-unused-expressions': 'warn',197 //'no-use-before-define': 'warn',198 'no-useless-call': 'warn',199 'no-useless-computed-key': 'warn',200 'no-useless-concat': 'warn',201 'no-useless-constructor': 'warn',202 'no-useless-escape': 'warn',203 'no-useless-rename': 'warn',204 'no-useless-return': 'off',205 'no-var': 'warn',206 'no-void': 'warn',207 //'no-warning-comments': 'warn',208 'no-whitespace-before-property': 'warn',209 'no-with': 'warn',210 'object-curly-spacing': [211 'warn',212 'always'213 ],214 'object-property-newline': 'warn',215 'object-shorthand': 'warn',216 'one-var': 'off',217 'one-var-declaration-per-line': 'warn',218 'operator-assignment': 'warn',219 'operator-linebreak': 'warn',220 'padded-blocks': 'off',221 'prefer-arrow-callback': 'off',222 'prefer-const': 'warn',223 'prefer-numeric-literals': 'warn',224 //'prefer-reflect': 'warn',225 //'prefer-rest-params': 'warn',226 'prefer-spread': 'warn',227 'prefer-template': 'warn',228 'quote-props': ['warn', 'as-needed'],229 'quotes': [230 'warn',231 'single'232 ],233 'radix': 'warn',234 'require-await': 'warn',235 //'require-jsdoc': 'warn',236 'rest-spread-spacing': 'warn',237 'semi': 'warn',238 'semi-spacing': 'warn',239 'sort-imports': 'off',240 'sort-keys': 'off',241 'sort-vars': 'off',242 'space-before-blocks': 'warn',243 'space-before-function-paren': 'warn',244 'space-in-parens': [245 'warn',246 'never'247 ],248 'space-infix-ops': 'warn',249 'space-unary-ops': 'warn',250 'spaced-comment': 'warn',251 'strict': 'warn',252 'symbol-description': 'warn',253 'template-curly-spacing': 'warn',254 'unicode-bom': [255 'warn',256 'never'257 ],258 //'valid-jsdoc': 'warn',259 'vars-on-top': 'warn',260 'wrap-iife': ['warn', 'inside'],261 'wrap-regex': 'warn',262 'yield-star-spacing': 'warn',263 'yoda': 'warn'264 }...
eslint.js
Source:eslint.js
1/**2 * Copyright (c) 2015-present, Facebook, Inc.3 * All rights reserved.4 *5 * This source code is licensed under the BSD-style license found in the6 * LICENSE file in the root directory of this source tree. An additional grant7 * of patent rights can be found in the PATENTS file in the same directory.8 */9// Inspired by https://github.com/airbnb/javascript but less opinionated.10// We use eslint-loader so even warnings are very visibile.11// This is why we only use "WARNING" level for potential errors,12// and we don't use "ERROR" level at all.13// In the future, we might create a separate list of rules for production.14// It would probably be more strict.15module.exports = {16 root: true,17 parser: 'babel-eslint',18 // import plugin is termporarily disabled, scroll below to see why19 plugins: [/*'import', */'flowtype', 'jsx-a11y', 'react'],20 env: {21 browser: true,22 commonjs: true,23 es6: true,24 node: true25 },26 parserOptions: {27 ecmaVersion: 6,28 sourceType: 'module',29 ecmaFeatures: {30 jsx: true,31 generators: true,32 experimentalObjectRestSpread: true33 }34 },35 settings: {36 'import/ignore': [37 'node_modules',38 '\\.(json|css|jpg|png|gif|eot|svg|ttf|woff|woff2|mp4|webm)$',39 ],40 'import/extensions': ['.js'],41 'import/resolver': {42 node: {43 extensions: ['.js', '.json']44 }45 }46 },47 rules: {48 // http://eslint.org/docs/rules/49 'array-callback-return': 'warn',50 'default-case': ['warn', { commentPattern: '^no default$' }],51 'dot-location': ['warn', 'property'],52 eqeqeq: ['warn', 'allow-null'],53 'guard-for-in': 'warn',54 'new-cap': ['warn', { newIsCap: true }],55 'new-parens': 'warn',56 'no-array-constructor': 'warn',57 'no-caller': 'warn',58 'no-cond-assign': ['warn', 'always'],59 'no-const-assign': 'warn',60 'no-control-regex': 'warn',61 'no-delete-var': 'warn',62 'no-dupe-args': 'warn',63 'no-dupe-class-members': 'warn',64 'no-dupe-keys': 'warn',65 'no-duplicate-case': 'warn',66 'no-empty-character-class': 'warn',67 'no-empty-pattern': 'warn',68 'no-eval': 'warn',69 'no-ex-assign': 'warn',70 'no-extend-native': 'warn',71 'no-extra-bind': 'warn',72 'no-extra-label': 'warn',73 'no-fallthrough': 'warn',74 'no-func-assign': 'warn',75 'no-implied-eval': 'warn',76 'no-invalid-regexp': 'warn',77 'no-iterator': 'warn',78 'no-label-var': 'warn',79 'no-labels': ['warn', { allowLoop: false, allowSwitch: false }],80 'no-lone-blocks': 'warn',81 'no-loop-func': 'warn',82 'no-mixed-operators': ['warn', {83 groups: [84 ['&', '|', '^', '~', '<<', '>>', '>>>'],85 ['==', '!=', '===', '!==', '>', '>=', '<', '<='],86 ['&&', '||'],87 ['in', 'instanceof']88 ],89 allowSamePrecedence: false90 }],91 'no-multi-str': 'warn',92 'no-native-reassign': 'warn',93 'no-negated-in-lhs': 'warn',94 'no-new-func': 'warn',95 'no-new-object': 'warn',96 'no-new-symbol': 'warn',97 'no-new-wrappers': 'warn',98 'no-obj-calls': 'warn',99 'no-octal': 'warn',100 'no-octal-escape': 'warn',101 'no-redeclare': 'warn',102 'no-regex-spaces': 'warn',103 'no-restricted-syntax': [104 'warn',105 'LabeledStatement',106 'WithStatement',107 ],108 'no-return-assign': 'warn',109 'no-script-url': 'warn',110 'no-self-assign': 'warn',111 'no-self-compare': 'warn',112 'no-sequences': 'warn',113 'no-shadow-restricted-names': 'warn',114 'no-sparse-arrays': 'warn',115 'no-this-before-super': 'warn',116 'no-throw-literal': 'warn',117 'no-undef': 'warn',118 'no-unexpected-multiline': 'warn',119 'no-unreachable': 'warn',120 'no-unused-expressions': 'warn',121 'no-unused-labels': 'warn',122 'no-unused-vars': ['warn', { vars: 'local', args: 'none' }],123 'no-use-before-define': ['warn', 'nofunc'],124 'no-useless-computed-key': 'warn',125 'no-useless-concat': 'warn',126 'no-useless-constructor': 'warn',127 'no-useless-escape': 'warn',128 'no-useless-rename': ['warn', {129 ignoreDestructuring: false,130 ignoreImport: false,131 ignoreExport: false,132 }],133 'no-with': 'warn',134 'no-whitespace-before-property': 'warn',135 'operator-assignment': ['warn', 'always'],136 radix: 'warn',137 'require-yield': 'warn',138 'rest-spread-spacing': ['warn', 'never'],139 strict: ['warn', 'never'],140 'unicode-bom': ['warn', 'never'],141 'use-isnan': 'warn',142 'valid-typeof': 'warn',143 // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/144 // TODO: import rules are temporarily disabled because they don't play well145 // with how eslint-loader only checks the file you change. So if module A146 // imports module B, and B is missing a default export, the linter will147 // record this as an issue in module A. Now if you fix module B, the linter148 // will not be aware that it needs to re-lint A as well, so the error149 // will stay until the next restart, which is really confusing.150 // This is probably fixable with a patch to eslint-loader.151 // When file A is saved, we want to invalidate all files that import it152 // *and* that currently have lint errors. This should fix the problem.153 // 'import/default': 'warn',154 // 'import/export': 'warn',155 // 'import/named': 'warn',156 // 'import/namespace': 'warn',157 // 'import/no-amd': 'warn',158 // 'import/no-duplicates': 'warn',159 // 'import/no-extraneous-dependencies': 'warn',160 // 'import/no-named-as-default': 'warn',161 // 'import/no-named-as-default-member': 'warn',162 // 'import/no-unresolved': ['warn', { commonjs: true }],163 // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules164 'react/jsx-equals-spacing': ['warn', 'never'],165 'react/jsx-no-duplicate-props': ['warn', { ignoreCase: true }],166 'react/jsx-no-undef': 'warn',167 'react/jsx-pascal-case': ['warn', {168 allowAllCaps: true,169 ignore: [],170 }],171 'react/jsx-uses-react': 'warn',172 'react/jsx-uses-vars': 'warn',173 'react/no-deprecated': 'warn',174 'react/no-direct-mutation-state': 'warn',175 'react/no-is-mounted': 'warn',176 'react/react-in-jsx-scope': 'warn',177 'react/require-render-return': 'warn',178 // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules179 'jsx-a11y/aria-role': 'warn',180 'jsx-a11y/img-has-alt': 'warn',181 'jsx-a11y/img-redundant-alt': 'warn',182 'jsx-a11y/no-access-key': 'warn',183 // https://github.com/gajus/eslint-plugin-flowtype184 'flowtype/define-flow-type': 'warn',185 'flowtype/require-valid-file-annotation': 'warn',186 'flowtype/use-flow-type': 'warn'187 }...
statement-after-return.js
Source:statement-after-return.js
1// Warning should be shown for unreachable statement after return (bug 1151931).2function testWarn(code, lineNumber, columnNumber) {3 enableLastWarning();4 eval(code);5 var warning = getLastWarning();6 assertEq(warning !== null, true, "warning should be caught for " + code);7 assertEq(warning.name, "None");8 assertEq(warning.lineNumber, lineNumber);9 assertEq(warning.columnNumber, columnNumber);10 clearLastWarning();11 Reflect.parse(code);12 warning = getLastWarning();13 assertEq(warning !== null, true, "warning should be caught for " + code);14 assertEq(warning.name, "None");15 // Warning generated by Reflect.parse has line/column number for Reflect.parse16 // itself, not parsed code.17 disableLastWarning();18}19function testPass(code) {20 enableLastWarning();21 eval(code);22 var warning = getLastWarning();23 assertEq(warning, null, "warning should not be caught for " + code);24 clearLastWarning();25 Reflect.parse(code);26 warning = getLastWarning();27 assertEq(warning, null, "warning should not be caught for " + code);28 disableLastWarning();29}30testPass(`31function f() {32 return (33 1 + 234 );35}36`);37// unary expression38testWarn(`39function f() {40 var i = 0;41 return42 ++i;43}44`, 5, 4);45testWarn(`46function f() {47 var i = 0;48 return49 --i;50}51`, 5, 4);52// array53testWarn(`54function f() {55 return56 [1, 2, 3];57}58`, 4, 4);59// block (object)60testWarn(`61function f() {62 return63 {x: 10};64}65`, 4, 4);66testWarn(`67function f() {68 return69 {70 method()71 {72 f();73 }74 };75}76`, 4, 2);77// expression in paren78testWarn(`79function f() {80 return81 (1 + 2);82}83`, 4, 4);84// name85testWarn(`86function f() {87 return88 f;89}90`, 4, 4);91// binary expression92testWarn(`93function f() {94 return95 1 + 2;96}97`, 4, 4);98testWarn(`99function f() {100 return101 .1 + .2;102}103`, 4, 4);104// string105testWarn(`106function f() {107 return108 "foo";109}110`, 4, 4);111testWarn(`112function f() {113 return114 "use struct";115}116`, 4, 4);117testWarn(`118function f() {119 return120 'foo';121}122`, 4, 4);123// template string124testWarn(`125function f() {126 return127 \`foo\${1 + 2}\`;128}129`, 4, 4);130testWarn(`131function f() {132 return133 \`foo\`;134}135`, 4, 4);136// RegExp137testWarn(`138function f() {139 return140 /foo/;141}142`, 4, 4);143// boolean144testWarn(`145function f() {146 return147 true;148}149`, 4, 4);150testWarn(`151function f() {152 return153 false;154}155`, 4, 4);156// null157testWarn(`158function f() {159 return160 null;161}162`, 4, 4);163// this164testWarn(`165function f() {166 return167 this;168}169`, 4, 4);170// new171testWarn(`172function f() {173 return174 new Array();175}176`, 4, 4);177// delete178testWarn(`179function f() {180 var a = {x: 10};181 return182 delete a.x;183}184`, 5, 4);185// yield186testWarn(`187function* f() {188 return189 yield 1;190}191`, 4, 4);192// class193testWarn(`194function f() {195 return196 class A { constructor() {} };197}198`, 4, 4);199// unary expression200testWarn(`201function f() {202 return203 +1;204}205`, 4, 4);206testWarn(`207function f() {208 return209 -1;210}211`, 4, 4);212testWarn(`213function f() {214 return215 !1;216}217`, 4, 4);218testWarn(`219function f() {220 return221 ~1;222}223`, 4, 4);224// eof225testPass(`226var f = new Function("return\\n");227`);228// empty statement229testPass(`230function f() {231 return;232 ; // empty statement233}234`);235// end of block236testPass(`237function f() {238 {239 return240 }241}242`);243// function (hosted)244testPass(`245function f() {246 g();247 return248 function g() {}249}250`);251// if252testWarn(`253function f() {254 return255 if (true)256 1 + 2;257}258`, 4, 2);259// else260testPass(`261function f() {262 if (true)263 return264 else265 1 + 2;266}267`);268// switch269testWarn(`270function f() {271 return272 switch (1) {273 case 1:274 break;275 }276}277`, 4, 2);278// return in switch279testWarn(`280function f() {281 switch (1) {282 case 1:283 return;284 1 + 2;285 break;286 }287}288`, 6, 6);289// break in switch290testPass(`291function f() {292 switch (1) {293 case 1:294 return;295 break;296 }297}298`);299// case300testPass(`301function f() {302 switch (1) {303 case 0:304 return305 case 1:306 break;307 }308}309`);310// default311testPass(`312function f() {313 switch (1) {314 case 0:315 return316 default:317 break;318 }319}320`);321// while322testWarn(`323function f() {324 return325 while (false)326 1 + 2;327}328`, 4, 2);329testPass(`330function f() {331 do332 return333 while (false);334}335`);336// do337testWarn(`338function f() {339 return340 do {341 1 + 2;342 } while (false);343}344`, 4, 2);345// for346testWarn(`347function f() {348 return349 for (;;) {350 break;351 }352}353`, 4, 2);354// break in for355testPass(`356function f() {357 for (;;) {358 return359 break;360 }361}362`, 5, 4);363// continue364testWarn(`365function f() {366 for (;;) {367 return368 continue;369 }370}371`, 5, 4);372// var (hosted)373testPass(`374function f() {375 return376 var a = 1;377}378`);379// const380testWarn(`381function f() {382 return383 const a = 1;384}385`, 4, 2);386// with387testWarn(`388function f() {389 return390 with ({}) {391 1;392 }393}394`, 4, 2);395// return396testWarn(`397function f() {398 return399 return;400}401`, 4, 2);402// try403testWarn(`404function f() {405 return406 try {407 } catch (e) {408 }409}410`, 4, 2);411// throw412testPass(`413function f() {414 return415 throw 1;416}417`);418// debugger419testWarn(`420function f() {421 return422 debugger;423}424`, 4, 2);425// let426testWarn(`427function f() {428 return429 let a = 1;430}431`, 4, 2);432// skip hoisted433testWarn(`434function f() {435 return436 var a = 0;437 (1 + 2);438}439`, 5, 2);440testWarn(`441function f() {442 return443 function f() {}444 var a = 0;445 (1 + 2);446}...
fetchWeatherWarning.js
Source:fetchWeatherWarning.js
1import { Meteor } from 'meteor/meteor';2import { http } from 'http';3import stringHelper from 'string';4export default function () {5 const warnHtmlSources = Meteor.settings.private.WEATHER_WARNING_URL;6 // const warnHtmlSources = Meteor.settings.private.WEATHER_WARNING_URL_TEST;7 let warnHtmlObject;8 let warnHtmlString = '';9 let warnHelpStr = '';10 let warnId = '';11 let warnIduri = '';12 let warnLength = 0;13 let strCurrWarnId = '';14 let strNextWarnId = '';15 let intCurrWarnId = 0;16 let intNextWarnId = 0;17 warnHtmlObject = stringHelper(Meteor.http.call('GET', warnHtmlSources).content);18 warnHtmlString = warnHtmlObject.toString();19 warnHelpStr = warnHtmlString.substring(warnHtmlString.indexOf('<!--Warning Codes') + 17);20 warnId = warnHelpStr.substr(0, warnHelpStr.indexOf('-->')).trim();21 if (warnId === 'NaN' || warnId === '' || warnId === null) {22 warnIduri = '0';23 } else {24 warnIduri = encodeURI(warnId);25 }26 let i = warnIduri.indexOf('%0A');27 if (i > -1) {28 strCurrWarnId = warnIduri.substr(0, warnIduri.indexOf('%0A')).trim();29 } else {30 strCurrWarnId = warnIduri;31 }32 intCurrWarnId = parseInt(strCurrWarnId, 10);33 if (intCurrWarnId > 11 || intCurrWarnId === 0) {34 intCurrWarnId = 0;35 }36 try {37 while (i >= 0) {38 intNextWarnId = parseInt(warnIduri.substr(warnIduri.indexOf('%0A') + 3).trim(), 10);39 // If the current warning code is within the warning range40 if (intCurrWarnId > 0) {41 // HKO warning code grouping - ref: http://www.hko.gov.hk/textonly/v2/explain/intro.htm42 // Check if current warning code is T8, T9 or T1043 if (intCurrWarnId > 2 && intCurrWarnId < 9) {44 intCurrWarnId = intCurrWarnId;45 // Check if next warning code if it is T8, T9 or T1046 } else if (intNextWarnId > 2 && intNextWarnId < 9) {47 intCurrWarnId = intNextWarnId;48 // Check if current warning code is black rain49 } else if (intCurrWarnId === 11) {50 intCurrWarnId = intCurrWarnId;51 // Check if next warning code is black rain52 } else if (intNextWarnId === 11) {53 intCurrWarnId = intNextWarnId;54 // Check if current warning code is T355 } else if (intCurrWarnId === 2) {56 intCurrWarnId = intCurrWarnId;57 // Check if next warning code is T358 } else if (intNextWarnId === 2) {59 intCurrWarnId = intNextWarnId;60 // Check if current warning code is red or yellow rain61 } else if (intCurrWarnId === 9 || intCurrWarnId === 10) {62 intCurrWarnId = intCurrWarnId;63 // Check if next warning code is red or yellow rain64 } else if (intNextWarnId === 9 || intNextWarnId === 10) {65 intCurrWarnId = intNextWarnId;66 } else {67 // No warning code in red or yellow rain68 // current warning code is T169 intCurrWarnId = 1;70 }71 // Check if next warning code is within the warning range72 } else if (intNextWarnId > 0 && intNextWarnId < 12) {73 intCurrWarnId = intNextWarnId;74 } else {75 // If both current and next warning code out of warning range disable the warning code76 intCurrWarnId = 0;77 }78 strNextWarnId = intNextWarnId.toString();79 warnLength = warnIduri.indexOf(strNextWarnId) + strNextWarnId.length;80 warnIduri = warnIduri.substr(warnLength);81 if (warnIduri.trim() !== '') {82 i = warnIduri.indexOf('%0A');83 } else {84 i = -1;85 }86 }87 let weatherWarningId = intCurrWarnId;88 return weatherWarningId;89 } catch (e) {90 // TODO Logging91 console.log(e);92 }...
warnAction.js
Source:warnAction.js
1/**2 * @file warnAction command3 * @author Kara4 * @license GPL-3.05 */6exports.exec = async (Bastion, message, args) => {7 if (Object.keys(args).length === 0) {8 return Bastion.emit('commandUsage', message, this.help);9 }10 let guildModel = await message.client.database.models.guild.findOne({11 attributes: [ 'warnAction' ],12 where: {13 guildID: message.guild.id14 }15 });16 let warnAction = '', color = Bastion.colors.GREEN, description;17 if (args.kick) {18 warnAction = 'kick';19 }20 else if (args.softban) {21 warnAction = 'softban';22 }23 else if (args.ban) {24 warnAction = 'ban';25 }26 if (guildModel.dataValues.warnAction === warnAction) {27 color = Bastion.colors.RED;28 description = `Warn action is already set to ${warnAction ? warnAction : 'none'}.`;29 }30 else {31 await message.client.database.models.guild.update({32 warnAction: warnAction33 },34 {35 where: {36 guildID: message.guild.id37 },38 fields: [ 'warnAction' ]39 });40 description = `Warn action is now set to ${warnAction}.`;41 }42 await message.channel.send({43 embed: {44 color: color,45 description: description46 }47 }).catch(e => {48 Bastion.log.error(e);49 });50};51exports.config = {52 aliases: [],53 enabled: true,54 argsDefinitions: [55 { name: 'kick', type: Boolean, alias: 'k' },56 { name: 'softban', type: Boolean, alias: 's' },57 { name: 'ban', type: Boolean, alias: 'b' },58 { name: 'none', type: Boolean, alias: 'n' }59 ]60};61exports.help = {62 name: 'warnAction',63 description: 'Sets the warn action for the server.',64 botPermission: '',65 userTextPermission: 'BAN_MEMBERS',66 userVoicePermission: '',67 usage: 'warnAction < --kick | --softban | --ban | --none >',68 example: [ 'warnAction --kick', 'warnAction --none' ]...
warn.js
Source:warn.js
...19 }20}21handler.help = ['warn @mention']22handler.tags = ['owner']23handler.command = /^warn(user)?$/i24handler.mods = true...
Using AI Code Generation
1var differencify = require('differencify');2differencify.init({3});4var differencify = require('differencify');5differencify.init({6});7var differencify = require('differencify');8differencify.init({9});10var differencify = require('differencify');11differencify.init({12});13var differencify = require('differencify');14differencify.init({15});16var differencify = require('differencify');17differencify.init({18});19var differencify = require('differencify');20differencify.init({21});22var differencify = require('differencify');23differencify.init({24});25var differencify = require('differencify');26differencify.init({27});28var differencify = require('differencify');29differencify.init({30});31var differencify = require('differencify');32differencify.init({33});34var differencify = require('differencify');35differencify.init({36});37var differencify = require('differencify');38differencify.init({39});40var differencify = require('
Using AI Code Generation
1var differencify = require('differencify');2var warn = differencify.warn;3warn('this is a warning');4var differencify = require('differencify');5var error = differencify.error;6error('this is an error');
Using AI Code Generation
1var differencify = require('differencify');2var differencifyConfig = {3};4var diff = differencify.init(differencifyConfig);5var differencify = require('differencify');6var differencifyConfig = {7};8var diff = differencify.init(differencifyConfig);9var differencify = require('differencify');10var diff = differencify.init();11var differencify = require('differencify');12var differencifyConfig = {13};14var diff = differencify.init(differencifyConfig);15diff.setConfig({16});17var differencify = require('differencify');18var differencifyConfig = {19};20var diff = differencify.init(differencifyConfig);21diff.setConfig({22});23var differencify = require('differencify');24var differencifyConfig = {25};26var diff = differencify.init(differencifyConfig);27diff.setConfig({28});29var differencify = require('differencify');30var differencifyConfig = {31};32var diff = differencify.init(differencifyConfig);33diff.setConfig({34});35var differencify = require('differencify');36var differencifyConfig = {37};38var diff = differencify.init(differencifyConfig);39diff.setConfig();40var differencify = require('differencify');41var differencifyConfig = {42};
Using AI Code Generation
1const differencify = require('differencify');2const differencify = require('differencify').init({ autoSaveBaseline: true });3differencify.setup({ autoSaveBaseline: true });4differencify.setup({ autoSaveBaseline: false });5differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true });6differencify.setup({ autoSaveBaseline: true, autoSaveDiff: false });7differencify.setup({ autoSaveBaseline: false, autoSaveDiff: true });8differencify.setup({ autoSaveBaseline: false, autoSaveDiff: false });9differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true, autoSaveSuccess: true });10differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true, autoSaveSuccess: false });11differencify.setup({ autoSaveBaseline: true, autoSaveDiff: false, autoSaveSuccess: true });12differencify.setup({ autoSaveBaseline: true, autoSaveDiff: false, autoSaveSuccess: false });13differencify.setup({ autoSaveBaseline: false, autoSaveDiff: true, autoSaveSuccess: true });14differencify.setup({ autoSaveBaseline: false, autoSaveDiff: true, autoSaveSuccess: false });15differencify.setup({ autoSaveBaseline: false, autoSaveDiff: false, autoSaveSuccess: true });16differencify.setup({ autoSaveBaseline: false, autoSaveDiff: false, autoSaveSuccess: false });17differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true, autoSaveSuccess: true, savePerInstance: true });18differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true, autoSaveSuccess: true, savePerInstance: false });19differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true, autoSaveSuccess: false, savePerInstance: true });20differencify.setup({ autoSaveBaseline: true, autoSaveDiff: true, autoSaveSuccess: false, savePerInstance: false });21differencify.setup({ autoSaveBaseline: true, autoSaveDiff: false, autoSaveSuccess: true, savePerInstance: true });22differencify.setup({ autoSaveBaseline: true, autoSaveDiff: false, autoSaveSuccess: true, savePerInstance:
Using AI Code Generation
1var differencify = require('differencify');2var differencifyConfig = {3};4differencify.init(differencifyConfig);5var differencify = require('differencify');6var differencifyConfig = {7};8differencify.init(differencifyConfig);9var differencify = require('differencify');10var differencifyConfig = {11};12differencify.init(differencifyConfig);13var differencify = require('differencify');14var differencifyConfig = {15};16differencify.init(differencifyConfig);17var differencify = require('differencify');18var differencifyConfig = {19};20differencify.init(differencifyConfig);21var differencify = require('differencify');22var differencifyConfig = {23};24differencify.init(differencifyConfig);25var differencify = require('differencify');26var differencifyConfig = {27};28differencify.init(differencifyConfig);29var differencify = require('differencify');30var differencifyConfig = {31};32differencify.init(differencifyConfig);
Using AI Code Generation
1const differencify = require("differencify");2differencify.init({autoSaveBaseline: true});3describe("Test", () => {4 it("should warn", () => {5 browser.saveFullPageScreen("google");6 browser.warn("google", 0.1);7 });8});9{10 "scripts": {11 },12 "devDependencies": {13 }14}15exports.config = {16 {17 },18 mochaOpts: {19 },20 before: function () {21 browser.setWindowSize(1440, 900);22 },23};
Using AI Code Generation
1const differencify = require('differencify');2const expect = differencify.expect;3const config = { threshold: 0.01, cleanup: true };4const init = differencify.init;5const setConfig = differencify.setConfig;6describe('Google', () => {7 before(async () => {8 await init(config);9 });10 it('should work', async () => {11 await page.waitFor(1000);12 const image = await page.screenshot();13 await expect(image).to.matchImage('google');14 });15});16const differencify = require('differencify');17const expect = differencify.expect;18const config = { threshold: 0.01, cleanup: true };19const init = differencify.init;20const setConfig = differencify.setConfig;21describe('Google', () => {22 before(async () => {23 await init(config);24 });25 it('should work', async () => {26 await page.waitFor(1000);27 const image = await page.screenshot();28 await expect(image).to.matchImage('google');29 });30});31const differencify = require('differencify');32const expect = differencify.expect;33const config = { threshold: 0.01, cleanup: true };34const init = differencify.init;35const setConfig = differencify.setConfig;36describe('Google', () => {37 before(async () => {38 await init(config);39 });40 it('should work', async () => {41 await page.waitFor(1000);42 const image = await page.screenshot();43 await expect(image).to.matchImage('google');44 });45});46const differencify = require('differencify');47const expect = differencify.expect;48const config = { threshold: 0.01, cleanup: true };49const init = differencify.init;50const setConfig = differencify.setConfig;51describe('Google', () => {52 before(async () => {53 await init(config);54 });55 it('should work', async () => {
Using AI Code Generation
1const differencify = require('differencify')2const { expect } = require('chai')3describe('Using differencify', () => {4 it('should show a warning', () => {5 expect(true).to.be.true6 differencify.warn('This is a warning')7 })8})9{10 "scripts": {11 },12 "devDependencies": {13 }14}151 passing (4ms)
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!