Sindarius / npm_gcodeviewer

Logical operator can be refactored to optional chain JS-W1044
Anti-pattern
Minor
3 months ago8 months old
Prefer using an optional chain expression instead, as it's more concise and easier to read
 676            }
 677            this.lastGCodeByte = filePosition;
 678            this.processLine(line, lineNumber, filePosition, renderLine);
 679         } else if (this.slicer && this.slicer.isTypeComment(line)) { 680            this.isSupport = this.slicer.isSupport();
 681            if (this.colorMode === ColorMode.Feature) {
 682               this.currentColor = this.slicer.getFeatureColor();
Prefer using an optional chain expression instead, as it's more concise and easier to read
 670            if (this.slicer) {
 671               this.slicer.isTypeComment(line);
 672            }
 673            let renderLine = !this.perimeterOnly || (this.slicer && this.slicer.isPerimeter()); 674            if (this.firstGCodeByte === 0 && line.length > 0) {
 675               this.firstGCodeByte = filePosition;
 676            }
Prefer using an optional chain expression instead, as it's more concise and easier to read
 71      return; 
 72    } 
 73    if (this.debug) return; 
 74    if (this.bedMesh && this.bedMesh.isDisposed()) {  75      this.bedMesh = null; 
 76    } 
 77    if (this.bedMesh) return this.bedMesh;