Function createRequestCoordinator
has 206 lines of code (exceeds 100 allowed). Consider refactoring. Open
export const createRequestCoordinator = <Props, NewProps>(attributes: Attributes<Props, NewProps>) => (WrappedComponent: React.ComponentType<NewProps>) => {
const {
transformParams,
transformResponse,
transformErrors,
Don't assign members of this
to local variables. Open
const { state } = this;
- Read upRead up
- Exclude checks
Rule: no-this-assignment
Disallows unnecessary references to this
.
Rationale
Assigning a variable to this
instead of properly using arrow lambdas may be a symptom of pre-ES6 practices
or not managing scope well.
Instead of storing a reference to this
and using it inside a function () {
:
const self = this;
setTimeout(function () {
self.doWork();
});
Use () =>
arrow lambdas, as they preserve this
scope for you:
setTimeout(() => {
this.doWork();
});
Config
Two options may be provided on an object:
-
allow-destructuring
allows using destructuring to access members ofthis
(e.g.{ foo, bar } = this;
). -
allowed-names
may be specified as a list of regular expressions to match allowed variable names.
Examples
"no-this-assignment": true
"no-this-assignment": true,[object Object]
Schema
{
"additionalProperties": false,
"properties": {
"allow-destructuring": {
"type": "boolean"
},
"allowed-names": {
"listType": "string",
"type": "list"
}
},
"type": "object"
}
For more information see this page.
Don't assign members of this
to local variables. Open
const { state } = this;
- Read upRead up
- Exclude checks
Rule: no-this-assignment
Disallows unnecessary references to this
.
Rationale
Assigning a variable to this
instead of properly using arrow lambdas may be a symptom of pre-ES6 practices
or not managing scope well.
Instead of storing a reference to this
and using it inside a function () {
:
const self = this;
setTimeout(function () {
self.doWork();
});
Use () =>
arrow lambdas, as they preserve this
scope for you:
setTimeout(() => {
this.doWork();
});
Config
Two options may be provided on an object:
-
allow-destructuring
allows using destructuring to access members ofthis
(e.g.{ foo, bar } = this;
). -
allowed-names
may be specified as a list of regular expressions to match allowed variable names.
Examples
"no-this-assignment": true
"no-this-assignment": true,[object Object]
Schema
{
"additionalProperties": false,
"properties": {
"allow-destructuring": {
"type": "boolean"
},
"allowed-names": {
"listType": "string",
"type": "list"
}
},
"type": "object"
}
For more information see this page.
variable name must be in lowerCamelCase or UPPER_CASE Open
export const createRequestCoordinator = <Props, NewProps>(attributes: Attributes<Props, NewProps>) => (WrappedComponent: React.ComponentType<NewProps>) => {
- Read upRead up
- Exclude checks
Rule: variable-name
Checks variable names for various errors.
Config
Several arguments may be optionally provided:
-
"check-format"
enbables enforcement of a certain naming format. By default, the rule only allows only lowerCamelCased or UPPER_CASED variable names.- These additional options make the check stricter:
-
"require-const-for-all-caps"
: enforces that all variables with UPPER_CASED names should beconst
. - These additional options make the check more permissive:
-
"allow-leading-underscore"
allows underscores at the beginning (only has an effect if "check-format" specified) -
"allow-pascal-case"
allows PascalCase in addition to lowerCamelCase. -
"allow-snake-case"
allows snake_case in addition to lowerCamelCase. -
"allow-trailing-underscore"
allows underscores at the end. (only has an effect if "check-format" specified)
-
"ban-keywords"
: disallows the use of certain TypeScript keywords as variable or parameter names.- These are:
any
,Number
,number
,String
,string
,Boolean
,boolean
,Undefined
,undefined
- These are:
Examples
"variable-name": [object Object]
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"check-format",
"allow-leading-underscore",
"allow-pascal-case",
"allow-snake-case",
"allow-trailing-underscore",
"require-const-for-all-caps",
"ban-keywords"
]
},
"minLength": 0,
"maxLength": 6
}
For more information see this page.
Exceeds maximum line length of 100 Open
export const createRequestCoordinator = <Props, NewProps>(attributes: Attributes<Props, NewProps>) => (WrappedComponent: React.ComponentType<NewProps>) => {
- Read upRead up
- Exclude checks
Rule: max-line-length
Requires lines to be under a certain max length.
Rationale
Limiting the length of a line of code improves code readability. It also makes comparing code side-by-side easier and improves compatibility with various editors, IDEs, and diff viewers.
Config
It can take one argument, which can be any of the following:
* integer indicating maximum length of lines.
* object with keys:
* limit
- number greater than 0 defining the max line length
* ignore-pattern
- string defining ignore pattern for this rule, being parsed by new RegExp()
.
For example:
* //
pattern will ignore all in-line comments.
* ^import
pattern will ignore all import statements.
* ^export {(.*?)}
pattern will ignore all multiple export statements.
* class [a-zA-Z]+ implements
pattern will ignore all class declarations implementing interfaces.
* ^import |^export {(.*?)}|class [a-zA-Z]+ implements |//
pattern will ignore all the cases listed above.
* check-strings
- determines if strings should be checked, false
by default.
* check-regex
- determines if regular expressions should be checked, false
by default.
Examples
"max-line-length": true,120
"max-line-length": true,[object Object]
Schema
{
"type": "array",
"items": {
"oneOf": [
{
"type": "number"
},
{
"type": "object",
"properties": {
"limit": {
"type": "number"
},
"ignore-pattern": {
"type": "string"
},
"check-strings": {
"type": "boolean"
},
"check-regex": {
"type": "boolean"
}
},
"additionalProperties": false
}
]
},
"minLength": 1,
"maxLength": 2
}
For more information see this page.
Don't assign members of this
to local variables. Open
const { state } = this;
- Read upRead up
- Exclude checks
Rule: no-this-assignment
Disallows unnecessary references to this
.
Rationale
Assigning a variable to this
instead of properly using arrow lambdas may be a symptom of pre-ES6 practices
or not managing scope well.
Instead of storing a reference to this
and using it inside a function () {
:
const self = this;
setTimeout(function () {
self.doWork();
});
Use () =>
arrow lambdas, as they preserve this
scope for you:
setTimeout(() => {
this.doWork();
});
Config
Two options may be provided on an object:
-
allow-destructuring
allows using destructuring to access members ofthis
(e.g.{ foo, bar } = this;
). -
allowed-names
may be specified as a list of regular expressions to match allowed variable names.
Examples
"no-this-assignment": true
"no-this-assignment": true,[object Object]
Schema
{
"additionalProperties": false,
"properties": {
"allow-destructuring": {
"type": "boolean"
},
"allowed-names": {
"listType": "string",
"type": "list"
}
},
"type": "object"
}
For more information see this page.
Don't assign members of this
to local variables. Open
const { state } = this;
- Read upRead up
- Exclude checks
Rule: no-this-assignment
Disallows unnecessary references to this
.
Rationale
Assigning a variable to this
instead of properly using arrow lambdas may be a symptom of pre-ES6 practices
or not managing scope well.
Instead of storing a reference to this
and using it inside a function () {
:
const self = this;
setTimeout(function () {
self.doWork();
});
Use () =>
arrow lambdas, as they preserve this
scope for you:
setTimeout(() => {
this.doWork();
});
Config
Two options may be provided on an object:
-
allow-destructuring
allows using destructuring to access members ofthis
(e.g.{ foo, bar } = this;
). -
allowed-names
may be specified as a list of regular expressions to match allowed variable names.
Examples
"no-this-assignment": true
"no-this-assignment": true,[object Object]
Schema
{
"additionalProperties": false,
"properties": {
"allow-destructuring": {
"type": "boolean"
},
"allowed-names": {
"listType": "string",
"type": "list"
}
},
"type": "object"
}
For more information see this page.
Exceeds maximum line length of 100 Open
url: transformUrl ? transformUrl(preparedUrl, requestData, this.props) : preparedUrl,
- Read upRead up
- Exclude checks
Rule: max-line-length
Requires lines to be under a certain max length.
Rationale
Limiting the length of a line of code improves code readability. It also makes comparing code side-by-side easier and improves compatibility with various editors, IDEs, and diff viewers.
Config
It can take one argument, which can be any of the following:
* integer indicating maximum length of lines.
* object with keys:
* limit
- number greater than 0 defining the max line length
* ignore-pattern
- string defining ignore pattern for this rule, being parsed by new RegExp()
.
For example:
* //
pattern will ignore all in-line comments.
* ^import
pattern will ignore all import statements.
* ^export {(.*?)}
pattern will ignore all multiple export statements.
* class [a-zA-Z]+ implements
pattern will ignore all class declarations implementing interfaces.
* ^import |^export {(.*?)}|class [a-zA-Z]+ implements |//
pattern will ignore all the cases listed above.
* check-strings
- determines if strings should be checked, false
by default.
* check-regex
- determines if regular expressions should be checked, false
by default.
Examples
"max-line-length": true,120
"max-line-length": true,[object Object]
Schema
{
"type": "array",
"items": {
"oneOf": [
{
"type": "number"
},
{
"type": "object",
"properties": {
"limit": {
"type": "number"
},
"ignore-pattern": {
"type": "string"
},
"check-strings": {
"type": "boolean"
},
"check-regex": {
"type": "boolean"
}
},
"additionalProperties": false
}
]
},
"minLength": 1,
"maxLength": 2
}
For more information see this page.