Forbidden bitwise operation Open
const [hash, setHash] = useState<`0x${string}` | undefined>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-bitwise
Disallows bitwise operators.
Specifically, the following bitwise operators are banned:
&
, &=
, |
, |=
,
^
, ^=
, <<
, <<=
,
>>
, >>=
, >>>
, >>>=
, and ~
.
This rule does not ban the use of &
and |
for intersection and union types.
Rationale
Bitwise operators are often typos - for example bool1 & bool2
instead of bool1 && bool2
.
They also can be an indicator of overly clever code which decreases maintainability.
Config
Not configurable.
Examples
"no-bitwise": true
For more information see this page.
Unnecessary 'await'. Open
wrapWithToast(async () => await walletClient.writeContract(request), publicClient)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-return-await
Disallows unnecessary return await
.
Rationale
An async function always wraps the return value in a Promise.
Using return await
just adds extra time before the overreaching promise is resolved without changing the semantics.
Notes
- Has Fix
Config
Not configurable.
Examples
"no-return-await": true
For more information see this page.
missing whitespace Open
const [hash, setHash] = useState<`0x${string}` | undefined>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: whitespace
Enforces whitespace style conventions.
Rationale
Helps maintain a readable, consistent style in your codebase.
Notes
- Has Fix
Config
Several arguments may be optionally provided:
-
"check-branch"
checks branching statements (if
/else
/for
/while
) are followed by whitespace. -
"check-decl"
checks that variable declarations have whitespace around the equals token. -
"check-operator"
checks for whitespace around operator tokens. -
"check-module"
checks for whitespace in import & export statements. -
"check-separator"
checks for whitespace after separator tokens (,
/;
). -
"check-rest-spread"
checks that there is no whitespace after rest/spread operator (...
). -
"check-type"
checks for whitespace before a variable type specification. -
"check-typecast"
checks for whitespace between a typecast and its target. -
"check-type-operator"
checks for whitespace between type operators|
and&
. -
"check-preblock"
checks for whitespace before the opening brace of a block. -
"check-postbrace"
checks for whitespace after an opening brace.
Examples
"whitespace": true,check-branch,check-operator,check-typecast
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-rest-spread",
"check-type",
"check-typecast",
"check-type-operator",
"check-preblock",
"check-postbrace"
]
},
"minLength": 0,
"maxLength": 11
}
For more information see this page.
missing whitespace Open
const [hash, setHash] = useState<`0x${string}` | undefined>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: whitespace
Enforces whitespace style conventions.
Rationale
Helps maintain a readable, consistent style in your codebase.
Notes
- Has Fix
Config
Several arguments may be optionally provided:
-
"check-branch"
checks branching statements (if
/else
/for
/while
) are followed by whitespace. -
"check-decl"
checks that variable declarations have whitespace around the equals token. -
"check-operator"
checks for whitespace around operator tokens. -
"check-module"
checks for whitespace in import & export statements. -
"check-separator"
checks for whitespace after separator tokens (,
/;
). -
"check-rest-spread"
checks that there is no whitespace after rest/spread operator (...
). -
"check-type"
checks for whitespace before a variable type specification. -
"check-typecast"
checks for whitespace between a typecast and its target. -
"check-type-operator"
checks for whitespace between type operators|
and&
. -
"check-preblock"
checks for whitespace before the opening brace of a block. -
"check-postbrace"
checks for whitespace after an opening brace.
Examples
"whitespace": true,check-branch,check-operator,check-typecast
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-rest-spread",
"check-type",
"check-typecast",
"check-type-operator",
"check-preblock",
"check-postbrace"
]
},
"minLength": 0,
"maxLength": 11
}
For more information see this page.
missing whitespace Open
const [hash, setHash] = useState<`0x${string}` | undefined>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: whitespace
Enforces whitespace style conventions.
Rationale
Helps maintain a readable, consistent style in your codebase.
Notes
- Has Fix
Config
Several arguments may be optionally provided:
-
"check-branch"
checks branching statements (if
/else
/for
/while
) are followed by whitespace. -
"check-decl"
checks that variable declarations have whitespace around the equals token. -
"check-operator"
checks for whitespace around operator tokens. -
"check-module"
checks for whitespace in import & export statements. -
"check-separator"
checks for whitespace after separator tokens (,
/;
). -
"check-rest-spread"
checks that there is no whitespace after rest/spread operator (...
). -
"check-type"
checks for whitespace before a variable type specification. -
"check-typecast"
checks for whitespace between a typecast and its target. -
"check-type-operator"
checks for whitespace between type operators|
and&
. -
"check-preblock"
checks for whitespace before the opening brace of a block. -
"check-postbrace"
checks for whitespace after an opening brace.
Examples
"whitespace": true,check-branch,check-operator,check-typecast
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-rest-spread",
"check-type",
"check-typecast",
"check-type-operator",
"check-preblock",
"check-postbrace"
]
},
"minLength": 0,
"maxLength": 11
}
For more information see this page.
Missing radix parameter Open
const faucetCheck = !isUndefined(balance) && parseInt(formatEther(balance)) > 200;
- Read upRead up
- Create a ticketCreate a ticket
- 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 whitespace Open
const [hash, setHash] = useState<`0x${string}` | undefined>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: whitespace
Enforces whitespace style conventions.
Rationale
Helps maintain a readable, consistent style in your codebase.
Notes
- Has Fix
Config
Several arguments may be optionally provided:
-
"check-branch"
checks branching statements (if
/else
/for
/while
) are followed by whitespace. -
"check-decl"
checks that variable declarations have whitespace around the equals token. -
"check-operator"
checks for whitespace around operator tokens. -
"check-module"
checks for whitespace in import & export statements. -
"check-separator"
checks for whitespace after separator tokens (,
/;
). -
"check-rest-spread"
checks that there is no whitespace after rest/spread operator (...
). -
"check-type"
checks for whitespace before a variable type specification. -
"check-typecast"
checks for whitespace between a typecast and its target. -
"check-type-operator"
checks for whitespace between type operators|
and&
. -
"check-preblock"
checks for whitespace before the opening brace of a block. -
"check-postbrace"
checks for whitespace after an opening brace.
Examples
"whitespace": true,check-branch,check-operator,check-typecast
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-rest-spread",
"check-type",
"check-typecast",
"check-type-operator",
"check-preblock",
"check-postbrace"
]
},
"minLength": 0,
"maxLength": 11
}
For more information see this page.
unused expression, expected an assignment or function call Open
status && setHash(result?.transactionHash);
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Rule: no-unused-expression
Disallows unused expression statements.
Unused expressions are expression statements which are not assignments or function calls (and thus usually no-ops).
Rationale
Detects potential errors where an assignment or function call was intended.
Config
Three arguments may be optionally provided:
-
allow-fast-null-checks
allows to use logical operators to perform fast null checks and perform method or function calls for side effects (e.g.e && e.preventDefault()
). -
allow-new
allows 'new' expressions for side effects (e.g.new ModifyGlobalState();
. -
allow-tagged-template
allows tagged templates for side effects (e.g.this.add\
foo`;`.
Examples
"no-unused-expression": true
"no-unused-expression": true,allow-fast-null-checks
Schema
{
"type": "array",
"items": {
"type": "string",
"enum": [
"allow-fast-null-checks",
"allow-new",
"allow-tagged-template"
]
},
"minLength": 0,
"maxLength": 3
}
For more information see this page.