Showing 109 of 111 total issues
" should be ' Open
import { PipesModule } from "./../pipes/pipes.module";
- Read upRead up
- Exclude checks
Rule: quotemark
Enforces quote character for string literals.
Notes
- Has Fix
Config
Five arguments may be optionally provided:
-
"single"
enforces single quotes. -
"double"
enforces double quotes. -
"backtick"
enforces backticks. -
"jsx-single"
enforces single quotes for JSX attributes. -
"jsx-double"
enforces double quotes for JSX attributes. -
"avoid-template"
forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if"avoid-escape"
is enabled and both single and double quotes are present in the string (the latter option takes precedence). -
"avoid-escape"
allows you to use the "other" quotemark in cases where escaping would normally be required. For example,[true, "double", "avoid-escape"]
would not report a failure on the string literal'Hello "World"'
.
Examples
"quotemark": true,single,avoid-escape,avoid-template
"quotemark": true,single,jsx-double
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"single",
"double",
"backtick",
"jsx-single",
"jsx-double",
"avoid-escape",
"avoid-template"
]
},
"minLength": 0,
"maxLength": 5
}
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: 'pbutton',
- Read upRead up
- Exclude checks
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.
" should be ' Open
} from "@angular/core";
- Read upRead up
- Exclude checks
Rule: quotemark
Enforces quote character for string literals.
Notes
- Has Fix
Config
Five arguments may be optionally provided:
-
"single"
enforces single quotes. -
"double"
enforces double quotes. -
"backtick"
enforces backticks. -
"jsx-single"
enforces single quotes for JSX attributes. -
"jsx-double"
enforces double quotes for JSX attributes. -
"avoid-template"
forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if"avoid-escape"
is enabled and both single and double quotes are present in the string (the latter option takes precedence). -
"avoid-escape"
allows you to use the "other" quotemark in cases where escaping would normally be required. For example,[true, "double", "avoid-escape"]
would not report a failure on the string literal'Hello "World"'
.
Examples
"quotemark": true,single,avoid-escape,avoid-template
"quotemark": true,single,jsx-double
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"single",
"double",
"backtick",
"jsx-single",
"jsx-double",
"avoid-escape",
"avoid-template"
]
},
"minLength": 0,
"maxLength": 5
}
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: 'pdialog',
- Read upRead up
- Exclude checks
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.
The selector should be prefixed by "uc" (https://angular.io/guide/styleguide#style-02-07) Open
selector: 'picon-button',
- Read upRead up
- Exclude checks
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.
if statements must be braced Open
if (isNullOrUndefined(markdown)) return null;
- Read upRead up
- Exclude checks
Rule: curly
Enforces braces for if
/for
/do
/while
statements.
Rationale
if (foo === bar)
foo++;
bar++;
In the code above, the author almost certainly meant for both foo++
and bar++
to be executed only if foo === bar
. However, they forgot braces and bar++
will be executed
no matter what. This rule could prevent such a mistake.
Notes
- Has Fix
Config
One of the following options may be provided:
-
"as-needed"
forbids any unnecessary curly braces. -
"ignore-same-line"
skips checking braces for control-flow statements that are on one line and start on the same line as their control-flow keyword
Examples
"curly": true
"curly": true,ignore-same-line
"curly": true,as-needed
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"as-needed",
"ignore-same-line"
]
}
}
For more information see this page.
Type boolean trivially inferred from a boolean literal, remove type annotation Open
@Input() latexEnableTooltips: boolean = false;
- Read upRead up
- Exclude checks
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 thetypedef
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.
" should be ' Open
import { SelectModule } from "ng2-select";
- Read upRead up
- Exclude checks
Rule: quotemark
Enforces quote character for string literals.
Notes
- Has Fix
Config
Five arguments may be optionally provided:
-
"single"
enforces single quotes. -
"double"
enforces double quotes. -
"backtick"
enforces backticks. -
"jsx-single"
enforces single quotes for JSX attributes. -
"jsx-double"
enforces double quotes for JSX attributes. -
"avoid-template"
forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if"avoid-escape"
is enabled and both single and double quotes are present in the string (the latter option takes precedence). -
"avoid-escape"
allows you to use the "other" quotemark in cases where escaping would normally be required. For example,[true, "double", "avoid-escape"]
would not report a failure on the string literal'Hello "World"'
.
Examples
"quotemark": true,single,avoid-escape,avoid-template
"quotemark": true,single,jsx-double
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"single",
"double",
"backtick",
"jsx-single",
"jsx-double",
"avoid-escape",
"avoid-template"
]
},
"minLength": 0,
"maxLength": 5
}
For more information see this page.
" should be ' Open
import { BrowserModule } from "@angular/platform-browser";
- Read upRead up
- Exclude checks
Rule: quotemark
Enforces quote character for string literals.
Notes
- Has Fix
Config
Five arguments may be optionally provided:
-
"single"
enforces single quotes. -
"double"
enforces double quotes. -
"backtick"
enforces backticks. -
"jsx-single"
enforces single quotes for JSX attributes. -
"jsx-double"
enforces double quotes for JSX attributes. -
"avoid-template"
forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if"avoid-escape"
is enabled and both single and double quotes are present in the string (the latter option takes precedence). -
"avoid-escape"
allows you to use the "other" quotemark in cases where escaping would normally be required. For example,[true, "double", "avoid-escape"]
would not report a failure on the string literal'Hello "World"'
.
Examples
"quotemark": true,single,avoid-escape,avoid-template
"quotemark": true,single,jsx-double
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"single",
"double",
"backtick",
"jsx-single",
"jsx-double",
"avoid-escape",
"avoid-template"
]
},
"minLength": 0,
"maxLength": 5
}
For more information see this page.
Declaration of static method not allowed after declaration of instance method. Instead, this should come after instance fields. Open
static getLatex(converter: Showdown.Converter, text: string): string {
if (isNullOrUndefined(text)) {
return null;
}
return ConfigurationService.converter.makeHtml(text.toString()).replace(/(?:\[@)([^\]]*)(?:\])/g, (match, dec) => {
- Read upRead up
- Exclude checks
Rule: member-ordering
Enforces member ordering.
Rationale
A consistent ordering for class members can make classes easier to read, navigate, and edit.
A common opposite practice to member-ordering
is to keep related groups of classes together.
Instead of creating classes with multiple separate groups, consider splitting class responsibilities
apart across multiple single-responsibility classes.
Notes
- Has Fix
Config
One argument, which is an object, must be provided. It should contain an order
property.
The order
property should have a value of one of the following strings:
fields-first
instance-sandwich
statics-first
fields-first
puts, in order of precedence:
* fields before constructors before methods
* static members before instance members
* public members before protected members before private members
instance-sandwich
puts, in order of precedence:
* fields before constructors before methods
* static fields before instance fields, but static methods after instance methods
* public members before protected members before private members
statics-first
puts, in order of precedence:
* static members before instance members
* public members before protected members before private members
* fields before methods
* instance fields before constructors before instance methods
* fields before constructors before methods
* public members before protected members before private members
Note that these presets, despite looking similar, can have subtly different behavior due to the order in which these
rules are specified. A fully expanded ordering can be found in the PRESETS constant in
https://github.com/palantir/tslint/blob/master/src/rules/memberOrderingRule.ts.
(You may need to check the version of the file corresponding to your version of tslint.)
Alternatively, the value for order
may be an array consisting of the following strings:
public-static-field
protected-static-field
private-static-field
public-static-method
private-static-method
protected-static-method
public-instance-field
protected-instance-field
private-instance-field
public-constructor
protected-constructor
private-constructor
public-instance-method
protected-instance-method
private-instance-method
public-static-accessor
protected-static-accessor
private-static-accessor
public-instance-accessor
protected-instance-accessor
private-instance-accessor
You can also omit the access modifier to refer to "public-", "protected-", and "private-" all at once; for example, "static-field".
You can also make your own categories by using an object instead of a string:
{
"name": "static non-private",
"kinds": [
"public-static-field",
"protected-static-field",
"public-static-method",
"protected-static-method"
]
}
The 'alphabetize' option will enforce that members within the same category should be alphabetically sorted by name. Computed property names are sorted before others but not sorted amongst each other. Additionally getters will be sorted before setters (after alphabetization).
Examples
"member-ordering": true,[object Object]
"member-ordering": true,[object Object]
"member-ordering": true,[object Object]
Schema
{
"type": "object",
"properties": {
"alphabetize": {
"type": "boolean"
},
"order": {
"oneOf": [
{
"type": "string",
"enum": [
"fields-first",
"instance-sandwich",
"statics-first"
]
},
{
"type": "array",
"items": {
"type": "string",
"enum": [
"public-static-field",
"protected-static-field",
"private-static-field",
"public-static-method",
"private-static-method",
"protected-static-method",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"public-constructor",
"protected-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method",
"public-static-accessor",
"protected-static-accessor",
"private-static-accessor",
"public-instance-accessor",
"protected-instance-accessor",
"private-instance-accessor"
]
},
"maxLength": 13
}
]
}
},
"additionalProperties": false
}
For more information see this page.
Type boolean trivially inferred from a boolean literal, remove type annotation Open
@Input() detailsDisplayTooltips: boolean = false;
- Read upRead up
- Exclude checks
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 thetypedef
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.
Type boolean trivially inferred from a boolean literal, remove type annotation Open
@Input() tooltipAsText: boolean = true;
- Read upRead up
- Exclude checks
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 thetypedef
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.
The selector should be kebab-cased and include a dash (https://angular.io/guide/styleguide#style-05-02) Open
selector: 'generictable',
- Read upRead up
- Exclude checks
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.
The selector should be kebab-cased and include a dash (https://angular.io/guide/styleguide#style-05-02) Open
selector: 'footnote',
- Read upRead up
- Exclude checks
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.
file should end with a newline Open
}
- Read upRead up
- Exclude checks
Rule: eofline
Ensures the file ends with a newline.
Fix for single-line files is not supported.
Rationale
It is a standard convention to end files with a newline.
Notes
- Has Fix
Config
Not configurable.
Examples
"eofline": true
For more information see this page.
" should be ' Open
import { NgModule } from "@angular/core";
- Read upRead up
- Exclude checks
Rule: quotemark
Enforces quote character for string literals.
Notes
- Has Fix
Config
Five arguments may be optionally provided:
-
"single"
enforces single quotes. -
"double"
enforces double quotes. -
"backtick"
enforces backticks. -
"jsx-single"
enforces single quotes for JSX attributes. -
"jsx-double"
enforces double quotes for JSX attributes. -
"avoid-template"
forbids single-line untagged template strings that do not contain string interpolations. Note that backticks may still be used if"avoid-escape"
is enabled and both single and double quotes are present in the string (the latter option takes precedence). -
"avoid-escape"
allows you to use the "other" quotemark in cases where escaping would normally be required. For example,[true, "double", "avoid-escape"]
would not report a failure on the string literal'Hello "World"'
.
Examples
"quotemark": true,single,avoid-escape,avoid-template
"quotemark": true,single,jsx-double
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"single",
"double",
"backtick",
"jsx-single",
"jsx-double",
"avoid-escape",
"avoid-template"
]
},
"minLength": 0,
"maxLength": 5
}
For more information see this page.
Missing radix parameter Open
a = b = -1 * Number.parseInt(splits[1]);
- Read upRead up
- Exclude checks
Rule: radix
Requires the radix parameter to be specified when calling parseInt
.
Rationale
From MDN:
Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.
Config
Not configurable.
Examples
"radix": true
For more information see this page.
Missing radix parameter Open
b = Number.parseInt(splits[0]);
- Read upRead up
- Exclude checks
Rule: radix
Requires the radix parameter to be specified when calling parseInt
.
Rationale
From MDN:
Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.
Config
Not configurable.
Examples
"radix": true
For more information see this page.
Missing radix parameter Open
a = -1 * Number.parseInt(splits[0]);
- Read upRead up
- Exclude checks
Rule: radix
Requires the radix parameter to be specified when calling parseInt
.
Rationale
From MDN:
Always specify this parameter to eliminate reader confusion and to guarantee predictable behavior. Different implementations produce different results when a radix is not specified, usually defaulting the value to 10.
Config
Not configurable.
Examples
"radix": true
For more information see this page.
Type string trivially inferred from a string literal, remove type annotation Open
@Input() bodyTitle: string = ''
- Read upRead up
- Exclude checks
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 thetypedef
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.