未验证 提交 3c60484c 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #20827 from gkjohnson/lint-update

Linting: Add rule to consistently use single quotes and fix files
......@@ -27,6 +27,7 @@
"test": "test"
},
"eslintConfig": {
"root": true,
"parser": "@typescript-eslint/parser",
"extends": "mdcs",
"plugins": [
......@@ -44,6 +45,10 @@
"SwitchCase": 1
}
],
"quotes": [
"error",
"single"
],
"prefer-const": [
"error",
{
......
......@@ -583,7 +583,7 @@ Object.assign( Matrix3.prototype, {
flattenToArrayOffset: function ( array, offset ) {
console.warn( "THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
console.warn( 'THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.' );
return this.toArray( array, offset );
},
......@@ -628,7 +628,7 @@ Object.assign( Matrix4.prototype, {
},
flattenToArrayOffset: function ( array, offset ) {
console.warn( "THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead." );
console.warn( 'THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.' );
return this.toArray( array, offset );
},
......@@ -1118,8 +1118,8 @@ Object.defineProperty( Curve.prototype, '__arcLengthDivisions', {
PerspectiveCamera.prototype.setLens = function ( focalLength, filmGauge ) {
console.warn( "THREE.PerspectiveCamera.setLens is deprecated. " +
"Use .setFocalLength and .filmGauge for a photographic setup." );
console.warn( 'THREE.PerspectiveCamera.setLens is deprecated. ' +
'Use .setFocalLength and .filmGauge for a photographic setup.' );
if ( filmGauge !== undefined ) this.filmGauge = filmGauge;
this.setFocalLength( focalLength );
......
......@@ -125,8 +125,8 @@ Object.assign( KeyframeTrack.prototype, {
if ( factoryMethod === undefined ) {
const message = "unsupported interpolation for " +
this.ValueTypeName + " keyframe track named " + this.name;
const message = 'unsupported interpolation for ' +
this.ValueTypeName + ' keyframe track named ' + this.name;
if ( this.createInterpolant === undefined ) {
......
......@@ -188,7 +188,7 @@ Object.assign( PropertyBinding, {
findNode: function ( root, nodeName ) {
if ( ! nodeName || nodeName === "" || nodeName === "." || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
if ( ! nodeName || nodeName === '' || nodeName === '.' || nodeName === - 1 || nodeName === root.name || nodeName === root.uuid ) {
return root;
......@@ -591,7 +591,7 @@ Object.assign( PropertyBinding.prototype, { // prototype, continued
// access a sub element of the property array (only primitives are supported right now)
if ( propertyName === "morphTargetInfluences" ) {
if ( propertyName === 'morphTargetInfluences' ) {
// potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer.
......
......@@ -196,5 +196,5 @@ export const StaticCopyUsage = 35046;
export const DynamicCopyUsage = 35050;
export const StreamCopyUsage = 35042;
export const GLSL1 = "100";
export const GLSL3 = "300 es";
export const GLSL1 = '100';
export const GLSL3 = '300 es';
......@@ -315,7 +315,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( object === this ) {
console.error( "THREE.Object3D.add: object can't be added as a child of itself.", object );
console.error( 'THREE.Object3D.add: object can\'t be added as a child of itself.', object );
return this;
}
......@@ -335,7 +335,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
} else {
console.error( "THREE.Object3D.add: object not an instance of THREE.Object3D.", object );
console.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );
}
......
......@@ -175,7 +175,7 @@ class ExtrudeBufferGeometry extends BufferGeometry {
function scalePt2( pt, vec, size ) {
if ( ! vec ) console.error( "THREE.ExtrudeGeometry: vec does not exist" );
if ( ! vec ) console.error( 'THREE.ExtrudeGeometry: vec does not exist' );
return vec.clone().multiplyScalar( size ).add( pt );
......
......@@ -96,7 +96,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( newValue === undefined ) {
console.warn( "THREE.Material: '" + key + "' parameter is undefined." );
console.warn( 'THREE.Material: \'' + key + '\' parameter is undefined.' );
continue;
}
......@@ -114,7 +114,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( currentValue === undefined ) {
console.warn( "THREE." + this.type + ": '" + key + "' is not a property of this material." );
console.warn( 'THREE.' + this.type + ': \'' + key + '\' is not a property of this material.' );
continue;
}
......
......@@ -37,7 +37,7 @@ import { WebGLTextures } from './webgl/WebGLTextures.js';
import { WebGLUniforms } from './webgl/WebGLUniforms.js';
import { WebGLUtils } from './webgl/WebGLUtils.js';
import { WebXRManager } from './webxr/WebXRManager.js';
import { WebGLMaterials } from "./webgl/WebGLMaterials.js";
import { WebGLMaterials } from './webgl/WebGLMaterials.js';
function createCanvasElement() {
......
// Renderers / WebGL /////////////////////////////////////////////////////////////////////
import { WebGLExtensions } from "./WebGLExtensions";
import { WebGLInfo } from "./WebGLInfo";
import { WebGLCapabilities } from "./WebGLCapabilities";
import { WebGLExtensions } from './WebGLExtensions';
import { WebGLInfo } from './WebGLInfo';
import { WebGLCapabilities } from './WebGLCapabilities';
export class WebGLBufferRenderer {
......
......@@ -257,19 +257,19 @@ function loopReplacer( match, start, end, snippet ) {
function generatePrecision( parameters ) {
let precisionstring = "precision " + parameters.precision + " float;\nprecision " + parameters.precision + " int;";
let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;';
if ( parameters.precision === "highp" ) {
if ( parameters.precision === 'highp' ) {
precisionstring += "\n#define HIGH_PRECISION";
precisionstring += '\n#define HIGH_PRECISION';
} else if ( parameters.precision === "mediump" ) {
} else if ( parameters.precision === 'mediump' ) {
precisionstring += "\n#define MEDIUM_PRECISION";
precisionstring += '\n#define MEDIUM_PRECISION';
} else if ( parameters.precision === "lowp" ) {
} else if ( parameters.precision === 'lowp' ) {
precisionstring += "\n#define LOW_PRECISION";
precisionstring += '\n#define LOW_PRECISION';
}
......@@ -399,7 +399,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
const program = gl.createProgram();
let prefixVertex, prefixFragment;
let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + "\n" : '';
let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
if ( parameters.isRawShaderMaterial ) {
......
......@@ -34,19 +34,19 @@ function WebGLPrograms( renderer, cubemaps, extensions, capabilities, bindingSta
};
const parameterNames = [
"precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "instancingColor",
"map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV",
"lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "displacementMap", "specularMap",
"roughnessMap", "metalnessMap", "gradientMap",
"alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2",
"flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning",
"maxBones", "useVertexTexture", "morphTargets", "morphNormals",
"maxMorphTargets", "maxMorphNormals", "premultipliedAlpha",
"numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights",
"numDirLightShadows", "numPointLightShadows", "numSpotLightShadows",
"shadowMapEnabled", "shadowMapType", "toneMapping", 'physicallyCorrectLights',
"alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering",
"sheen", "transmissionMap"
'precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor',
'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV',
'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap', 'objectSpaceNormalMap', 'tangentSpaceNormalMap', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap', 'displacementMap', 'specularMap',
'roughnessMap', 'metalnessMap', 'gradientMap',
'alphaMap', 'combine', 'vertexColors', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2',
'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning',
'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals',
'maxMorphTargets', 'maxMorphNormals', 'premultipliedAlpha',
'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights',
'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows',
'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights',
'alphaTest', 'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering',
'sheen', 'transmissionMap'
];
function getMaxBones( object ) {
......@@ -99,7 +99,7 @@ function WebGLPrograms( renderer, cubemaps, extensions, capabilities, bindingSta
} else if ( map.isWebGLRenderTarget ) {
console.warn( "THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead." );
console.warn( 'THREE.WebGLPrograms.getTextureEncodingFromMap: don\'t use render targets as textures. Use their .texture property instead.' );
encoding = map.texture.encoding;
}
......
......@@ -2,8 +2,8 @@ import { Scene } from './../../scenes/Scene';
import { Camera } from './../../cameras/Camera';
import { WebGLRenderer } from '../WebGLRenderer';
import { ShadowMapType } from '../../constants';
import { WebGLObjects } from "./WebGLObjects";
import { Light } from "../../lights/Light";
import { WebGLObjects } from './WebGLObjects';
import { Light } from '../../lights/Light';
export class WebGLShadowMap {
......
......@@ -53,7 +53,7 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
const fullScreenTri = new BufferGeometry();
fullScreenTri.setAttribute(
"position",
'position',
new BufferAttribute(
new Float32Array( [ - 1, - 1, 0.5, 3, - 1, 0.5, - 1, 3, 0.5 ] ),
3
......@@ -139,7 +139,7 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
const pars = { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat };
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";
shadow.map.texture.name = light.name + '.shadowMap';
shadow.mapPass = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
......@@ -152,7 +152,7 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
const pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat };
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";
shadow.map.texture.name = light.name + '.shadowMap';
shadow.camera.updateProjectionMatrix();
......
......@@ -21,7 +21,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
try {
useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined'
&& ( new OffscreenCanvas( 1, 1 ).getContext( "2d" ) ) !== null;
&& ( new OffscreenCanvas( 1, 1 ).getContext( '2d' ) ) !== null;
} catch ( err ) {
......@@ -1217,7 +1217,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if ( warnedTexture2D === false ) {
console.warn( "THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead." );
console.warn( 'THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.' );
warnedTexture2D = true;
}
......@@ -1236,7 +1236,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if ( warnedTextureCube === false ) {
console.warn( "THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead." );
console.warn( 'THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.' );
warnedTextureCube = true;
}
......
......@@ -171,7 +171,7 @@ Object.assign( WebXRController.prototype, {
hand.inputState.pinching = false;
this.dispatchEvent( {
type: "pinchend",
type: 'pinchend',
handedness: inputSource.handedness,
target: this
} );
......@@ -180,7 +180,7 @@ Object.assign( WebXRController.prototype, {
hand.inputState.pinching = true;
this.dispatchEvent( {
type: "pinchstart",
type: 'pinchstart',
handedness: inputSource.handedness,
target: this
} );
......
......@@ -326,7 +326,7 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
} );
Object.defineProperty( Texture.prototype, "needsUpdate", {
Object.defineProperty( Texture.prototype, 'needsUpdate', {
set: function ( value ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册