diff --git a/.eslintrc.json b/.eslintrc.json index f1687d38..e414b74d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -26,7 +26,9 @@ "max-len": "off", "no-console": "off", "no-extra-boolean-cast": "off", - "prefer-const": "error", + "prefer-const": ["error", { + "destructuring": "all" + }], "no-var": "error", "no-empty": "off", "no-fallthrough": "off", diff --git a/modules/math/basis.ts b/modules/math/basis.ts index d233001a..58dd68ab 100644 --- a/modules/math/basis.ts +++ b/modules/math/basis.ts @@ -13,14 +13,14 @@ export const STANDARD_BASES = Object.freeze({ }); export function BasisForPlane(normal: UnitVector, alignY: UnitVector = AXIS.Y, alignZ: UnitVector = AXIS.Z): [UnitVector, UnitVector, UnitVector] { - let alignPlane, x, y; + let alignPlane; if (Math.abs(normal.dot(alignY)) < 0.5) { alignPlane = normal.cross(alignY); } else { alignPlane = normal.cross(alignZ); } - y = alignPlane.cross(normal); - x = y.cross(normal); + const y = alignPlane.cross(normal); + const x = y.cross(normal); return [x, y, normal]; } diff --git a/modules/workbenches/modeler/features/extrude/extrude.operation.ts b/modules/workbenches/modeler/features/extrude/extrude.operation.ts index ae1d2aab..67192c6a 100644 --- a/modules/workbenches/modeler/features/extrude/extrude.operation.ts +++ b/modules/workbenches/modeler/features/extrude/extrude.operation.ts @@ -60,8 +60,6 @@ export const ExtrudeOperation: OperationDescriptor = { const sketchId = face.id; const sketch = ctx.sketchStorageService.readSketch(sketchId); - let sweepSources: FaceRef[]; - if (!sketch) { if (face instanceof MBrepFace) { oci.prism("FaceTool", face, ...extrusionVector.data()); @@ -78,7 +76,7 @@ export const ExtrudeOperation: OperationDescriptor = { csys.origin._minus(extrusionVector); extrusionVector._scale(2); } - sweepSources = occ.utils.sketchToFaces(sketch, csys) + const sweepSources = occ.utils.sketchToFaces(sketch, csys) const productionAnalyzer = new FromSketchProductionAnalyzer(sweepSources); diff --git a/modules/workbenches/modeler/features/revolve/revolve.operation.ts b/modules/workbenches/modeler/features/revolve/revolve.operation.ts index bb7df00d..7d9ea157 100644 --- a/modules/workbenches/modeler/features/revolve/revolve.operation.ts +++ b/modules/workbenches/modeler/features/revolve/revolve.operation.ts @@ -31,8 +31,6 @@ export const RevolveOperation: OperationDescriptor = { const sketchId = face.id; const sketch = ctx.sketchStorageService.readSketch(sketchId); - let sweepSources: FaceRef[]; - if (!sketch) { if (face instanceof MBrepFace) { const args = ["FaceTool", face, ...params.axis.origin.data(), ...params.axis.direction.data(), params.angle]; @@ -46,7 +44,7 @@ export const RevolveOperation: OperationDescriptor = { const csys = face.csys; - sweepSources = occ.utils.sketchToFaces(sketch, csys) + const sweepSources = occ.utils.sketchToFaces(sketch, csys) const productionAnalyzer = new FromSketchProductionAnalyzer(sweepSources);