TargetProcess/tauCharts

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

Summary

Maintainability
F
1 wk
Test Coverage

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

import {LayerLabelsModel, LayerLabelsModelObj} from './layer-labels-model';
import {ScaleFunction} from '../../definitions';
import {hasXOverflow, hasYOverflow} from '../../utils/utils';
var rules: {[alias: string]: LabelRule} = {};

Severity: Minor
Found in src/elements/decorators/layer-labels-rules.ts - About 6 hrs to fix

    Function alignByY has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    var alignByY = (exp) => {
        return (prev) => {
            return {
                dy: (row) => {
    
    
    Severity: Minor
    Found in src/elements/decorators/layer-labels-rules.ts - About 55 mins 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 alignByX has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    var alignByX = (exp) => {
        return (prev) => {
            return {
                dx: (row) => {
    
    
    Severity: Minor
    Found in src/elements/decorators/layer-labels-rules.ts - About 55 mins 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

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

    LayerLabelsRules
        .regRule('l', alignByX(['l', -1, null]))
        .regRule('L', alignByX(['L', -1, null]))
        .regRule('l+', alignByX(['l', -1, '+']))
        .regRule('l-', alignByX(['l', -1, '-']))
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 1 day to fix
    src/elements/decorators/layer-labels-rules.ts on lines 96..355

    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 247.

    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 alignByY = (exp) => {
        return (prev) => {
            return {
                dy: (row) => {
    
    
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 1 day to fix
    src/elements/decorators/layer-labels-rules.ts on lines 48..70

    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 221.

    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 alignByX = (exp) => {
        return (prev) => {
            return {
                dx: (row) => {
    
    
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 1 day to fix
    src/elements/decorators/layer-labels-rules.ts on lines 72..94

    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 221.

    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

                w: (row) => {
                    const reserved = prev.w(row);
                    if (prev.angle(row) === 0) {
                        const available = prev.model.size(row);
                        return ((available < reserved) ? available : reserved);
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 2 hrs to fix
    src/elements/decorators/layer-labels-rules.ts on lines 242..250

    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 80.

    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

                w: (row) => {
                    const reserved = prev.w(row);
                    if (prev.angle(row) === 0) {
                        const available = prev.model.size(row);
                        return ((available < reserved) ? available : reserved);
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 2 hrs to fix
    src/elements/decorators/layer-labels-rules.ts on lines 186..194

    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 80.

    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 5 locations. Consider refactoring.
    Open

                        const available = (prev.model.y0(row) < prev.model.yi(row) ?
                            (args.maxHeight - prev.model.yi(row)) :
                            (prev.model.yi(row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 4 other locations - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 271..273
    src/elements/decorators/layer-labels-rules.ts on lines 450..452
    src/elements/decorators/layer-labels-rules.ts on lines 459..461
    src/elements/decorators/layer-labels-rules.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 73.

    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 5 locations. Consider refactoring.
    Open

                    const available = (prev.model.y0(row) < prev.model.yi(row) ?
                        (args.maxWidth - prev.model.yi(row)) :
                        (prev.model.yi(row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 4 other locations - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 233..235
    src/elements/decorators/layer-labels-rules.ts on lines 271..273
    src/elements/decorators/layer-labels-rules.ts on lines 459..461
    src/elements/decorators/layer-labels-rules.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 73.

    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 5 locations. Consider refactoring.
    Open

                        const available = (prev.model.y0(row) < prev.model.yi(row) ?
                            (args.maxHeight - prev.model.yi(row)) :
                            (prev.model.yi(row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 4 other locations - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 233..235
    src/elements/decorators/layer-labels-rules.ts on lines 450..452
    src/elements/decorators/layer-labels-rules.ts on lines 459..461
    src/elements/decorators/layer-labels-rules.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 73.

    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 5 locations. Consider refactoring.
    Open

                    const available = (prev.model.y0(row) < prev.model.yi(row) ?
                        (args.maxWidth - prev.model.yi(row)) :
                        (prev.model.yi(row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 4 other locations - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 233..235
    src/elements/decorators/layer-labels-rules.ts on lines 271..273
    src/elements/decorators/layer-labels-rules.ts on lines 450..452
    src/elements/decorators/layer-labels-rules.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 73.

    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 5 locations. Consider refactoring.
    Open

                    const available = (prev.model.y0(row) < prev.model.yi(row) ?
                        (args.maxWidth - prev.model.yi(row)) :
                        (prev.model.yi(row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 4 other locations - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 233..235
    src/elements/decorators/layer-labels-rules.ts on lines 271..273
    src/elements/decorators/layer-labels-rules.ts on lines 450..452
    src/elements/decorators/layer-labels-rules.ts on lines 459..461

    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 73.

    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 getXPad = (prev, row) => ((prev.w(row) / 2) + Math.floor(prev.model.size(row) / getPadDivider(prev, row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 47..47

    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 57.

    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 getYPad = (prev, row) => ((prev.h(row) / 2) + Math.floor(prev.model.size(row) / getPadDivider(prev, row)));
    Severity: Major
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 1 hr to fix
    src/elements/decorators/layer-labels-rules.ts on lines 46..46

    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 57.

    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 inner = ['r-', 'l+', 'hide-by-label-height-horizontal', 'cut-label-horizontal']
                .map(LayerLabelsRules.getRule)
                .reduce((p, r) => LayerLabelsModel.compose(p, r(p, args)), prev);
    Severity: Minor
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 50 mins to fix
    src/elements/decorators/layer-labels-rules.ts on lines 385..387

    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 52.

    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 inner = ['t-', 'b+', 'hide-by-label-height-vertical', 'cut-label-vertical']
                .map(LayerLabelsRules.getRule)
                .reduce((p, r) => LayerLabelsModel.compose(p, r(p, args)), prev);
    Severity: Minor
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 50 mins to fix
    src/elements/decorators/layer-labels-rules.ts on lines 363..365

    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 52.

    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 outer = ['r+', 'l-', 'cut-outer-label-horizontal']
                .map(LayerLabelsRules.getRule)
                .reduce((p, r) => LayerLabelsModel.compose(p, r(p, args)), prev);
    Severity: Minor
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 50 mins to fix
    src/elements/decorators/layer-labels-rules.ts on lines 381..383

    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 51.

    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 outer = ['t+', 'b-', 'cut-outer-label-vertical']
                .map(LayerLabelsRules.getRule)
                .reduce((p, r) => LayerLabelsModel.compose(p, r(p, args)), prev);
    Severity: Minor
    Found in src/elements/decorators/layer-labels-rules.ts and 1 other location - About 50 mins to fix
    src/elements/decorators/layer-labels-rules.ts on lines 359..361

    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 51.

    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

    Shadowed name: 'prev'
    Open

            var getSign = (prev, row) => (prev.model.yi(row) - prev.model.y0(row) >= 0 ? 1 : -1);

    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.

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

            var getPad = (prev.model.flip ? getXPad : getYPad);

    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 innerStart = [

    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 betterInside = (row) => (innerStart.label(row).length >= outerEnd.label(row).length);

    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 h = prev.h(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.

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

            var outerEnd = [

    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 'betterInside' is never reassigned; use 'const' instead of 'var'.
    Open

            var betterInside = (row) => (innerStart.label(row).length >= outerEnd.label(row).length);

    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.

    Use the object spread operator instead.
    Open

            return Object.assign(
                {},
                outer,
                ['x', 'dx', 'hide', 'label'].reduce((obj, prop) => {
                    obj[prop] = (row) => ((betterInside(row) ? inner : outer)[prop](row));

    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 isNegative = (scale, row) => !scale.discrete && row[scale.dim] < 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 getXPad = (prev, row) => ((prev.w(row) / 2) + Math.floor(prev.model.size(row) / getPadDivider(prev, 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 outerEnd = [

    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 yPosition = outer.y(row, args) + outer.dy(row, 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.

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

            var innerStart = [

    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 'db' is never reassigned; use 'const' instead of 'var'.
    Open

                    var db = b - maxHeight;

    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 getSign = (prev, row) => (prev.model.yi(row) - prev.model.y0(row) >= 0 ? 1 : -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 = prev.angle(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.

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

        var pad = 5 - (labelInfo.lines.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 'outer' is never reassigned; use 'const' instead of 'var'.
    Open

            var outer = ['t+', 'b-', 'cut-outer-label-vertical']

    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' is never reassigned; use 'const' instead of 'var'.
    Open

                    var y = prev.y(row) + prev.dy(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 'alignByY' is never reassigned; use 'const' instead of 'var'.
    Open

    var alignByY = (exp) => {

    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.

    non-arrow functions are forbidden
    Open

            .map(function (line, lineIndex) {

    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 'ordinateScale' is never reassigned; use 'const' instead of 'var'.
    Open

                    var ordinateScale = prev.model.scaleY;

    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 'padKoeff' is never reassigned; use 'const' instead of 'var'.
    Open

                var padKoeff = lineBreakAvailable ? -0.5 : 0.5;

    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 'innerStart' is never reassigned; use 'const' instead of 'var'.
    Open

            var innerStart = [

    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' is never reassigned; use 'const' instead of 'var'.
    Open

                    var x = prev.x(row) + dx;

    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 'l' is never reassigned; use 'const' instead of 'var'.
    Open

                    var l = x - w / 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 'y' is never reassigned; use 'const' instead of 'var'.
    Open

                    var y = prev.y(row) + dy;

    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 'b' is never reassigned; use 'const' instead of 'var'.
    Open

                    var b = y + h / 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 alignByY = (exp) => {

    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 innerStart = [

    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 outer = ['t+', 'b-', 'cut-outer-label-vertical']

    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 = x + w / 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.

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

                    var u = (exp[0] === exp[0].toUpperCase()) ? 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 'yi' is never reassigned; use 'const' instead of 'var'.
    Open

            var yi = (row) => prev.model.yi(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 'getSign' is never reassigned; use 'const' instead of 'var'.
    Open

            var getSign = (prev, row) => (prev.model.yi(row) - prev.model.y0(row) >= 0 ? 1 : -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 'r' is never reassigned; use 'const' instead of 'var'.
    Open

                    var r = x + w / 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 'dy' is never reassigned; use 'const' instead of 'var'.
    Open

                    var dy = prev.dy(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 'isNegative' is never reassigned; use 'const' instead of 'var'.
    Open

    var isNegative = (scale, row) => !scale.discrete && row[scale.dim] < 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.

    Use the object spread operator instead.
    Open

            return Object.assign(
                {},
                innerStart,
                ['x', 'dx', 'hide', 'label'].reduce((obj, prop) => {
                    obj[prop] = (row) => ((betterInside(row) ? innerStart : outerEnd)[prop](row));

    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.

    Use the object spread operator instead.
    Open

            return Object.assign(
                {},
                innerStart,
                ['y', 'dy', 'hide', 'label'].reduce((obj, prop) => {
                    obj[prop] = (row) => ((betterInside(row) ? innerStart : outerEnd)[prop](row));

    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 padKoeff = lineBreakAvailable ? -0.5 : 0.5;

    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 ('{dy}').
    Open

            return (prev.model.flip ? {dx: dy} : {dy: dy});

    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.

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

            var overflowCount = data.reduce((memo, row) => (memo + (out(row) ? 1 : 0)), 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 isRot = ((overflowCount / data.length) > 0.5);

    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 outer = ['r+', 'l-', 'cut-outer-label-horizontal']

    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 t = y - h / 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 dt = 0 - t;

    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 'out' is never reassigned; use 'const' instead of 'var'.
    Open

            var out = ((row) => prev.model.size(row) < prev.w(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 'dl' is never reassigned; use 'const' instead of 'var'.
    Open

                    var dl = 0 - l;

    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 k = (exp[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 y0 = (row) => prev.model.y0(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 yi = (row) => prev.model.yi(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 inner = ['t-', 'b+', 'hide-by-label-height-vertical', 'cut-label-vertical']

    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 'outer' is never reassigned; use 'const' instead of 'var'.
    Open

            var outer = ['r+', 'l-', 'cut-outer-label-horizontal']

    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 'yPosition' is never reassigned; use 'const' instead of 'var'.
    Open

                var yPosition = outer.y(row, args) + outer.dy(row, 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 't' is never reassigned; use 'const' instead of 'var'.
    Open

                    var t = y - h / 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.

    Use the object spread operator instead.
    Open

            return Object.assign(
                {},
                outer,
                ['y', 'dy', 'hide', 'label'].reduce((obj, prop) => {
                    obj[prop] = (row) => ((betterInside(row) ? inner : outer)[prop](row, args));

    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 alignByX = (exp) => {

    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 = (exp[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 dy = (row) => (getSign(prev, row) * getPad(prev, 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 betterInside = (row) => (innerStart.label(row).length >= outerEnd.label(row).length);

    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 betterInside = (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 x = prev.x(row) + dx;

    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 'k' is never reassigned; use 'const' instead of 'var'.
    Open

                    var k = (exp[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 'dr' is never reassigned; use 'const' instead of 'var'.
    Open

                    var dr = r - maxWidth;

    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 u = (exp[0] === exp[0].toUpperCase()) ? 1 : 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 changes = {};

    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 dl = 0 - l;

    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 db = b - maxHeight;

    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 'labelInfo' is never reassigned; use 'const' instead of 'var'.
    Open

        var labelInfo = prev.labelLinesAndSeparator(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 'isRot' is never reassigned; use 'const' instead of 'var'.
    Open

            var isRot = ((overflowCount / data.length) > 0.5);

    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 'dy' is never reassigned; use 'const' instead of 'var'.
    Open

            var dy = (row) => (getSign(prev, row) * getPad(prev, 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 'betterInside' is never reassigned; use 'const' instead of 'var'.
    Open

            var betterInside = (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 'x' is never reassigned; use 'const' instead of 'var'.
    Open

                    var x = prev.x(row) + prev.dx(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.

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

    var getPadDivider = (prev, row): number => {

    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 'getPadDivider' is never reassigned; use 'const' instead of 'var'.
    Open

    var getPadDivider = (prev, row): number => {

    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 pad = 5 - (labelInfo.lines.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.

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

    var getXPad = (prev, row) => ((prev.w(row) / 2) + Math.floor(prev.model.size(row) / getPadDivider(prev, 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 'getYPad' is never reassigned; use 'const' instead of 'var'.
    Open

    var getYPad = (prev, row) => ((prev.h(row) / 2) + Math.floor(prev.model.size(row) / getPadDivider(prev, 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.

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

                    var u = (exp[0] === exp[0].toUpperCase()) ? 1 : 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.

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

            var getPad = (prev.model.flip ? getXPad : getYPad);

    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 'w' is never reassigned; use 'const' instead of 'var'.
    Open

                    var w = prev.w(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.

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

        var labelInfo = prev.labelLinesAndSeparator(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 betterInside = (row) => (inner.label(row).length > outer.label(row).length);

    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 dy = prev.dy(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.

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

                    var u = (exp[0] === exp[0].toUpperCase()) ? 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 'overflowCount' is never reassigned; use 'const' instead of 'var'.
    Open

            var overflowCount = data.reduce((memo, row) => (memo + (out(row) ? 1 : 0)), 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 'betterInside' is never reassigned; use 'const' instead of 'var'.
    Open

            var betterInside = (row) => (innerStart.label(row).length >= outerEnd.label(row).length);

    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 isPositive = (scale, row) => scale.discrete || (!scale.discrete && row[scale.dim] >= 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 inner = ['r-', 'l+', 'hide-by-label-height-horizontal', 'cut-label-horizontal']

    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 dx = prev.dx(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 w = prev.w(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 x = prev.x(row) + prev.dx(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.

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

            var inner = ['t-', 'b+', 'hide-by-label-height-vertical', 'cut-label-vertical']

    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 'h' is never reassigned; use 'const' instead of 'var'.
    Open

                    var h = prev.h(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 'isPositive' is never reassigned; use 'const' instead of 'var'.
    Open

    var isPositive = (scale, row) => scale.discrete || (!scale.discrete && row[scale.dim] >= 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 'alignByX' is never reassigned; use 'const' instead of 'var'.
    Open

    var alignByX = (exp) => {

    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 out = ((row) => prev.model.size(row) < prev.w(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 dr = r - maxWidth;

    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 = prev.y(row) + prev.dy(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.

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

            var inner = ['r-', 'l+', 'hide-by-label-height-horizontal', 'cut-label-horizontal']

    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.

    Use a conditional expression instead of assigning to 'available' in multiple places.
    Open

                    if (prev.angle(row) === 0) {

    Rule: prefer-conditional-expression

    Recommends to use a conditional expression instead of assigning to the same thing in each branch of an if statement.

    Rationale

    This reduces duplication and can eliminate an unnecessary variable declaration.

    Config

    If check-else-if is specified, the rule also checks nested if-else-if statements.

    Examples
    "prefer-conditional-expression": true
    "prefer-conditional-expression": true,check-else-if
    Schema
    {
      "type": "string",
      "enum": [
        "check-else-if"
      ]
    }

    For more information see this page.

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

    var rules: {[alias: string]: LabelRule} = {};

    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 ordinateScale = prev.model.scaleY;

    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 ordinateScale = prev.model.scaleY;

    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 outerEnd = [

    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 = x - w / 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 = prev.y(row) + dy;

    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 'betterInside' is never reassigned; use 'const' instead of 'var'.
    Open

            var betterInside = (row) => (inner.label(row).length > outer.label(row).length);

    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 'angle' is never reassigned; use 'const' instead of 'var'.
    Open

                    var angle = prev.angle(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 'rules' is never reassigned; use 'const' instead of 'var'.
    Open

    var rules: {[alias: string]: LabelRule} = {};

    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 getYPad = (prev, row) => ((prev.h(row) / 2) + Math.floor(prev.model.size(row) / getPadDivider(prev, 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 b = y + h / 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.

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

                    var ordinateScale = prev.model.scaleY;

    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 = (exp[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 'y0' is never reassigned; use 'const' instead of 'var'.
    Open

            var y0 = (row) => prev.model.y0(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 'outerEnd' is never reassigned; use 'const' instead of 'var'.
    Open

            var outerEnd = [

    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 'dx' is never reassigned; use 'const' instead of 'var'.
    Open

                    var dx = prev.dx(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 'dt' is never reassigned; use 'const' instead of 'var'.
    Open

                    var dt = 0 - t;

    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