ultimate-comparisons/ultimate-comparison-BASE

View on GitHub
src/app/components/output/references-table/references-table.component.ts

Summary

Maintainability
A
0 mins
Test Coverage

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

        let citations: Array<Citation> = [];

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.

The selector should be kebab-cased and include a dash (https://angular.io/guide/styleguide#style-05-02)
Open

    selector: 'referencestable',

Rule: component-selector

Component selectors should follow given naming rules.

See more at https://angular.io/guide/styleguide#style-02-07, https://angular.io/guide/styleguide#style-05-02 and https://angular.io/guide/styleguide#style-05-03.

Rationale
  • Consistent conventions make it easy to quickly identify and reference assets of different types.
  • Makes it easier to promote and share the component in other apps.
  • Components are easy to identify in the DOM.
  • Keeps the element names consistent with the specification for Custom Elements.
  • Components have templates containing HTML and optional Angular template syntax.
  • They display content. Developers place components on the page as they would native HTML elements and WebComponents.
  • It is easier to recognize that a symbol is a component by looking at the template's HTML.
Notes
  • TypeScript Only

Config

Options accept three obligatory items as an array: 1. element or attribute forces components to be used as either elements, attributes, or both (not recommended) 2. A single prefix (string) or array of prefixes (strings) which have to be used in component selectors. 3. kebab-case or camelCase allows you to pick a case.

Examples
"component-selector": true,element,my-prefix,kebab-case
"component-selector": true,element,ng,ngx,kebab-case
"component-selector": true,attribute,myPrefix,camelCase
"component-selector": true,element,attribute,myPrefix,camelCase
Schema
{
  "items": [
    {
      "enum": [
        "attribute",
        "element"
      ]
    },
    {
      "oneOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "string"
        }
      ]
    },
    {
      "enum": [
        "camelCase",
        "kebab-case"
      ]
    }
  ],
  "maxLength": 3,
  "minLength": 3,
  "type": "array"
}

For more information see this page.

Type number trivially inferred from a number literal, remove type annotation
Open

    @Input() changeNum: number = 0;

Rule: no-inferrable-types

Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean.

Rationale

Explicit types where they can be easily inferred by the compiler make code more verbose.

Notes
  • TypeScript Only
  • Has Fix

Config

Two arguments may be optionally provided:

  • ignore-params allows specifying an inferrable type annotation for function params. This can be useful when combining with the typedef rule.
  • ignore-properties allows specifying an inferrable type annotation for class properties.
Examples
"no-inferrable-types": true
"no-inferrable-types": true,ignore-params
"no-inferrable-types": true,ignore-params,ignore-properties
Schema
{
  "type": "array",
  "items": {
    "type": "string",
    "enum": [
      "ignore-params",
      "ignore-properties"
    ]
  },
  "minLength": 0,
  "maxLength": 2
}

For more information see this page.

There are no issues that match your filters.

Category
Status