Showing 51 of 52 total issues
'namespace' and 'module' are disallowed Open
export namespace JWT {
export interface SignOptions {
/**
* Signature algorithm. Could be one of these values :
* - HS256: HMAC using SHA-256 hash algorithm (default)
- Read upRead up
- Exclude checks
Rule: no-namespace
Disallows use of internal module
s and namespace
s.
This rule still allows the use of declare module ... {}
Rationale
ES6-style external modules are the standard way to modularize code.
Using module {}
and namespace {}
are outdated ways to organize TypeScript code.
Notes
- TypeScript Only
Config
One argument may be optionally provided:
-
allow-declarations
allowsdeclare namespace ... {}
to describe external APIs.
Examples
"no-namespace": true
"no-namespace": true,allow-declarations
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"allow-declarations"
]
},
"minLength": 0,
"maxLength": 1
}
For more information see this page.
Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t> Open
[index: string]: Array<[Constructor, string]>;
- Read upRead up
- Exclude checks
Rule: array-type
Requires using either 'T[]' or 'Array<t>' for arrays.</t>
Notes
- TypeScript Only
- Has Fix
Config
One of the following arguments must be provided:
-
"array"
enforces use ofT[]
for all types T. -
"generic"
enforces use ofArray<T>
for all types T. -
"array-simple"
enforces use ofT[]
ifT
is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
"type": "string",
"enum": [
"array",
"generic",
"array-simple"
]
}
For more information see this page.
== should be === Open
export const isFunction = (target: Instance, propertyKey: string | symbol) => (propertyKey && typeof (target as any)[propertyKey] == "function" && propertyKey != "constructor");
- Read upRead up
- Exclude checks
Rule: triple-equals
Requires ===
and !==
in place of ==
and !=
.
Config
Two arguments may be optionally provided:
-
"allow-null-check"
allows==
and!=
when comparing tonull
. -
"allow-undefined-check"
allows==
and!=
when comparing toundefined
.
Examples
"triple-equals": true
"triple-equals": true,allow-null-check
"triple-equals": true,allow-undefined-check
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"allow-null-check",
"allow-undefined-check"
]
},
"minLength": 0,
"maxLength": 2
}
For more information see this page.
Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t> Open
export const autowiredPropsStore = new WeakMap<object, Array<string | symbol>>();
- Read upRead up
- Exclude checks
Rule: array-type
Requires using either 'T[]' or 'Array<t>' for arrays.</t>
Notes
- TypeScript Only
- Has Fix
Config
One of the following arguments must be provided:
-
"array"
enforces use ofT[]
for all types T. -
"generic"
enforces use ofArray<T>
for all types T. -
"array-simple"
enforces use ofT[]
ifT
is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
"type": "string",
"enum": [
"array",
"generic",
"array-simple"
]
}
For more information see this page.
Parentheses are required when invoking a constructor Open
const ctrl: IController = Object.assign(new classType, target);
- Read upRead up
- Exclude checks
Rule: new-parens
Requires parentheses when invoking a constructor via the new
keyword.
Rationale
Maintains stylistic consistency with other function calls.
Config
Not configurable.
Examples
"new-parens": true
For more information see this page.
Calls to 'console.log' are not allowed. Open
console.log(error);
- Read upRead up
- Exclude checks
Rule: no-console
Bans the use of specified console
methods.
Rationale
In general, console
methods aren't appropriate for production code.
Config
A list of method names to ban. If no method names are provided, all console methods are banned.
Examples
"no-console": true,log,error
Schema
{
"type": "array",
"items": {
"type": "string"
}
}
For more information see this page.
block is empty Open
protected onDisconnect(reason: string) {}
- Read upRead up
- Exclude checks
Rule: no-empty
Disallows empty blocks.
Blocks with a comment inside are not considered empty.
Rationale
Empty blocks are often indicators of missing code.
Config
If allow-empty-catch
is specified, then catch blocks are allowed to be empty.
If allow-empty-functions
is specified, then function definitions are allowed to be empty.
Examples
"no-empty": true
"no-empty": true,allow-empty-catch
"no-empty": true,allow-empty-functions
"no-empty": true,allow-empty-catch,allow-empty-functions
Schema
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"enum": [
"allow-empty-catch"
]
},
{
"type": "string",
"enum": [
"allow-empty-functions"
]
}
]
}
}
For more information see this page.
asterisks in jsdoc must be aligned Open
*@member {string} - Max age of token
- Read upRead up
- Exclude checks
Rule: jsdoc-format
Enforces basic format rules for JSDoc comments.
The following rules are enforced for JSDoc comments (comments starting with /**
):
- each line contains an asterisk and asterisks must be aligned
- each asterisk must be followed by either a space or a newline (except for the first and the last)
- the only characters before the asterisk on each line must be whitespace characters
- one line comments must start with
/**
and end with*/
- multiline comments don't allow text after
/**
in the first line (with option"check-multiline-start"
)
Rationale
Helps maintain a consistent, readable style for JSDoc comments.
Config
You can optionally specify the option "check-multiline-start"
to enforce the first line of a
multiline JSDoc comment to be empty.
Examples
"jsdoc-format": true
"jsdoc-format": true,check-multiline-start
Schema
{
"type": "array",
"minItems": 0,
"maxItems": 1,
"items": {
"type": "string",
"enum": [
"check-multiline-start"
]
}
}
For more information see this page.
asterisks in jsdoc must be aligned Open
*/
- Read upRead up
- Exclude checks
Rule: jsdoc-format
Enforces basic format rules for JSDoc comments.
The following rules are enforced for JSDoc comments (comments starting with /**
):
- each line contains an asterisk and asterisks must be aligned
- each asterisk must be followed by either a space or a newline (except for the first and the last)
- the only characters before the asterisk on each line must be whitespace characters
- one line comments must start with
/**
and end with*/
- multiline comments don't allow text after
/**
in the first line (with option"check-multiline-start"
)
Rationale
Helps maintain a consistent, readable style for JSDoc comments.
Config
You can optionally specify the option "check-multiline-start"
to enforce the first line of a
multiline JSDoc comment to be empty.
Examples
"jsdoc-format": true
"jsdoc-format": true,check-multiline-start
Schema
{
"type": "array",
"minItems": 0,
"maxItems": 1,
"items": {
"type": "string",
"enum": [
"check-multiline-start"
]
}
}
For more information see this page.
non-arrow functions are forbidden Open
descriptor.value = function(...args: any[]) {
- Read upRead up
- Exclude checks
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 expressionfunction foo() {}
but notfunction() {}
.
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.
Calls to 'console.log' are not allowed. Open
console.log(`Unexpected dependency {${dependency}}`);
- Read upRead up
- Exclude checks
Rule: no-console
Bans the use of specified console
methods.
Rationale
In general, console
methods aren't appropriate for production code.
Config
A list of method names to ban. If no method names are provided, all console methods are banned.
Examples
"no-console": true,log,error
Schema
{
"type": "array",
"items": {
"type": "string"
}
}
For more information see this page.
block is empty Open
protected onError(error: Error) {}
- Read upRead up
- Exclude checks
Rule: no-empty
Disallows empty blocks.
Blocks with a comment inside are not considered empty.
Rationale
Empty blocks are often indicators of missing code.
Config
If allow-empty-catch
is specified, then catch blocks are allowed to be empty.
If allow-empty-functions
is specified, then function definitions are allowed to be empty.
Examples
"no-empty": true
"no-empty": true,allow-empty-catch
"no-empty": true,allow-empty-functions
"no-empty": true,allow-empty-catch,allow-empty-functions
Schema
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"enum": [
"allow-empty-catch"
]
},
{
"type": "string",
"enum": [
"allow-empty-functions"
]
}
]
}
}
For more information see this page.
block is empty Open
protected configure() {}
- Read upRead up
- Exclude checks
Rule: no-empty
Disallows empty blocks.
Blocks with a comment inside are not considered empty.
Rationale
Empty blocks are often indicators of missing code.
Config
If allow-empty-catch
is specified, then catch blocks are allowed to be empty.
If allow-empty-functions
is specified, then function definitions are allowed to be empty.
Examples
"no-empty": true
"no-empty": true,allow-empty-catch
"no-empty": true,allow-empty-functions
"no-empty": true,allow-empty-catch,allow-empty-functions
Schema
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"enum": [
"allow-empty-catch"
]
},
{
"type": "string",
"enum": [
"allow-empty-functions"
]
}
]
}
}
For more information see this page.
forbidden eval Open
return eval(fncDef);
- Read upRead up
- Exclude checks
Rule: no-eval
Disallows eval
function invocations.
Rationale
eval()
is dangerous as it allows arbitrary code execution with full privileges. There are
alternatives
for most of the use cases for eval()
.
Config
Not configurable.
Examples
"no-eval": true
For more information see this page.
non-arrow functions are forbidden Open
return function(target: Instance, property: string | symbol, descriptor: PropertyDescriptor) {
- Read upRead up
- Exclude checks
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 expressionfunction foo() {}
but notfunction() {}
.
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.
Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t> Open
private async injectByConstructor<T>(classType: Constructor<T>, ctrArgs: any[] = []): Promise<Array<unknown>> {
- Read upRead up
- Exclude checks
Rule: array-type
Requires using either 'T[]' or 'Array<t>' for arrays.</t>
Notes
- TypeScript Only
- Has Fix
Config
One of the following arguments must be provided:
-
"array"
enforces use ofT[]
for all types T. -
"generic"
enforces use ofArray<T>
for all types T. -
"array-simple"
enforces use ofT[]
ifT
is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
"type": "string",
"enum": [
"array",
"generic",
"array-simple"
]
}
For more information see this page.
Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t> Open
private getInjectableProps(prototype: Constructor): Array<string | symbol> {
- Read upRead up
- Exclude checks
Rule: array-type
Requires using either 'T[]' or 'Array<t>' for arrays.</t>
Notes
- TypeScript Only
- Has Fix
Config
One of the following arguments must be provided:
-
"array"
enforces use ofT[]
for all types T. -
"generic"
enforces use ofArray<T>
for all types T. -
"array-simple"
enforces use ofT[]
ifT
is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
"type": "string",
"enum": [
"array",
"generic",
"array-simple"
]
}
For more information see this page.
block is empty Open
protected afterDependeciesLoad() {}
- Read upRead up
- Exclude checks
Rule: no-empty
Disallows empty blocks.
Blocks with a comment inside are not considered empty.
Rationale
Empty blocks are often indicators of missing code.
Config
If allow-empty-catch
is specified, then catch blocks are allowed to be empty.
If allow-empty-functions
is specified, then function definitions are allowed to be empty.
Examples
"no-empty": true
"no-empty": true,allow-empty-catch
"no-empty": true,allow-empty-functions
"no-empty": true,allow-empty-catch,allow-empty-functions
Schema
{
"type": "array",
"items": {
"anyOf": [
{
"type": "string",
"enum": [
"allow-empty-catch"
]
},
{
"type": "string",
"enum": [
"allow-empty-functions"
]
}
]
}
}
For more information see this page.
Array type using 'Array<t>' is forbidden. Use 'T[]' instead.</t> Open
export function getDtoProps(prototype: Constructor | Propotype): Array<string | symbol> {
- Read upRead up
- Exclude checks
Rule: array-type
Requires using either 'T[]' or 'Array<t>' for arrays.</t>
Notes
- TypeScript Only
- Has Fix
Config
One of the following arguments must be provided:
-
"array"
enforces use ofT[]
for all types T. -
"generic"
enforces use ofArray<T>
for all types T. -
"array-simple"
enforces use ofT[]
ifT
is a simple type (primitive or type reference).
Examples
"array-type": true,array
"array-type": true,generic
"array-type": true,array-simple
Schema
{
"type": "string",
"enum": [
"array",
"generic",
"array-simple"
]
}
For more information see this page.
Calls to 'console.log' are not allowed. Open
console.log(chalk.yellow(`⚠ ${text}`));
- Read upRead up
- Exclude checks
Rule: no-console
Bans the use of specified console
methods.
Rationale
In general, console
methods aren't appropriate for production code.
Config
A list of method names to ban. If no method names are provided, all console methods are banned.
Examples
"no-console": true,log,error
Schema
{
"type": "array",
"items": {
"type": "string"
}
}
For more information see this page.