no-extra-semi rule for TS / autofix

This commit is contained in:
Val Erastov 2022-08-15 19:51:24 -07:00
parent 5aaee1c8ed
commit b8d6b7c0ba
20 changed files with 115 additions and 115 deletions

View file

@ -31,7 +31,7 @@
"no-empty": "off",
"no-fallthrough": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": "error",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",

View file

@ -67,7 +67,7 @@ export class Loop extends TopoObject {
const first = polygon[nextIdx].minus(o);
const last = o.minus(polygon[prevIdx]);
return last.cross(first).dot(surface.normal) >= 0;
};
}
}
export function* enclosesGenerator(halfEdges): Generator<[HalfEdge, HalfEdge, Vertex]> {

View file

@ -63,7 +63,7 @@ export class Line {
tessellate(resolution, from, to, path) {
}
offset() {};
offset() {}
}
Line.prototype.isLine = true;

View file

@ -134,7 +134,7 @@ export class BrepSurface {
let X = intersectNurbs(this.impl, other.impl, this.inverted !== other.inverted);
// let X = surfaceIntersect(this.impl, other.impl);
return X.map(curve => new BrepCurve(curve));
};
}
invert() {
return new BrepSurface(this.impl, !this.inverted);

View file

@ -79,7 +79,7 @@ export default class NurbsSurface implements ParametricSurface {
static loft(curve1, curve2): NurbsSurface {
return new NurbsSurface(verb.geom.NurbsSurface.byLoftingCurves([curve1.impl.verb, curve2.impl.verb], 1));
};
}
transform(tr: Matrix3x4Data): ParametricSurface {
return new NurbsSurface(this.verb.transform(tr));

View file

@ -35,7 +35,7 @@ export class Matrix3x4 {
this.mzz = 1;
this.tz = 0;
return this;
};
}
setBasis(basis: [Vector, Vector, Vector]): Matrix3x4 {
let b = basis;
@ -52,7 +52,7 @@ export class Matrix3x4 {
this.mzz = b[2].z;
this.tz = 0;
return this;
};
}
setBasis3(basis: [Vec3, Vec3, Vec3]): Matrix3x4 {
const b = basis;
@ -69,7 +69,7 @@ export class Matrix3x4 {
this.mzz = b[2][2];
this.tz = 0;
return this;
};
}
setBasisAxises(x: Vector, y: Vector, z: Vector): Matrix3x4 {
this.mxx = x.x;
@ -85,7 +85,7 @@ export class Matrix3x4 {
this.mzz = z.z;
this.tz = 0;
return this;
};
}
setBasisAndTranslation(basis: [Vector, Vector, Vector], translation: Vector): Matrix3x4 {
this.setBasis(basis);
@ -93,7 +93,7 @@ export class Matrix3x4 {
this.ty = translation.y;
this.tz = translation.z;
return this;
};
}
setBasisAndTranslation3(basis: [Vec3, Vec3, Vec3], translation: Vec3): Matrix3x4 {
this.setBasis3(basis);
@ -101,7 +101,7 @@ export class Matrix3x4 {
this.ty = translation[1];
this.tz = translation[2];
return this;
};
}
getBasis3(): [Vec3, Vec3, Vec3] {
return [
@ -121,7 +121,7 @@ export class Matrix3x4 {
this.mzz
]
]
};
}
getTranslation3(): Vec3 {
return [this.tx, this.ty, this.tz];
@ -132,21 +132,21 @@ export class Matrix3x4 {
this.myy *= dy;
this.mzz *= dz;
return this;
};
}
translate(dx: number, dy: number, dz: number): Matrix3x4 {
this.tx += dx;
this.ty += dy;
this.tz += dz;
return this;
};
}
translateVec({x, y, z}: Vector): Matrix3x4 {
this.tx += x;
this.ty += y;
this.tz += z;
return this;
};
}
set3x3(
mxx: number, mxy: number, mxz: number,
@ -163,7 +163,7 @@ export class Matrix3x4 {
this.mzy = mzy;
this.mzz = mzz;
return this;
};
}
set3x4(
mxx: number, mxy: number, mxz: number, tx: number,
@ -183,7 +183,7 @@ export class Matrix3x4 {
this.mzz = mzz;
this.tz = tz;
return this;
};
}
setMatrix(m: Matrix3x4): Matrix3x4 {
this.mxx = m.mxx;
@ -199,7 +199,7 @@ export class Matrix3x4 {
this.mzz = m.mzz;
this.tz = m.tz;
return this;
};
}
setToMatrix4x4(m: any): void {
m.set(
@ -208,7 +208,7 @@ export class Matrix3x4 {
this.mzx, this.mzy, this.mzz, this.tz,
0, 0, 0, 1
);
};
}
toArray(): Matrix3x4Data {
return [
@ -216,7 +216,7 @@ export class Matrix3x4 {
[this.myx, this.myy, this.myz, this.ty],
[this.mzx, this.mzy, this.mzz, this.tz]
];
};
}
toFlatArray(): Matrix3x4FlatData {
return [
@ -224,23 +224,23 @@ export class Matrix3x4 {
this.myx, this.myy, this.myz, this.ty,
this.mzx, this.mzy, this.mzz, this.tz
];
};
}
invert(): Matrix3x4 {
return this.__invert(new Matrix3x4());
};
}
_invert(): Matrix3x4 {
return this.__invert(this);
};
}
normalize(): Matrix3x4 {
return this.__normalize(new Matrix3x4());
};
}
_normalize(): Matrix3x4 {
return this.__normalize(this);
};
}
__normalize(out: Matrix3x4): Matrix3x4 {
const basis = this.getBasis3();
@ -250,7 +250,7 @@ export class Matrix3x4 {
out.setBasisAndTranslation3(basis, tr);
return out;
};
}
__invert(out: Matrix3x4): Matrix3x4 {
@ -295,7 +295,7 @@ export class Matrix3x4 {
out.mzz = czz / det;
out.tz = czt / det;
return out;
};
}
combine(transform: Matrix3x4, out?: Matrix3x4): Matrix3x4 {
let txx = transform.mxx;
@ -326,7 +326,7 @@ export class Matrix3x4 {
m.tz = (this.mzx * ttx + this.mzy * tty + this.mzz * ttz + this.tz);
return m;
};
}
combine3x3(transform: Matrix3x4, out?: Matrix3x4): Matrix3x4 {
let txx = transform.mxx;
@ -357,7 +357,7 @@ export class Matrix3x4 {
return m;
};
}
__applyNoTranslation(vector: Vector, out: Vector): Vector;
__applyNoTranslation(vector: UnitVector, out: UnitVector): UnitVector;
@ -369,13 +369,13 @@ export class Matrix3x4 {
out.y = this.myx * x + this.myy * y + this.myz * z;
out.z = this.mzx * x + this.mzy * y + this.mzz * z;
return out;
};
}
_applyNoTranslation(vector: Vector): Vector;
_applyNoTranslation(vector: UnitVector): UnitVector;
_applyNoTranslation(vector: Vector): Vector {
return this.__applyNoTranslation(vector, vector);
};
}
applyNoTranslation: {
(vector: UnitVector): UnitVector;
@ -384,7 +384,7 @@ export class Matrix3x4 {
_apply(vector: Vector): Vector {
return this.__apply(vector, vector);
};
}
__apply(vector: Vector, out: Vector): Vector {
let x = vector.x;
@ -394,22 +394,22 @@ export class Matrix3x4 {
out.y = this.myx * x + this.myy * y + this.myz * z + this.ty;
out.z = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
return out;
};
}
apply3(data: Vec3): Vec3 {
return this.__apply3(data, [0, 0, 0])
};
}
_apply3(data: Vec3): Vec3 {
return this.__apply3(data, data);
};
}
__apply3([x, y, z]: Vec3, out: Vec3): Vec3 {
out[0] = this.mxx * x + this.mxy * y + this.mxz * z + this.tx;
out[1] = this.myx * x + this.myy * y + this.myz * z + this.ty;
out[2] = this.mzx * x + this.mzy * y + this.mzz * z + this.tz;
return out;
};
}
rotateWithSphericalAxis(axisAzimuth: number, axisInclination: number, angle: number, pivot: Vector) {
@ -420,11 +420,11 @@ export class Matrix3x4 {
);
return Matrix3x4.rotateMatrix(angle, axis, pivot, this);
};
}
rotate(angle: number, axis: Vector, pivot: Vector) {
return Matrix3x4.rotateMatrix(angle, axis, pivot, this);
};
}
static rotateMatrix(angle: number, axis: Vector, pivot: Vector, matrix?: Matrix3x4): Matrix3x4 {
const sin = Math.sin(angle);
@ -484,7 +484,7 @@ export class Matrix3x4 {
m.mzz = cos + axisZ * axisZ * (1 - cos);
m.tz = pz * (1 - m.mzz) - px * m.mzx - py * m.mzy;
return m;
};
}
apply: VectorTransformer = vector => this.__apply(vector, new Vector());

View file

@ -69,7 +69,7 @@ export default class Vector implements XYZ {
length(): number {
return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.z);
};
}
lengthSquared(): number {
return this.dot(this);
@ -134,7 +134,7 @@ export default class Vector implements XYZ {
return this.set(0, 0, 0) as UnitVector;
}
return this.set(this.x / mag, this.y / mag, this.z / mag) as UnitVector;
};
}
_unit(): UnitVector {
return this._normalize();
@ -142,7 +142,7 @@ export default class Vector implements XYZ {
cross(a: XYZ): Vector {
return this.copy()._cross(a);
};
}
_cross(a: XYZ): Vector {
return this.set(
@ -150,7 +150,7 @@ export default class Vector implements XYZ {
this.z * a.x - this.x * a.z,
this.x * a.y - this.y * a.x
);
};
}
negate(): Vector {
return this.multiply(-1);

View file

@ -273,14 +273,14 @@ export default class SceneSetUp {
this.__render_NeverCallMeFromOutside();
}
this.updateViewportSizeIfNeeded();
};
}
private __render_NeverCallMeFromOutside() {
this.renderRequested = false;
this.light.position.set(this.camera.position.x, this.camera.position.y, this.camera.position.z);
this.renderer.render(this.scene, this.camera);
this.sceneRendered$.next();
};
}
domElement() {
return this.renderer.domElement;

View file

@ -236,7 +236,7 @@ export class ResizeHelper {
document.addEventListener("mousemove", moveListener);
document.addEventListener("mouseup", quitListener);
}
};
}
registerResize (el, dirMask, capturingBuffer = 5, onResize = NOOP) {
@ -307,7 +307,7 @@ export class ResizeHelper {
el.style.cursor = '';
}
});
};
}
}
export const DIRECTIONS = {

View file

@ -67,7 +67,7 @@ export class MDatumAxis extends MObject {
toDirection(): UnitVector {
return this.dir;
};
}
toAxis(reverse: boolean): Axis {
let axis = this.axis;

View file

@ -41,7 +41,7 @@ export class MEdge extends MObject {
toDirection(): UnitVector {
return this.brepEdge.halfEdge1.tangentAtStart();
};
}
toAxis(reverse: boolean = false): Axis {
let tan;
@ -55,7 +55,7 @@ export class MEdge extends MObject {
origin = he.vertexB.point;
}
return new Axis(origin, tan);
};
}
get topology(): TopoObject {
return this.brepEdge;

View file

@ -234,7 +234,7 @@ export class MBrepFace extends MFace {
toDirection(): UnitVector {
return this.normal();
};
}
toAxis(reverse: boolean): Axis {
const dir = this.toDirection();
@ -242,6 +242,6 @@ export class MBrepFace extends MFace {
dir._negate();
}
return new Axis(this.favorablePoint, dir);
};
}
}

View file

@ -26,7 +26,7 @@ export abstract class MObject {
toDirection(): UnitVector {
return null;
};
}
toAxis(reverse: boolean): Axis {
return null;

View file

@ -26,7 +26,7 @@ export class MSketchObject extends MObject {
toDirection(): UnitVector {
const tangent = (this.sketchPrimitive as Segment).tangentAtStart();
return this.face.sketchToWorldTransformation.applyNoTranslation(tangent)._normalize();
};
}
toAxis(reverse: boolean): Axis {
let seg = this.sketchPrimitive as Segment;
@ -42,6 +42,6 @@ export class MSketchObject extends MObject {
tan = this.face.sketchToWorldTransformation.applyNoTranslation(tan)._normalize();
origin = this.face.sketchToWorldTransformation.apply(origin);
return new Axis(origin, tan);
};
}
}

View file

@ -20,12 +20,12 @@ export class SolverParam {
this.set(value);
this.constant = false;
this.j = -1;
};
}
set(value) {
if (this.constant) return;
this.value = value;
};
}
get() {
return this.value;

View file

@ -231,7 +231,7 @@ export class IO {
this.viewer.parametricManager.notify();
}
};
}
createBoundaryObjects(boundary) {
@ -256,7 +256,7 @@ export class IO {
this.viewer.parametricManager.reset();
this.viewer.parametricManager.notify();
};
}
_serializeSketch(metadata) {
@ -335,11 +335,11 @@ export class IO {
}
return sketch;
};
}
getWorkspaceToExport() {
return [this.viewer.layers, [this.viewer.labelLayer]];
};
}
getLayersToExport() {
let ws = this.getWorkspaceToExport();
@ -390,7 +390,7 @@ export class IO {
}
bbox.inc(20);
return _format("<svg viewBox='$ $ $ $'>\n", bbox.bbox) + out.data + "</svg>"
};
}
dxfExport() {
@ -456,7 +456,7 @@ export class IO {
//console.log(d.toDxfString());
d.generateAutocadExtras();
return d.toDxfString();
};
}
}
function _format(str, args) {

View file

@ -125,12 +125,12 @@ class ParametricManager {
}
}
}
};
}
onConstantsExternalChange(constantDefinition) {
this.rebuildConstantTable(constantDefinition);
// this.refresh();
};
}
defineNewConstant(name, value) {
let constantDefinition = this.constantDefinition;
@ -141,19 +141,19 @@ class ParametricManager {
constantDefinition = constantText;
}
this.$constantDefinition.next(constantDefinition);
};
}
updateConstraintConstants(constr) {
this.viewer.parametricManager.refresh();
};
}
notify() {
this.$update.next();
};
}
commit() {
this.refresh();
};
}
_add(constr) {
@ -178,7 +178,7 @@ class ParametricManager {
if (highestStage !== this.stage && !this.inTransaction) {
toast("Constraint's been added to stage " + highestStage.index + "!")
}
};
}
refresh() {
if (this.inTransaction) {
@ -192,7 +192,7 @@ class ParametricManager {
this.viewer.historyManager.checkpoint();
this._add(constr);
this.refresh();
};
}
addAll(constrs) {
this.viewer.historyManager.checkpoint();
@ -200,19 +200,19 @@ class ParametricManager {
this._add(constrs[i]);
}
this.refresh();
};
}
remove(constr) {
this.viewer.historyManager.checkpoint();
constr.stage.algNumSystem.removeConstraint(constr);
constr.annotations.forEach(ann => ann.layer.remove(ann));
this.refresh();
};
}
_removeConstraint(constr) {
constr.stage.algNumSystem.removeConstraint(constr);
constr.annotations.forEach(ann => ann.layer.remove(ann));
};
}
removeGenerator(generator) {
this.viewer.deselectAll();
@ -242,7 +242,7 @@ class ParametricManager {
this._removeObject(obj, force);
}
});
};
}
_removeObject = (obj, force?) => {
if (obj.__disposed) {

View file

@ -29,7 +29,7 @@ export abstract class SketchObject extends Shape implements SolvableObject {
dependsOn(obj: SketchObject): boolean {
return false;
};
}
get isGenerated() {
let obj: SketchObject = this;

View file

@ -34,4 +34,4 @@ export default function(viewer): SketcherStreams {
};
return streams as SketcherStreams;
};
}

View file

@ -139,11 +139,11 @@ export class Viewer {
this.canvas = null;
this.toolManager.dispose();
Generator.resetIDGenerator();
};
}
isDisposed() {
return this.canvas === null;
};
}
setTransformation(a, b, c, d, e, f, zoom) {
this.transformation = [a, b, c, d, e, f];
@ -156,30 +156,30 @@ export class Viewer {
b, d, 0, f,
0, 0, 1, 0
)._invert();
};
}
roundToPrecision(value) {
return value.toFixed(this.presicion);
};
}
addSegment(x1, y1, x2, y2, layer) {
const line = new Segment(x1, y1, x2, y2);
layer.add(line);
return line;
};
}
remove(obj) {
this.removeAll([obj]);
};
}
removeAll(objects) {
this.deselectAll();
this.parametricManager.removeObjects(objects);
};
}
add(obj, layer) {
layer.add(obj);
};
}
search(x, y, buffer, deep, onlyPoints, filter) {
@ -235,7 +235,7 @@ export class Viewer {
pickResult[heroIdx] = _f;
}
return pickResult;
};
}
_createServiceLayers(): Layer<Shape>[] {
let layer = this.createLayer<Shape>("_service", Styles.SERVICE);
@ -244,7 +244,7 @@ export class Viewer {
layer.objects.push(this.referencePoint);
layer.objects.push(new BasisOrigin(null, this));
return [layer];
};
}
createGroundObjects() {
const groundObjectsGenerator = new SketchGenerator({}, GroundObjectsGeneratorSchema);
@ -258,7 +258,7 @@ export class Viewer {
viewer.repaint();
}
});
};
}
repaint() {
@ -284,7 +284,7 @@ export class Viewer {
this.__drawWorkspace(ctx, this._workspace, Viewer.__SKETCH_DRAW_PIPELINE);
this.__drawWorkspace(ctx, this._serviceWorkspace, Viewer.__SIMPLE_DRAW_PIPELINE);
};
}
__drawWorkspace(ctx, workspace, pipeline) {
for (let drawPredicate of pipeline) {
@ -306,7 +306,7 @@ export class Viewer {
}
}
}
};
}
__draw(ctx, layer, obj) {
const style = this.getStyleForObject(layer, obj);
@ -315,7 +315,7 @@ export class Viewer {
}
this.__prevStyle = style;
obj.draw(ctx, this.scale / this.retinaPxielRatio, this);
};
}
getStyleForObject(layer, obj) {
if (obj.style != null) {
@ -327,11 +327,11 @@ export class Viewer {
}
}
return layer.style;
};
}
setStyle(style, ctx) {
draw_utils.SetStyle(style, ctx, this.scale / this.retinaPxielRatio);
};
}
snap(x, y, excl) {
this.cleanSnap();
@ -340,11 +340,11 @@ export class Viewer {
this.capture('tool', [snapTo[0]], true);
}
return this.snapped;
};
}
cleanSnap() {
this.withdrawAll('tool')
};
}
showBounds(x1, y1, x2, y2) {
const dx = Math.max(x2 - x1, 1);
@ -358,7 +358,7 @@ export class Viewer {
}
this.translate.x = -x1 * this.scale;
this.translate.y = -y1 * this.scale;
};
}
fit() {
let count = 0;
@ -392,17 +392,17 @@ export class Viewer {
out.x /= this.scale;
out.y /= this.scale;
}
};
}
screenToModel(e) {
return this._screenToModel(e.offsetX, e.offsetY);
};
}
_screenToModel(x, y) {
const out = {x: 0, y: 0};
this.screenToModel2(x, y, out);
return out;
};
}
screenToModelDistance(dist) {
measurer.x = 0;
@ -437,7 +437,7 @@ export class Viewer {
}
}
return null;
};
}
findById(id) {
let result = null;
@ -449,7 +449,7 @@ export class Viewer {
return true;
});
return result;
};
}
createIndex() {
const index = {};
@ -476,7 +476,7 @@ export class Viewer {
obj.addMarker(CAPTURES[type]);
}
}
};
}
withdraw(type, obj) {
@ -487,7 +487,7 @@ export class Viewer {
break;
}
}
};
}
withdrawAll(type) {
const captured = this.captured[type];
@ -495,22 +495,22 @@ export class Viewer {
captured[i].removeMarker(CAPTURES[type]);
}
while (captured.length > 0) captured.pop();
};
}
withdrawGlobal() {
Object.keys(this.captured).forEach(type => this.withdrawAll(type));
this.streams.selection.next(this.selected);
};
}
deselect(obj) {
this.withdraw('selection', obj);
this.streams.selection.next(this.selected);
};
}
deselectAll() {
this.withdrawAll('selection');
this.streams.selection.next(this.selected);
};
}
highlight(objs, exclusive) {
this.capture('highlight', objs, exclusive);
@ -527,7 +527,7 @@ export class Viewer {
pick(e) {
const m = this.screenToModel(e);
return this.search(m.x, m.y, DEFAULT_SEARCH_BUFFER, true, false, []);
};
}
get activeLayer() {
let layer = this._activeLayer;
@ -542,7 +542,7 @@ export class Viewer {
}
}
return this.findLayerByName(PREDEFINED_LAYERS.SKETCH);
};
}
set activeLayerName(layerName) {
let layer = this.findLayerByName(layerName);
@ -551,22 +551,22 @@ export class Viewer {
} else {
console.warn("layer doesn't exist: " + layerName);
}
};
}
setActiveLayer(layer) {
if (!layer.readOnly) {
this._activeLayer = layer;
}
};
}
fullHeavyUIRefresh() {
this.refresh();
this.parametricManager.notify();
};
}
createLayer<T>(name, style) {
return new Layer<T>(name, style, this)
};
}
objectsUpdate = () => this.streams.objectsUpdate.next();
@ -625,7 +625,7 @@ export class Layer<T = Shape> {
return true;
}
return false;
};
}
add(object) {
if (object.layer !== undefined) {
@ -639,7 +639,7 @@ export class Layer<T = Shape> {
} else {
this._addAndNotify(object);
}
};
}
traverseSketchObjects(callback) {
this.objects.forEach(o => {