Sindarius / npm_gcodeviewer

Use const declarations for variables that are never reassigned JS-0242
Anti-pattern
Minor
3 months agoa year old
'linesToRender' is never reassigned. Use 'const' instead
 920      renderer.renderAnimation = this.renderAnimation;
 921      this.renderInstances.push(renderer);
 922
 923      let linesToRender = this.lines.slice(0, this.linesIndex - 1); 924      if (linesToRender != null && linesToRender.length > 0) {
 925         await renderer.render(linesToRender);
 926      }
'minlh' is never reassigned. Use 'const' instead
 892   async createMesh(scene) {
 893      //Do a z belt fix for layer heights - so far they appear fixed but some values can be off on initial extrusions
 894      if (this.zBelt) {
 895         let minlh = this.lines[this.linesIndex - 1].layerHeight; 896         this.lines.forEach((l) => {
 897            l.layerHeight = minlh;
 898         });
'commentIndex' is never reassigned. Use 'const' instead
 714
 715   async processLine(tokenString, lineNumber, filePosition, renderLine = true) {
 716      //Remove the comments in the line
 717      let commentIndex = tokenString.indexOf(';'); 718      if (commentIndex > -1) {
 719         tokenString = tokenString.substring(0, commentIndex - 1).trim();
 720      }
'hasMove' is never reassigned. Use 'const' instead
 724      let commands = tokenString.match(/[GM]+[0-9.]+/g); //|S+
 725
 726      if (commands === null) {
 727         let hasMove = tokenString.match(/[XYZ]+[+-]?[0-9.]+/g); 728         if (hasMove !== null) {
 729            commands = this.lastCommand;
 730         }
'tool' is never reassigned. Use 'const' instead
  61      let cmyk = ['#00FFFF', '#FF00FF', '#FFFF00', '#000000', '#FFFFFF'];
  62      //Create a default set of tools
  63      for (let idx = 0; idx < 5; idx++) {
  64         let tool = new Tool();  65         tool.color = Color4.FromHexString(cmyk[idx]);
  66         tool.diameter = 0.4;
  67         this.tools.push(tool);