Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting: Update linter to enforce ES 2018 features #25470

Merged
merged 4 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"root": true,
"env": {
"browser": true,
"node": true,
"es2018": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": [
"mdcs",
"plugin:compat/recommended"
],
"plugins": [
"html",
"import"
],
"settings": {
"polyfills": [
"WebGL2RenderingContext"
]
},
"globals": {
"__THREE_DEVTOOLS__": "readonly",
"potpack": "readonly",
"fflate": "readonly",
"OIMO": "readonly",
"Stats": "readonly",
"XRWebGLBinding": "readonly",
"XRWebGLLayer": "readonly",
"GPUShaderStage": "readonly",
"GPUBufferUsage": "readonly",
"GPUTextureUsage": "readonly",
"GPUMapMode": "readonly",
"QUnit": "readonly",
"Ammo": "readonly",
"XRRigidTransform": "readonly",
"XRMediaBinding": "readonly",
"CodeMirror": "readonly",
"esprima": "readonly",
"jsonlint": "readonly"
},
"rules": {
"no-throw-literal": [
"error"
],
"quotes": [
"error",
"single"
],
"prefer-const": [
"error",
{
"destructuring": "any",
"ignoreReadBeforeAssign": false
}
]
}
}
52 changes: 0 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,58 +38,6 @@
"example": "examples",
"test": "test"
},
"eslintConfig": {
"root": true,
"extends": [
"mdcs",
"plugin:compat/recommended"
],
"plugins": [
"html",
"import"
],
"settings": {
"polyfills": [
"WebGL2RenderingContext"
]
},
"globals": {
"__THREE_DEVTOOLS__": "readonly",
"potpack": "readonly",
"fflate": "readonly",
"OIMO": "readonly",
"Stats": "readonly",
"XRWebGLBinding": "readonly",
"XRWebGLLayer": "readonly",
"GPUShaderStage": "readonly",
"GPUBufferUsage": "readonly",
"GPUTextureUsage": "readonly",
"GPUMapMode": "readonly",
"QUnit": "readonly",
"Ammo": "readonly",
"XRRigidTransform": "readonly",
"XRMediaBinding": "readonly",
"CodeMirror": "readonly",
"esprima": "readonly",
"jsonlint": "readonly"
},
"rules": {
"no-throw-literal": [
"error"
],
"quotes": [
"error",
"single"
],
"prefer-const": [
"error",
{
"destructuring": "any",
"ignoreReadBeforeAssign": false
}
]
}
},
"browserslist": [
"> 1%, not dead, not ie 11, not op_mini all"
],
Expand Down
6 changes: 3 additions & 3 deletions src/Three.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export { BooleanKeyframeTrack } from './animation/tracks/BooleanKeyframeTrack.js
export { PropertyMixer } from './animation/PropertyMixer.js';
export { PropertyBinding } from './animation/PropertyBinding.js';
export { KeyframeTrack } from './animation/KeyframeTrack.js';
export * as AnimationUtils from './animation/AnimationUtils.js';
export { AnimationUtils } from './animation/AnimationUtils.js';
export { AnimationObjectGroup } from './animation/AnimationObjectGroup.js';
export { AnimationMixer } from './animation/AnimationMixer.js';
export { AnimationClip } from './animation/AnimationClip.js';
Expand All @@ -111,7 +111,7 @@ export { DiscreteInterpolant } from './math/interpolants/DiscreteInterpolant.js'
export { CubicInterpolant } from './math/interpolants/CubicInterpolant.js';
export { Interpolant } from './math/Interpolant.js';
export { Triangle } from './math/Triangle.js';
export * as MathUtils from './math/MathUtils.js';
export { MathUtils } from './math/MathUtils.js';
export { Spherical } from './math/Spherical.js';
export { Cylindrical } from './math/Cylindrical.js';
export { Plane } from './math/Plane.js';
Expand Down Expand Up @@ -150,7 +150,7 @@ export { Path } from './extras/core/Path.js';
export { ShapePath } from './extras/core/ShapePath.js';
export { CurvePath } from './extras/core/CurvePath.js';
export { Curve } from './extras/core/Curve.js';
export * as DataUtils from './extras/DataUtils.js';
export { DataUtils } from './extras/DataUtils.js';
export { ImageUtils } from './extras/ImageUtils.js';
export { ShapeUtils } from './extras/ShapeUtils.js';
export { PMREMGenerator } from './extras/PMREMGenerator.js';
Expand Down
14 changes: 13 additions & 1 deletion src/animation/AnimationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,17 @@ function makeClipAdditive( targetClip, referenceFrame = 0, referenceClip = targe

}

const AnimationUtils = {
arraySlice: arraySlice,
convertArray: convertArray,
isTypedArray: isTypedArray,
getKeyframeOrder: getKeyframeOrder,
sortedArray: sortedArray,
flattenJSON: flattenJSON,
subclip: subclip,
makeClipAdditive: makeClipAdditive
};

export {
arraySlice,
convertArray,
Expand All @@ -357,5 +368,6 @@ export {
sortedArray,
flattenJSON,
subclip,
makeClipAdditive
makeClipAdditive,
AnimationUtils
};
8 changes: 7 additions & 1 deletion src/extras/DataUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,13 @@ function fromHalfFloat( val ) {

}

const DataUtils = {
toHalfFloat: toHalfFloat,
fromHalfFloat: fromHalfFloat,
};

export {
toHalfFloat,
fromHalfFloat
fromHalfFloat,
DataUtils
};
28 changes: 27 additions & 1 deletion src/math/MathUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,32 @@ function normalize( value, array ) {

}


const MathUtils = {
DEG2RAD: DEG2RAD,
RAD2DEG: RAD2DEG,
generateUUID: generateUUID,
clamp: clamp,
euclideanModulo: euclideanModulo,
mapLinear: mapLinear,
epreston marked this conversation as resolved.
Show resolved Hide resolved
inverseLerp: inverseLerp,
lerp: lerp,
damp: damp,
pingpong: pingpong,
smoothstep: smoothstep,
smootherstep: smootherstep,
randInt: randInt,
randFloat: randFloat,
randFloatSpread: randFloatSpread,
seededRandom: seededRandom,
degToRad: degToRad,
radToDeg: radToDeg,
isPowerOfTwo: isPowerOfTwo,
ceilPowerOfTwo: ceilPowerOfTwo,
floorPowerOfTwo: floorPowerOfTwo,
setQuaternionFromProperEuler: setQuaternionFromProperEuler,
normalize: normalize,
denormalize: denormalize
};
epreston marked this conversation as resolved.
Show resolved Hide resolved

export {
DEG2RAD,
Expand All @@ -318,4 +343,5 @@ export {
setQuaternionFromProperEuler,
normalize,
denormalize,
MathUtils
};