TargetProcess/tauCharts

View on GitHub
src/elements/decorators/layer-labels.ts

Summary

Maintainability
F
5 days
Test Coverage

File layer-labels.ts has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utilsDraw from '../../utils/utils-draw';
import * as utilsDom from '../../utils/utils-dom';
import * as utils from '../../utils/utils';
import {LayerLabelsModel} from './layer-labels-model';
import {LayerLabelsRules} from './layer-labels-rules';
Severity: Minor
Found in src/elements/decorators/layer-labels.ts - About 6 hrs to fix

    Function draw has 151 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        draw(fibers: any[][]) {
    
            var self = this;
    
            var model = this.model;
    Severity: Major
    Found in src/elements/decorators/layer-labels.ts - About 6 hrs to fix

      Function draw has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          draw(fibers: any[][]) {
      
              var self = this;
      
              var model = this.model;
      Severity: Minor
      Found in src/elements/decorators/layer-labels.ts - About 4 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function autoPosition has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          autoPosition(parallel: Parallel, tokens: string[]) {
      
              const calcEllipticXY = (r, angle) => {
                  const xReserve = 4;
                  const yReserve = 2;
      Severity: Major
      Found in src/elements/decorators/layer-labels.ts - About 2 hrs to fix

        Function hideOnLabelLabelOverlap has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            hideOnLabelLabelOverlap(data: TextInfo[]) {
        
                var extremumOrder = {min: 0, max: 1, norm: 2};
                var collisionSolveStrategies = {
                    'min/min': ((p0, p1) => p1.y - p0.y), // desc
        Severity: Minor
        Found in src/elements/decorators/layer-labels.ts - About 1 hr to fix

          Function parallel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      (memo, f) => {
                          var absFiber = f.map((row) => {
                              return {
                                  data: row,
                                  x: m.x(row) + m.dx(row),
          Severity: Minor
          Found in src/elements/decorators/layer-labels.ts - About 1 hr to fix

            Function update has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    var update = function (elements: d3Selection) {
                        elements
                            .style('fill', color)
                            .style('font-size', `${self.guide.fontSize}px`)
                            .style('display', ((__, i) => labels[i].hide ? 'none' : null))
            Severity: Minor
            Found in src/elements/decorators/layer-labels.ts - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  getPointRect(a: TextInfo, border = 0) {
                      return {
                          x0: a.x - a.size / 2 - border,
                          x1: a.x + a.size / 2 + border,
                          y0: a.y - a.size / 2 - border,
              Severity: Major
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 4 hrs to fix
              src/elements/decorators/layer-labels.ts on lines 438..445

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 124.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  getLabelRect(a: TextInfo, border = 0) {
                      return {
                          x0: a.x - a.w / 2 - border,
                          x1: a.x + a.w / 2 + border,
                          y0: a.y - a.h / 2 - border,
              Severity: Major
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 4 hrs to fix
              src/elements/decorators/layer-labels.ts on lines 447..454

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 124.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          var y_overlap = k * Math.max(0, Math.min(rb.y1, ra.y1) - Math.max(ra.y0, rb.y0));
              Severity: Major
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 1 hr to fix
              src/elements/decorators/layer-labels.ts on lines 409..409

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          var x_overlap = k * Math.max(0, Math.min(rb.x1, ra.x1) - Math.max(ra.x0, rb.x0));
              Severity: Major
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 1 hr to fix
              src/elements/decorators/layer-labels.ts on lines 410..410

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 58.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          var x_overlap = Math.max(
                              0,
                              Math.min(pointRect.x1, labelRect.x1) - Math.max(pointRect.x0, labelRect.x0));
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 55 mins to fix
              src/elements/decorators/layer-labels.ts on lines 466..468

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 54.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          var y_overlap = Math.max(
                              0,
                              Math.min(pointRect.y1, labelRect.y1) - Math.max(pointRect.y0, labelRect.y0));
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 55 mins to fix
              src/elements/decorators/layer-labels.ts on lines 462..464

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 54.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              row.x = Math.min(Math.max(row.x, row.w / 2), (maxWidth - row.w / 2));
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 55 mins to fix
              src/elements/decorators/layer-labels.ts on lines 491..491

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 53.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              row.x = Math.min(Math.max(row.x, row.w / 2), (maxWidth - row.w / 2));
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 55 mins to fix
              src/elements/decorators/layer-labels.ts on lines 501..501

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 53.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              var overlapTop = intersect(rect.x0, rect.x1, edge.x0, edge.x1, rect.y0, rect.y1, edge.y0, edge.y1);
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 45 mins to fix
              src/elements/decorators/layer-labels.ts on lines 377..377

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              var overlapBtm = intersect(rect.x0, rect.x1, edge.x0, edge.x1, rect.y1, rect.y0, edge.y0, edge.y1);
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 45 mins to fix
              src/elements/decorators/layer-labels.ts on lines 376..376

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 50.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      parallel.text = parallel.text = flags['auto:adjust-on-label-overflow'] ?
                          this.adjustOnOverflow(parallel.text, args) :
                          parallel.text;
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 35 mins to fix
              src/elements/decorators/layer-labels.ts on lines 185..187

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      parallel.text = parallel.text = flags['auto:adjust-on-multiline-label-overflow'] ?
                          this.adjustOnMultilineOverflow(parallel.text, args) :
                          parallel.text;
              Severity: Minor
              Found in src/elements/decorators/layer-labels.ts and 1 other location - About 35 mins to fix
              src/elements/decorators/layer-labels.ts on lines 181..183

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var get = ((prop) => ((__, i) => labels[i][prop]));

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var xi = get('x');

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var update = function (elements: d3Selection) {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var fixedPosition = guide

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Expected property shorthand in object literal ('{i}').
              Open

                          .map((r, i) => Object.assign(r, {i: i}));

              Rule: object-literal-shorthand

              Enforces/disallows use of ES6 object literal shorthand.

              Notes
              • Has Fix

              Config

              "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

              The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

              Examples
              "object-literal-shorthand": true
              "object-literal-shorthand": true,never
              "object-literal-shorthand": true,[object Object]
              Schema
              {
                "oneOf": [
                  {
                    "type": "string",
                    "enum": [
                      "never"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "property": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      }
                    },
                    "minProperties": 1,
                    "maxProperties": 2
                  }
                ]
              }

              For more information see this page.

              Identifier 'guide' is never reassigned; use 'const' instead of 'var'.
              Open

                      var guide = this.guide;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'flags' is never reassigned; use 'const' instead of 'var'.
              Open

                      var flags = positions.reduce((memo, token) => Object.assign(memo, {[token]:true}), {});

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'overlapTop' is never reassigned; use 'const' instead of 'var'.
              Open

                              var overlapTop = intersect(rect.x0, rect.x1, edge.x0, edge.x1, rect.y0, rect.y1, edge.y0, edge.y1);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'overlapBtm' is never reassigned; use 'const' instead of 'var'.
              Open

                              var overlapBtm = intersect(rect.x0, rect.x1, edge.x0, edge.x1, rect.y1, rect.y0, edge.y0, edge.y1);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'p' is never reassigned; use 'const' instead of 'let'.
              Open

                              let p = [a, b];

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'x_overlap' is never reassigned; use 'const' instead of 'var'.
              Open

                          var x_overlap = k * Math.max(0, Math.min(rb.x1, ra.x1) - Math.max(ra.x0, rb.x0));

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'isIntersects' is never reassigned; use 'const' instead of 'var'.
              Open

                      var isIntersects = ((label, point) => {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var x_overlap = Math.max(

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'lineBreakSeparator' is never reassigned; use 'const' instead of 'var'.
              Open

                      var lineBreakSeparator = guide.lineBreakSeparator;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Type assertion on object literals is forbidden, use a type annotation instead.
              Open

                          <Parallel>{text: [], edges: []});

              Rule: no-object-literal-type-assertion

              Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

              Rationale

              Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

              Notes
              • TypeScript Only

              Config

              One option may be configured:

              • allow-arguments allows type assertions to be used on object literals inside call expressions.
              Examples
              "no-object-literal-type-assertion": true
              "no-object-literal-type-assertion": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "allow-arguments": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }

              For more information see this page.

              'Object.assign' returns the first argument. Prefer object spread if you want a new object.
              Open

                          .map((r, i) => Object.assign(r, {i: i}));

              Rule: prefer-object-spread

              Enforces the use of the ES2018 object spread operator over Object.assign() where appropriate.

              Rationale

              Object spread allows for better type checking and inference.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "prefer-object-spread": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var readBy3 = <T, K>(list: T[], iterator: (a: T, b: T, c: T) => K) => {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var iNext = (i === l) ? i : (i + 1);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var angle = get('angle');

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                                  var d3Label = d3SelectionJs.select(this);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var cross = ((a: TextInfo, b: TextInfo) => {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              non-arrow functions are forbidden
              Open

                      var update = function (elements: d3Selection) {

              Rule: only-arrow-functions

              Disallows traditional (non-arrow) function expressions.

              Note that non-arrow functions are allowed if 'this' appears somewhere in its body (as such functions cannot be converted to arrow functions).

              Rationale

              Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.

              Config

              Two arguments may be optionally provided:

              • "allow-declarations" allows standalone function declarations.
              • "allow-named-functions" allows the expression function foo() {} but not function() {}.
              Examples
              "only-arrow-functions": true
              "only-arrow-functions": true,allow-declarations,allow-named-functions
              Schema
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "allow-declarations",
                    "allow-named-functions"
                  ]
                },
                "minLength": 0,
                "maxLength": 1
              }

              For more information see this page.

              Identifier 'iPrev' is never reassigned; use 'const' instead of 'var'.
              Open

                              var iPrev = (i === 0) ? i : (i - 1);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'positions' is never reassigned; use 'const' instead of 'var'.
              Open

                      var positions = lineBreakAvailable ?

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'xi' is never reassigned; use 'const' instead of 'var'.
              Open

                      var xi = get('x');

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'k' is never reassigned; use 'const' instead of 'var'.
              Open

                          var k = Number(!a.hide && !b.hide);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'extremumOrder' is never reassigned; use 'const' instead of 'var'.
              Open

                      var extremumOrder = {min: 0, max: 1, norm: 2};

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var r: K[] = [];

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var parallel = fibers.reduce(

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var labels = parallel.text;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var overlapBtm = intersect(rect.x0, rect.x1, edge.x0, edge.x1, rect.y1, rect.y0, edge.y0, edge.y1);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Expected property shorthand in object literal ('{lineBreakSeparator}').
              Open

                              lineBreakSeparator: lineBreakSeparator,

              Rule: object-literal-shorthand

              Enforces/disallows use of ES6 object literal shorthand.

              Notes
              • Has Fix

              Config

              "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

              The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

              Examples
              "object-literal-shorthand": true
              "object-literal-shorthand": true,never
              "object-literal-shorthand": true,[object Object]
              Schema
              {
                "oneOf": [
                  {
                    "type": "string",
                    "enum": [
                      "never"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "property": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      }
                    },
                    "minProperties": 1,
                    "maxProperties": 2
                  }
                ]
              }

              For more information see this page.

              Identifier 'absFiber' is never reassigned; use 'const' instead of 'var'.
              Open

                              var absFiber = f.map((row) => {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'r' is never reassigned; use 'const' instead of 'var'.
              Open

                          var r = memo[l.i];

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'r' is never reassigned; use 'const' instead of 'let'.
              Open

                              let r = (collisionSolveStrategies[`${p[0].extr}/${p[1].extr}`](p[0], p[1]) < 0 ?

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'ra' is never reassigned; use 'const' instead of 'var'.
              Open

                          var ra = this.getLabelRect(a);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              'Object.assign' returns the first argument. Prefer object spread if you want a new object.
              Open

                      var flags = positions.reduce((memo, token) => Object.assign(memo, {[token]:true}), {});

              Rule: prefer-object-spread

              Enforces the use of the ES2018 object spread operator over Object.assign() where appropriate.

              Rationale

              Object spread allows for better type checking and inference.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "prefer-object-spread": true

              For more information see this page.

              Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.
              Open

                              return <LabelPenaltyModel>{
                                  i: r.i,
                                  x0: r.x,
                                  y0: r.y,
                                  x: r.x + xy.x,

              Rule: no-angle-bracket-type-assertion

              Requires the use of as Type for type assertions instead of <Type>.

              Rationale

              Both formats of type assertions have the same effect, but only as type assertions work in .tsx files. This rule ensures that you have a consistent type assertion style across your codebase.

              Notes
              • TypeScript Only
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-angle-bracket-type-assertion": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var collisionSolveStrategies = {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var k = Number(!a.hide && !b.hide);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'nextLineDYKoeff' is never reassigned; use 'const' instead of 'var'.
              Open

                              var nextLineDYKoeff = 1.2;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'label' is never reassigned; use 'const' instead of 'var'.
              Open

                      var label = get('label');

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              missing whitespace
              Open

                      var flags = positions.reduce((memo, token) => Object.assign(memo, {[token]:true}), {});

              Rule: whitespace

              Enforces whitespace style conventions.

              Rationale

              Helps maintain a readable, consistent style in your codebase.

              Notes
              • Has Fix

              Config

              Several arguments may be optionally provided:

              • "check-branch" checks branching statements (if/else/for/while) are followed by whitespace.
              • "check-decl"checks that variable declarations have whitespace around the equals token.
              • "check-operator" checks for whitespace around operator tokens.
              • "check-module" checks for whitespace in import & export statements.
              • "check-separator" checks for whitespace after separator tokens (,/;).
              • "check-rest-spread" checks that there is no whitespace after rest/spread operator (...).
              • "check-type" checks for whitespace before a variable type specification.
              • "check-typecast" checks for whitespace between a typecast and its target.
              • "check-type-operator" checks for whitespace between type operators | and &.
              • "check-preblock" checks for whitespace before the opening brace of a block.
              • "check-postbrace" checks for whitespace after an opening brace.
              Examples
              "whitespace": true,check-branch,check-operator,check-typecast
              Schema
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "check-branch",
                    "check-decl",
                    "check-operator",
                    "check-module",
                    "check-separator",
                    "check-rest-spread",
                    "check-type",
                    "check-typecast",
                    "check-type-operator",
                    "check-preblock",
                    "check-postbrace"
                  ]
                },
                "minLength": 0,
                "maxLength": 11
              }

              For more information see this page.

              Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead.
              Open

                          <Parallel>{text: [], edges: []});

              Rule: no-angle-bracket-type-assertion

              Requires the use of as Type for type assertions instead of <Type>.

              Rationale

              Both formats of type assertions have the same effect, but only as type assertions work in .tsx files. This rule ensures that you have a consistent type assertion style across your codebase.

              Notes
              • TypeScript Only
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-angle-bracket-type-assertion": true

              For more information see this page.

              Identifier 'angle' is never reassigned; use 'const' instead of 'var'.
              Open

                      var angle = get('angle');

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'color' is never reassigned; use 'const' instead of 'var'.
              Open

                      var color = get('color');

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'rb' is never reassigned; use 'const' instead of 'var'.
              Open

                          var rb = this.getLabelRect(b);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'x_overlap' is never reassigned; use 'const' instead of 'var'.
              Open

                          var x_overlap = Math.max(

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Assigning this reference to local variable not allowed: self.
              Open

                      var self = this;

              Rule: no-this-assignment

              Disallows unnecessary references to this.

              Rationale

              Assigning a variable to this instead of properly using arrow lambdas may be a symptom of pre-ES6 practices or not managing scope well.

              Instead of storing a reference to this and using it inside a function () {:

              const self = this;
              
              setTimeout(function () {
                  self.doWork();
              });

              Use () => arrow lambdas, as they preserve this scope for you:

              setTimeout(() => {
                  this.doWork();
              });

              Config

              Two options may be provided on an object:

              • allow-destructuring allows using destructuring to access members of this (e.g. { foo, bar } = this;).
              • allowed-names may be specified as a list of regular expressions to match allowed variable names.
              Examples
              "no-this-assignment": true
              "no-this-assignment": true,[object Object]
              Schema
              {
                "additionalProperties": false,
                "properties": {
                  "allow-destructuring": {
                    "type": "boolean"
                  },
                  "allowed-names": {
                    "listType": "string",
                    "type": "list"
                  }
                },
                "type": "object"
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var m = this.applyFixedPositionRules(guide, args, seed, lineBreakAvailable, this.flip);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var iPrev = (i === 0) ? i : (i - 1);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var absFiber = f.map((row) => {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var text = this

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var rb = this.getLabelRect(b);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'angleValue' is never reassigned; use 'const' instead of 'var'.
              Open

                                  var angleValue = angle(d, i);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'get' is never reassigned; use 'const' instead of 'var'.
              Open

                      var get = ((prop) => ((__, i) => labels[i][prop]));

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'text' is never reassigned; use 'const' instead of 'var'.
              Open

                      var text = this

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'labels' is never reassigned; use 'const' instead of 'var'.
              Open

                      var labels = parallel.text

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var self = this;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var lineBreakAvailable = guide.lineBreak;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var args = {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          for (var i = 0; i <= l; i++) {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var color = get('color');

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var nextLineDYKoeff = 1.2;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var overlapTop = intersect(rect.x0, rect.x1, edge.x0, edge.x1, rect.y0, rect.y1, edge.y0, edge.y1);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Type assertion on object literals is forbidden, use a type annotation instead.
              Open

                              return <LabelPenaltyModel>{
                                  i: r.i,
                                  x0: r.x,
                                  y0: r.y,
                                  x: r.x + xy.x,

              Rule: no-object-literal-type-assertion

              Forbids an object literal to appear in a type assertion expression. Casting to any or to unknown is still allowed.

              Rationale

              Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed. Additionally, the const assertion const x = { foo: 1 } as const, introduced in TypeScript 3.4, is considered beneficial and is ignored by this rule.

              Notes
              • TypeScript Only

              Config

              One option may be configured:

              • allow-arguments allows type assertions to be used on object literals inside call expressions.
              Examples
              "no-object-literal-type-assertion": true
              "no-object-literal-type-assertion": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "allow-arguments": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var tokens = positions.filter((token) => token.indexOf('auto:avoid') === 0);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var flags = positions.reduce((memo, token) => Object.assign(memo, {[token]:true}), {});

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var yi = get('y');

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var ra = this.getLabelRect(a);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Expected property shorthand in object literal ('{lineBreakAvailable}').
              Open

                          lineBreakAvailable: lineBreakAvailable,

              Rule: object-literal-shorthand

              Enforces/disallows use of ES6 object literal shorthand.

              Notes
              • Has Fix

              Config

              "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

              The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

              Examples
              "object-literal-shorthand": true
              "object-literal-shorthand": true,never
              "object-literal-shorthand": true,[object Object]
              Schema
              {
                "oneOf": [
                  {
                    "type": "string",
                    "enum": [
                      "never"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "property": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      }
                    },
                    "minProperties": 1,
                    "maxProperties": 2
                  }
                ]
              }

              For more information see this page.

              Identifier 'l' is never reassigned; use 'const' instead of 'var'.
              Open

                          var l = list.length - 1;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'iCurr' is never reassigned; use 'const' instead of 'var'.
              Open

                              var iCurr = i;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var model = this.model;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var seed = LayerLabelsModel.seed(

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var l = list.length - 1;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Shadowed name: 'edges'
              Open

                      const penaltyLabelEdgesOverlap = (label: TextInfo, edges: EdgeInfo[]) => {

              Rule: no-shadowed-variable

              Disallows shadowing variable declarations.

              Rationale

              When a variable in a local scope and a variable in the containing scope have the same name, shadowing occurs. Shadowing makes it impossible to access the variable in the containing scope and obscures to what value an identifier actually refers. Compare the following snippets:

              const a = 'no shadow';
              function print() {
                  console.log(a);
              }
              print(); // logs 'no shadow'.
              const a = 'no shadow';
              function print() {
                  const a = 'shadow'; // TSLint will complain here.
                  console.log(a);
              }
              print(); // logs 'shadow'.

              ESLint has an equivalent rule. For more background information, refer to this MDN closure doc.

              Config

              You can optionally pass an object to disable checking for certain kinds of declarations. Possible keys are "class", "enum", "function", "import", "interface", "namespace", "typeAlias" and "typeParameter". You can also pass "underscore" to ignore variable names that begin with _. Just set the value to false for the check you want to disable. All checks default to true, i.e. are enabled by default. Note that you cannot disable variables and parameters.

              The option "temporalDeadZone" defaults to true which shows errors when shadowing block scoped declarations in their temporal dead zone. When set to false parameters, classes, enums and variables declared with let or const are not considered shadowed if the shadowing occurs within their temporal dead zone.

              The following example shows how the "temporalDeadZone" option changes the linting result:

              function fn(value) {
                  if (value) {
                      const tmp = value; // no error on this line if "temporalDeadZone" is false
                      return tmp;
                  }
                  let tmp = undefined;
                  if (!value) {
                      const tmp = value; // this line always contains an error
                      return tmp;
                  }
              }
              Examples
              "no-shadowed-variable": true
              "no-shadowed-variable": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "class": {
                    "type": "boolean"
                  },
                  "enum": {
                    "type": "boolean"
                  },
                  "function": {
                    "type": "boolean"
                  },
                  "import": {
                    "type": "boolean"
                  },
                  "interface": {
                    "type": "boolean"
                  },
                  "namespace": {
                    "type": "boolean"
                  },
                  "typeAlias": {
                    "type": "boolean"
                  },
                  "typeParameter": {
                    "type": "boolean"
                  },
                  "temporalDeadZone": {
                    "type": "boolean"
                  },
                  "underscore": {
                    "type": "boolean"
                  }
                }
              }

              For more information see this page.

              Identifier 'r' is never reassigned; use 'const' instead of 'var'.
              Open

                          var r: K[] = [];

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                              var iCurr = i;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'iNext' is never reassigned; use 'const' instead of 'var'.
              Open

                              var iNext = (i === l) ? i : (i + 1);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var labels = parallel.text

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var r = memo[l.i];

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var x_overlap = k * Math.max(0, Math.min(rb.x1, ra.x1) - Math.max(ra.x0, rb.x0));

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'args' is never reassigned; use 'const' instead of 'var'.
              Open

                      var args = {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'labels' is never reassigned; use 'const' instead of 'var'.
              Open

                      var labels = parallel.text;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'update' is never reassigned; use 'const' instead of 'var'.
              Open

                      var update = function (elements: d3Selection) {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var lineBreakSeparator = guide.lineBreakSeparator;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var positions = lineBreakAvailable ?

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var label = get('label');

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Expected property shorthand in object literal ('{lineBreakAvailable}').
              Open

                              lineBreakAvailable: lineBreakAvailable,

              Rule: object-literal-shorthand

              Enforces/disallows use of ES6 object literal shorthand.

              Notes
              • Has Fix

              Config

              "always" assumed to be default option, thus with no options provided the rule enforces object literal methods and properties shorthands. With "never" option provided, any shorthand object literal syntax causes an error.

              The rule can be configured in a more granular way. With {"property": "never"} provided (which is equivalent to {"property": "never", "method": "always"}), the rule only flags property shorthand assignments, and respectively with {"method": "never"} (equivalent to {"property": "always", "method": "never"}), the rule fails only on method shorthands.

              Examples
              "object-literal-shorthand": true
              "object-literal-shorthand": true,never
              "object-literal-shorthand": true,[object Object]
              Schema
              {
                "oneOf": [
                  {
                    "type": "string",
                    "enum": [
                      "never"
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "property": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      },
                      "method": {
                        "type": "string",
                        "enum": [
                          "never"
                        ]
                      }
                    },
                    "minProperties": 1,
                    "maxProperties": 2
                  }
                ]
              }

              For more information see this page.

              Identifier 'self' is never reassigned; use 'const' instead of 'var'.
              Open

                      var self = this;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'model' is never reassigned; use 'const' instead of 'var'.
              Open

                      var model = this.model;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'lineBreakAvailable' is never reassigned; use 'const' instead of 'var'.
              Open

                      var lineBreakAvailable = guide.lineBreak;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'edges' is never reassigned; use 'const' instead of 'var'.
              Open

                      var edges = parallel.edges;

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'y_overlap' is never reassigned; use 'const' instead of 'var'.
              Open

                          var y_overlap = k * Math.max(0, Math.min(rb.y1, ra.y1) - Math.max(ra.y0, rb.y0));

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'collisionSolveStrategies' is never reassigned; use 'const' instead of 'var'.
              Open

                      var collisionSolveStrategies = {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var guide = this.guide;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var y_overlap = k * Math.max(0, Math.min(rb.y1, ra.y1) - Math.max(ra.y0, rb.y0));

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var isIntersects = ((label, point) => {

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'd3Label' is never reassigned; use 'const' instead of 'var'.
              Open

                                  var d3Label = d3SelectionJs.select(this);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'seed' is never reassigned; use 'const' instead of 'var'.
              Open

                      var seed = LayerLabelsModel.seed(

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'm' is never reassigned; use 'const' instead of 'var'.
              Open

                      var m = this.applyFixedPositionRules(guide, args, seed, lineBreakAvailable, this.flip);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'fixedPosition' is never reassigned; use 'const' instead of 'var'.
              Open

                      var fixedPosition = guide

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'sim' is never reassigned; use 'const' instead of 'var'.
              Open

                      var sim = new AnnealingSimulator({

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var sim = new AnnealingSimulator({

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'tokens' is never reassigned; use 'const' instead of 'var'.
              Open

                      var tokens = positions.filter((token) => token.indexOf('auto:avoid') === 0);

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'yi' is never reassigned; use 'const' instead of 'var'.
              Open

                      var yi = get('y');

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'y_overlap' is never reassigned; use 'const' instead of 'var'.
              Open

                          var y_overlap = Math.max(

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                                  var angleValue = angle(d, i);

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var edges = parallel.edges;

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              non-arrow functions are forbidden
              Open

                                      .forEach(function (word, index) {

              Rule: only-arrow-functions

              Disallows traditional (non-arrow) function expressions.

              Note that non-arrow functions are allowed if 'this' appears somewhere in its body (as such functions cannot be converted to arrow functions).

              Rationale

              Traditional functions don't bind lexical scope, which can lead to unexpected behavior when accessing 'this'.

              Config

              Two arguments may be optionally provided:

              • "allow-declarations" allows standalone function declarations.
              • "allow-named-functions" allows the expression function foo() {} but not function() {}.
              Examples
              "only-arrow-functions": true
              "only-arrow-functions": true,allow-declarations,allow-named-functions
              Schema
              {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "allow-declarations",
                    "allow-named-functions"
                  ]
                },
                "minLength": 0,
                "maxLength": 1
              }

              For more information see this page.

              Identifier 'intersect' is never reassigned; use 'const' instead of 'var'.
              Open

              var intersect = (x1, x2, x3, x4, y1, y2, y3, y4) => utilsDraw.isIntersect(

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

              var intersect = (x1, x2, x3, x4, y1, y2, y3, y4) => utilsDraw.isIntersect(

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                      var extremumOrder = {min: 0, max: 1, norm: 2};

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Forbidden 'var' keyword, use 'let' or 'const' instead
              Open

                          var y_overlap = Math.max(

              Rule: no-var-keyword

              Disallows usage of the var keyword.

              Use let or const instead.

              Rationale

              Declaring variables using var has several edge case behaviors that make var unsuitable for modern code. Variables declared by var have their parent function block as their scope, ignoring other control flow statements. vars have declaration "hoisting" (similar to functions) and can appear to be used before declaration.

              Variables declared by const and let instead have as their scope the block in which they are defined, and are not allowed to used before declaration or be re-declared with another const or let.

              Notes
              • Has Fix

              Config

              Not configurable.

              Examples
              "no-var-keyword": true

              For more information see this page.

              Identifier 'readBy3' is never reassigned; use 'const' instead of 'var'.
              Open

                      var readBy3 = <T, K>(list: T[], iterator: (a: T, b: T, c: T) => K) => {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              Identifier 'cross' is never reassigned; use 'const' instead of 'var'.
              Open

                      var cross = ((a: TextInfo, b: TextInfo) => {

              Rule: prefer-const

              Requires that variable declarations use const instead of let and var if possible.

              If a variable is only assigned to once when it is declared, it should be declared using 'const'

              Notes
              • Has Fix

              Config

              An optional object containing the property "destructuring" with two possible values:

              • "any" (default) - If any variable in destructuring can be const, this rule warns for those variables.
              • "all" - Only warns if all variables in destructuring can be const.
              Examples
              "prefer-const": true
              "prefer-const": true,[object Object]
              Schema
              {
                "type": "object",
                "properties": {
                  "destructuring": {
                    "type": "string",
                    "enum": [
                      "all",
                      "any"
                    ]
                  }
                }
              }

              For more information see this page.

              There are no issues that match your filters.

              Category
              Status