diff --git a/packages/core/src/code-evaluation/rebuildGeometry.js b/packages/core/src/code-evaluation/rebuildGeometry.js index ae9bf6e5e..eeb7d8cc3 100644 --- a/packages/core/src/code-evaluation/rebuildGeometry.js +++ b/packages/core/src/code-evaluation/rebuildGeometry.js @@ -70,7 +70,7 @@ export const rebuildGeometry = (data, callback) => { lookupCounts: solidsData.lookupCounts }) } catch (error) { - callback({ + callback(null, { type: 'errors', name: error.name ? error.name : 'Error', message: error.message ? error.message : error.toString(), @@ -80,6 +80,6 @@ export const rebuildGeometry = (data, callback) => { lineNumber: error.lineNumber ? error.lineNumber : '', columnNumber: error.columnNumber ? error.columnNumber : '', stack: error.stack ? error.stack : '' - }, null) + }) } } diff --git a/packages/examples/core/offsets/offset.js b/packages/examples/core/offsets/offset.js index e4a41045d..f5f37f4ce 100644 --- a/packages/examples/core/offsets/offset.js +++ b/packages/examples/core/offsets/offset.js @@ -69,7 +69,7 @@ const main = () => { expandedGeom2Edge, expandedGeom2Chamfer, expandedGeom2Round, - contractedGeom2, + contractedGeom2 ]), translate([50, 10, 0], [ diff --git a/packages/io/3mf-deserializer/rollup.config.js b/packages/io/3mf-deserializer/rollup.config.js index 7e8d2b614..7c29ec1c0 100644 --- a/packages/io/3mf-deserializer/rollup.config.js +++ b/packages/io/3mf-deserializer/rollup.config.js @@ -24,6 +24,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/3mf-deserializer/src/index.js b/packages/io/3mf-deserializer/src/index.js index 88e915f0f..71c9abc4a 100644 --- a/packages/io/3mf-deserializer/src/index.js +++ b/packages/io/3mf-deserializer/src/index.js @@ -72,8 +72,6 @@ const deserialize = (options, input) => { return options.output === 'script' ? translateModels(options, models) : instantiateModels(options, models) } -const isBuffer = (obj) => (obj.byteLength !== undefined && typeof obj.slice === 'function') - const mimeType = 'model/3mf' export { diff --git a/packages/io/3mf-deserializer/src/model.js b/packages/io/3mf-deserializer/src/model.js index fb92dc9b3..cc1b19e60 100644 --- a/packages/io/3mf-deserializer/src/model.js +++ b/packages/io/3mf-deserializer/src/model.js @@ -16,8 +16,8 @@ export const parseModel = (options, source) => { // parse the 3MF contents (XML) const { objects, materials, colorgroups, items } = parse(source) if (objects.length === 0) { - throw new Error('3MF parsing failed, no valid 3MF objects retrieved') - } + throw new Error('3MF parsing failed, no valid 3MF objects retrieved') + } // get a list of objects to include in the results const buildItems = [] diff --git a/packages/io/3mf-deserializer/src/parse.js b/packages/io/3mf-deserializer/src/parse.js index c9113fe61..26a08dec9 100644 --- a/packages/io/3mf-deserializer/src/parse.js +++ b/packages/io/3mf-deserializer/src/parse.js @@ -160,11 +160,10 @@ const getProperty = (object, triangle) => { } const create3mfParser = (src, storage) => { - let { items, materials, colorgroups, objects } = storage + const { items, materials, colorgroups, objects } = storage let model = null let objLast = null // last object found - let objList = [] // create a parser for the XML const parser = new saxes.SaxesParser() @@ -272,10 +271,10 @@ const create3mfParser = (src, storage) => { } export const parse = (src) => { - let items = [] // build items list - let materials = [] // materials list - let colorgroups = [] // colorgroups list - let objects = [] // objects list + const items = [] // build items list + const materials = [] // materials list + const colorgroups = [] // colorgroups list + const objects = [] // objects list create3mfParser(src, { items, materials, colorgroups, objects }) return { items, materials, colorgroups, objects } diff --git a/packages/io/3mf-serializer/rollup.config.js b/packages/io/3mf-serializer/rollup.config.js index 4a6a88e02..bff0310ff 100644 --- a/packages/io/3mf-serializer/rollup.config.js +++ b/packages/io/3mf-serializer/rollup.config.js @@ -22,6 +22,6 @@ export default { commonjs(), nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/dxf-deserializer/rollup.config.js b/packages/io/dxf-deserializer/rollup.config.js index 9d5846366..d747a2643 100644 --- a/packages/io/dxf-deserializer/rollup.config.js +++ b/packages/io/dxf-deserializer/rollup.config.js @@ -22,6 +22,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/dxf-serializer/rollup.config.js b/packages/io/dxf-serializer/rollup.config.js index 601bc36ee..7e1f456dc 100644 --- a/packages/io/dxf-serializer/rollup.config.js +++ b/packages/io/dxf-serializer/rollup.config.js @@ -9,7 +9,7 @@ export default { { file: 'dist/jscad-dxf-serializer.min.js', format: 'umd', - name: 'jscadDxfSerializer', + name: 'jscadDxfSerializer' }, { file: 'dist/jscad-dxf-serializer.es.js', @@ -20,6 +20,6 @@ export default { plugins: [ nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/json-deserializer/rollup.config.js b/packages/io/json-deserializer/rollup.config.js index 765476caf..9ec100235 100644 --- a/packages/io/json-deserializer/rollup.config.js +++ b/packages/io/json-deserializer/rollup.config.js @@ -22,6 +22,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/json-serializer/rollup.config.js b/packages/io/json-serializer/rollup.config.js index 7435680a9..0a8470c71 100644 --- a/packages/io/json-serializer/rollup.config.js +++ b/packages/io/json-serializer/rollup.config.js @@ -20,6 +20,6 @@ export default { plugins: [ nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/obj-deserializer/rollup.config.js b/packages/io/obj-deserializer/rollup.config.js index ee20cab8d..ce20c5cc8 100644 --- a/packages/io/obj-deserializer/rollup.config.js +++ b/packages/io/obj-deserializer/rollup.config.js @@ -22,6 +22,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/obj-serializer/rollup.config.js b/packages/io/obj-serializer/rollup.config.js index 963d8a455..ace30811c 100644 --- a/packages/io/obj-serializer/rollup.config.js +++ b/packages/io/obj-serializer/rollup.config.js @@ -20,6 +20,6 @@ export default { plugins: [ nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/stl-deserializer/rollup.config.js b/packages/io/stl-deserializer/rollup.config.js index 2a6f64af1..9bff09974 100644 --- a/packages/io/stl-deserializer/rollup.config.js +++ b/packages/io/stl-deserializer/rollup.config.js @@ -22,6 +22,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/stl-deserializer/src/index.js b/packages/io/stl-deserializer/src/index.js index a253637c2..ab5da12a9 100644 --- a/packages/io/stl-deserializer/src/index.js +++ b/packages/io/stl-deserializer/src/index.js @@ -116,7 +116,7 @@ const formatAsJscad = (data, addMetaData, version, filename) => { // ` } - code += `import * from '@jscad/modeling'\n` + code += 'import * from \'@jscad/modeling\'\n' code += data.join('\n') code += ` export const main = () => { diff --git a/packages/io/stl-serializer/rollup.config.js b/packages/io/stl-serializer/rollup.config.js index f9df04df1..58836f048 100644 --- a/packages/io/stl-serializer/rollup.config.js +++ b/packages/io/stl-serializer/rollup.config.js @@ -20,6 +20,6 @@ export default { plugins: [ nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/svg-deserializer/rollup.config.js b/packages/io/svg-deserializer/rollup.config.js index 4038ca41b..4256a8588 100644 --- a/packages/io/svg-deserializer/rollup.config.js +++ b/packages/io/svg-deserializer/rollup.config.js @@ -24,6 +24,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/svg-deserializer/src/shapesMapGeometry.js b/packages/io/svg-deserializer/src/shapesMapGeometry.js index 9df721cce..ec884218e 100644 --- a/packages/io/svg-deserializer/src/shapesMapGeometry.js +++ b/packages/io/svg-deserializer/src/shapesMapGeometry.js @@ -185,8 +185,9 @@ const expandPath = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, svgGroups pc = false } const ensurePath = () => { - if (!paths[pathName]) paths[pathName] = - path2.fromPoints({}, []) + if (!paths[pathName]) { + paths[pathName] = path2.fromPoints({}, []) + } } for (let j = 0; j < obj.commands.length; j++) { const co = obj.commands[j] @@ -328,8 +329,8 @@ const expandPath = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, svgGroups qy = cy + parseFloat(pts[i++]) cx = cx + parseFloat(pts[i++]) cy = cy + parseFloat(pts[i++]) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] ensurePath() paths[pathName] = path2.appendBezier({ segments, @@ -351,8 +352,8 @@ const expandPath = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, svgGroups qy = parseFloat(pts[i++]) cx = parseFloat(pts[i++]) cy = parseFloat(pts[i++]) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] ensurePath() paths[pathName] = path2.appendBezier({ segments, @@ -372,8 +373,8 @@ const expandPath = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, svgGroups const p0 = [cx, cy] // previous point cx = cx + parseFloat(pts[i++]) cy = cy + parseFloat(pts[i++]) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] ensurePath() paths[pathName] = path2.appendBezier({ segments, @@ -393,8 +394,8 @@ const expandPath = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, svgGroups const p0 = [cx, cy] // previous point cx = parseFloat(pts[i++]) cy = parseFloat(pts[i++]) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] ensurePath() paths[pathName] = path2.appendBezier({ segments, @@ -419,7 +420,8 @@ const expandPath = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, svgGroups cy = cy + parseFloat(pts[i++]) ensurePath() paths[pathName] = path2.appendBezier({ - segments, controlPoints: [ + segments, + controlPoints: [ svg2cag([x1, y1], svgUnitsPmm), svg2cag([bx, by], svgUnitsPmm), svg2cag([cx, cy], svgUnitsPmm) diff --git a/packages/io/svg-deserializer/src/shapesMapJscad.js b/packages/io/svg-deserializer/src/shapesMapJscad.js index 5d0402744..7c199ef63 100644 --- a/packages/io/svg-deserializer/src/shapesMapJscad.js +++ b/packages/io/svg-deserializer/src/shapesMapJscad.js @@ -258,8 +258,8 @@ const path = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, params, svgGrou qy = cy + parseFloat(pts.shift()) cx = cx + parseFloat(pts.shift()) // end point cy = cy + parseFloat(pts.shift()) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] tmpCode += `${indent}${pathName} = path2.appendBezier({segments: ${segments}, controlPoints: [[${svg2cag(q1, svgUnitsPmm)}], [${svg2cag(q2, svgUnitsPmm)}], [${svg2cag([cx, cy], svgUnitsPmm)}]]}, ${pathName})\n` const rf = reflect(qx, qy, cx, cy) qx = rf[0] @@ -273,8 +273,8 @@ const path = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, params, svgGrou qy = parseFloat(pts.shift()) cx = parseFloat(pts.shift()) // end point cy = parseFloat(pts.shift()) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] tmpCode += `${indent}${pathName} = path2.appendBezier({segments: ${segments}, controlPoints: [[${svg2cag(q1, svgUnitsPmm)}], [${svg2cag(q2, svgUnitsPmm)}], [${svg2cag([cx, cy], svgUnitsPmm)}]]}, ${pathName})\n` const rf = reflect(qx, qy, cx, cy) qx = rf[0] @@ -286,8 +286,8 @@ const path = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, params, svgGrou const p0 = [cx, cy] // previous point cx = cx + parseFloat(pts.shift()) // end point cy = cy + parseFloat(pts.shift()) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] tmpCode += `${indent}${pathName} = path2.appendBezier({segments: ${segments}, controlPoints: [[[${svg2cag(q1, svgUnitsPmm)}], [${svg2cag(q2, svgUnitsPmm)}], [${svg2cag([cx, cy], svgUnitsPmm)}]]}, ${pathName})\n` const rf = reflect(qx, qy, cx, cy) qx = rf[0] @@ -299,8 +299,8 @@ const path = (obj, svgUnitsPmm, svgUnitsX, svgUnitsY, svgUnitsV, params, svgGrou const p0 = [cx, cy] // previous point cx = parseFloat(pts.shift()) // end point cy = parseFloat(pts.shift()) - const q1 = [p0[0] + (2/3) * (qx - p0[0]), p0[1] + (2/3) * (qy - p0[1])] - const q2 = [q1[0] + (1/3) * (cx - p0[0]), q1[1] + (1/3) * (cy - p0[1])] + const q1 = [p0[0] + (2 / 3) * (qx - p0[0]), p0[1] + (2 / 3) * (qy - p0[1])] + const q2 = [q1[0] + (1 / 3) * (cx - p0[0]), q1[1] + (1 / 3) * (cy - p0[1])] tmpCode += `${indent}${pathName} = path2.appendBezier({segments: ${segments}, controlPoints: [[[${svg2cag(q1, svgUnitsPmm)}], [${svg2cag(q2, svgUnitsPmm)}], [${svg2cag([cx, cy], svgUnitsPmm)}]]}, ${pathName})\n` const rf = reflect(qx, qy, cx, cy) qx = rf[0] diff --git a/packages/io/svg-serializer/rollup.config.js b/packages/io/svg-serializer/rollup.config.js index 1cb44be7a..d8e30ae46 100644 --- a/packages/io/svg-serializer/rollup.config.js +++ b/packages/io/svg-serializer/rollup.config.js @@ -22,6 +22,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/x3d-deserializer/rollup.config.js b/packages/io/x3d-deserializer/rollup.config.js index 8b615e945..ee0f908b8 100644 --- a/packages/io/x3d-deserializer/rollup.config.js +++ b/packages/io/x3d-deserializer/rollup.config.js @@ -24,6 +24,6 @@ export default { nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), versionInjector({ injectInComments: { fileRegexp: /\.(html)$/ }, logLevel: 'warn' }), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/io/x3d-deserializer/src/objects.js b/packages/io/x3d-deserializer/src/objects.js index de973b6a7..1c7c13970 100644 --- a/packages/io/x3d-deserializer/src/objects.js +++ b/packages/io/x3d-deserializer/src/objects.js @@ -1,4 +1,4 @@ -import { area, poly2 } from '@jscad/modeling' +import { area } from '@jscad/modeling' export const x3dTypes = { X3D: 0, diff --git a/packages/io/x3d-serializer/rollup.config.js b/packages/io/x3d-serializer/rollup.config.js index e798f422b..3322b3329 100644 --- a/packages/io/x3d-serializer/rollup.config.js +++ b/packages/io/x3d-serializer/rollup.config.js @@ -20,6 +20,6 @@ export default { plugins: [ nodeResolve(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/modeling/rollup.config.js b/packages/modeling/rollup.config.js index e1edd5d8d..8d1dea107 100644 --- a/packages/modeling/rollup.config.js +++ b/packages/modeling/rollup.config.js @@ -16,6 +16,6 @@ export default { ], plugins: [ banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/modeling/src/geometries/geom3/fromPointsConvex.test.js b/packages/modeling/src/geometries/geom3/fromPointsConvex.test.js index 546289977..8d5369bfd 100644 --- a/packages/modeling/src/geometries/geom3/fromPointsConvex.test.js +++ b/packages/modeling/src/geometries/geom3/fromPointsConvex.test.js @@ -3,26 +3,30 @@ import test from 'ava' import { fromPointsConvex, validate } from './index.js' test('fromPointsConvex (uniquePoints)', (t) => { - let out = [] - for(let x=-9;x<=9;++x) - for(let y=-9;y<=9;++y) - for(let z=-9;z<=9;++z) - if (x*x+y*y+z*z <= 96) - out.push([x,y,z]) + const out = [] + for (let x = -9; x <= 9; ++x) { + for (let y = -9; y <= 9; ++y) { + for (let z = -9; z <= 9; ++z) { + if (x * x + y * y + z * z <= 96) { + out.push([x, y, z]) + } + } + } + } - let obs = fromPointsConvex(out) + const obs = fromPointsConvex(out) validate(obs) t.is(obs.polygons.length, 170) - t.true(obs.polygons.every((f) => ([3,4,8,9].indexOf(f.vertices.length) !== -1))) + t.true(obs.polygons.every((f) => ([3, 4, 8, 9].indexOf(f.vertices.length) !== -1))) - let c = [0,0,0,0,0,0,0,0,0,0] + const c = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] obs.polygons.forEach((f) => c[f.vertices.length]++) - t.is(c[3], 120); - t.is(c[4], 24); - t.is(c[8], 18); - t.is(c[9], 8); + t.is(c[3], 120) + t.is(c[4], 24) + t.is(c[8], 18) + t.is(c[9], 8) - let edges2 = 336*2 - obs.polygons.forEach((f) => edges2 -= f.vertices.length) - t.is(edges2, 0); + let edges2 = 336 * 2 + obs.polygons.forEach((f) => { edges2 -= f.vertices.length }) + t.is(edges2, 0) }) diff --git a/packages/modeling/src/geometries/slice/validate.js b/packages/modeling/src/geometries/slice/validate.js index dc079691d..5cb1ff29f 100644 --- a/packages/modeling/src/geometries/slice/validate.js +++ b/packages/modeling/src/geometries/slice/validate.js @@ -28,10 +28,9 @@ export const validate = (object) => { // contours must be coplanar const contourPlane = poly3.plane(poly3.create(contour)) if (!plane.equals(slicePlane, contourPlane)) { - throw new Error(`slice contours must be coplanar`) + throw new Error('slice contours must be coplanar') } - for (let i = 0; i < contour.length; i++) { const vertex = contour[i] // check for infinity, nan diff --git a/packages/modeling/src/maths/mat4/isOnlyTransformScale.js b/packages/modeling/src/maths/mat4/isOnlyTransformScale.js index 7f3007bd6..4c9c7c87f 100644 --- a/packages/modeling/src/maths/mat4/isOnlyTransformScale.js +++ b/packages/modeling/src/maths/mat4/isOnlyTransformScale.js @@ -18,7 +18,7 @@ export const isOnlyTransformScale = (matrix) => ( ) /** - * @param {number} num + * @param {number} num * @returns {boolean} */ const isZero = (num) => Math.abs(num) < Number.EPSILON diff --git a/packages/modeling/src/operations/booleans/intersectGeom2.test.js b/packages/modeling/src/operations/booleans/intersectGeom2.test.js index f75fadf1e..53563d327 100644 --- a/packages/modeling/src/operations/booleans/intersectGeom2.test.js +++ b/packages/modeling/src/operations/booleans/intersectGeom2.test.js @@ -80,8 +80,8 @@ test('intersect with undefined/null values', (t) => { const square3 = square({ size: 4 }) const geometries = [square1, undefined, square2, null, square3] - let obs = intersect(...geometries) - let pts = geom2.toPoints(obs) + const obs = intersect(...geometries) + const pts = geom2.toPoints(obs) t.notThrows(() => geom2.validate(obs)) t.is(pts.length, 4) }) diff --git a/packages/modeling/src/operations/booleans/mayOverlap.js b/packages/modeling/src/operations/booleans/mayOverlap.js index 64e82fba5..ef06e2c01 100644 --- a/packages/modeling/src/operations/booleans/mayOverlap.js +++ b/packages/modeling/src/operations/booleans/mayOverlap.js @@ -2,7 +2,6 @@ import { EPS } from '../../maths/constants.js' import { measureBoundingBox } from '../../measurements/measureBoundingBox.js' - /* * Determine if the given geometries overlap by comparing min and max bounds. * NOTE: This is used in union for performance gains. diff --git a/packages/modeling/src/operations/booleans/subtractGeom2.test.js b/packages/modeling/src/operations/booleans/subtractGeom2.test.js index ab4e1b93c..5dbbc1161 100644 --- a/packages/modeling/src/operations/booleans/subtractGeom2.test.js +++ b/packages/modeling/src/operations/booleans/subtractGeom2.test.js @@ -82,8 +82,8 @@ test('subtract with undefined/null values', (t) => { const square3 = square({ size: 4 }) const geometries = [square1, undefined, square2, null, square3] - let obs = subtract(...geometries) - let pts = geom2.toPoints(obs) + const obs = subtract(...geometries) + const pts = geom2.toPoints(obs) t.notThrows(() => geom2.validate(obs)) t.is(pts.length, 8) }) diff --git a/packages/modeling/src/operations/booleans/unionGeom2.test.js b/packages/modeling/src/operations/booleans/unionGeom2.test.js index e428df539..493d442f7 100644 --- a/packages/modeling/src/operations/booleans/unionGeom2.test.js +++ b/packages/modeling/src/operations/booleans/unionGeom2.test.js @@ -216,8 +216,8 @@ test('union with undefined/null values', (t) => { const square3 = square({ size: 4 }) const geometries = [square1, undefined, square2, null, square3] - let obs = union(...geometries) - let pts = geom2.toPoints(obs) + const obs = union(...geometries) + const pts = geom2.toPoints(obs) t.notThrows(() => geom2.validate(obs)) t.is(pts.length, 4) }) diff --git a/packages/modeling/src/operations/hulls/hull.js b/packages/modeling/src/operations/hulls/hull.js index 380f74c85..0bb6ca76c 100644 --- a/packages/modeling/src/operations/hulls/hull.js +++ b/packages/modeling/src/operations/hulls/hull.js @@ -36,7 +36,6 @@ export const hull = (...geometries) => { geometries = coalesce(geometries) if (geometries.length === 0) return undefined - if (geometries.length === 1) geometries[0] if (!areAllShapesTheSameType(geometries)) { throw new Error('only hulls of the same type are supported') diff --git a/packages/modeling/src/operations/offsets/offsetFromPoints.test.js b/packages/modeling/src/operations/offsets/offsetFromPoints.test.js index 88b364f26..763c2edf4 100644 --- a/packages/modeling/src/operations/offsets/offsetFromPoints.test.js +++ b/packages/modeling/src/operations/offsets/offsetFromPoints.test.js @@ -200,7 +200,6 @@ test('offset (corners: edge): offset of a path2 produces expected offset path2', test('offset (corners: round): offset of a path2 produces expected offset path2', (t) => { const openline = [[-5, -5], [5, -5], [5, 5], [3, 5], [3, 0], [-3, 0], [-3, 5], [-5, 5]] - const closeline = [[-5, -5], [5, -5], [5, 5], [3, 5], [3, 0], [-3, 0], [-3, 5], [-5, 5], [-5, -5]] let pts = offsetFromPoints({ delta: 1, corners: 'round', segments: 16 }, openline) let obs = path2.create(pts) diff --git a/packages/modeling/src/operations/offsets/offsetGeom3.js b/packages/modeling/src/operations/offsets/offsetGeom3.js index 9c9a44115..11a404b7a 100644 --- a/packages/modeling/src/operations/offsets/offsetGeom3.js +++ b/packages/modeling/src/operations/offsets/offsetGeom3.js @@ -1,5 +1,3 @@ -import * as geom3 from '../../geometries/geom3/index.js' - import { union } from '../booleans/union.js' import { offsetShell } from './offsetShell.js' diff --git a/packages/modeling/src/operations/offsets/offsetPath2.js b/packages/modeling/src/operations/offsets/offsetPath2.js index 1e51e6027..55e07a6e7 100644 --- a/packages/modeling/src/operations/offsets/offsetPath2.js +++ b/packages/modeling/src/operations/offsets/offsetPath2.js @@ -85,9 +85,9 @@ export const offsetPath2 = (options, geometry) => { internal: offsetFromPoints({ delta: -delta, corners, segments, closed }, points) } - const output = geometry.isClosed ? - createGeometryFromClosedPath(paths) : - createGeometryFromOpenPath(paths, segments, corners, delta) + const output = geometry.isClosed + ? createGeometryFromClosedPath(paths) + : createGeometryFromOpenPath(paths, segments, corners, delta) if (geometry.color) output.color = geometry.color return output } diff --git a/packages/modeling/src/operations/transforms/center.test.js b/packages/modeling/src/operations/transforms/center.test.js index c97607705..358b7b8d5 100644 --- a/packages/modeling/src/operations/transforms/center.test.js +++ b/packages/modeling/src/operations/transforms/center.test.js @@ -4,7 +4,7 @@ import { comparePoints, comparePolygonsAsPoints } from '../../../test/helpers/in import { geom2, geom3, path2 } from '../../geometries/index.js' -import { measureArea, measureAggregateBoundingBox, measureCenter, measureVolume } from '../../measurements/index.js' +import { measureArea, measureAggregateBoundingBox, measureVolume } from '../../measurements/index.js' import { square } from '../../primitives/index.js' diff --git a/packages/modeling/src/primitives/polygon.js b/packages/modeling/src/primitives/polygon.js index c8cbf73c0..646894a8c 100644 --- a/packages/modeling/src/primitives/polygon.js +++ b/packages/modeling/src/primitives/polygon.js @@ -69,7 +69,7 @@ export const polygon = (options) => { }) let geometry = geom2.create(outlines) - if (orientation == "clockwise") { + if (orientation === 'clockwise') { geometry = geom2.reverse(geometry) } return geometry diff --git a/packages/modeling/src/primitives/polygon.test.js b/packages/modeling/src/primitives/polygon.test.js index 1d4e176be..582024c19 100644 --- a/packages/modeling/src/primitives/polygon.test.js +++ b/packages/modeling/src/primitives/polygon.test.js @@ -62,7 +62,7 @@ test('polygon: providing object.points (array) and object.path (array) creates e test('polygon: clockwise points', (t) => { const poly = polygon({ points: [[-10, -0], [-10, -10], [-15, -5]], - orientation: "clockwise", + orientation: 'clockwise' }) t.is(measureArea(poly), 25) }) diff --git a/packages/utils/array-utils/rollup.config.js b/packages/utils/array-utils/rollup.config.js index afc8647d0..8a660fff6 100644 --- a/packages/utils/array-utils/rollup.config.js +++ b/packages/utils/array-utils/rollup.config.js @@ -16,6 +16,6 @@ export default { ], plugins: [ banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] } diff --git a/packages/utils/regl-renderer/rollup.config.js b/packages/utils/regl-renderer/rollup.config.js index 89e195d42..65b8539af 100644 --- a/packages/utils/regl-renderer/rollup.config.js +++ b/packages/utils/regl-renderer/rollup.config.js @@ -22,6 +22,6 @@ export default { nodeResolve(), commonjs(), banner('<%= pkg.description %>\n@module <%= pkg.name %>\n@version <%= pkg.version %>\n@license <%= pkg.license %>'), - terser({ compress: { module: true }, mangle: false, format: { comments: 'some'} }) + terser({ compress: { module: true }, mangle: false, format: { comments: 'some' } }) ] }