Skip to content

Commit

Permalink
Stop using ternary operator
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Sep 18, 2023
1 parent 23f7484 commit 6fd5b75
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 29 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ module.exports = {
"plugins": ["@typescript-eslint"],
"root": true,
"rules": {
"@typescript-eslint/no-shadow": "error",
"lines-around-comment": [
"error",
{"allowBlockStart": true}
],
"no-console": "off",
// Replaced with @typescript-eslint/no-shadow
"no-shadow": "off",
"object-curly-spacing": "error",
"one-var": [
"error",
Expand All @@ -28,8 +31,6 @@ module.exports = {
"never"
],

"no-shadow": "warn",
"no-ternary": "warn",
"no-undefined": "warn",
"no-underscore-dangle": "warn",
"no-use-before-define": "warn",
Expand Down
12 changes: 3 additions & 9 deletions src/gnosis-safe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,9 @@ const getSafeTransactionData = (transactions: UnsignedTransaction[]) => {
const safeTransactionData: MetaTransactionData[] = [];
for (const transaction of transactions) {
safeTransactionData.push({
"to": transaction.to
? transaction.to
: ethers.constants.AddressZero,
"data": transaction.data
? transaction.data.toString()
: "0x",
"value": transaction.value
? transaction.value.toString()
: "0",
"to": transaction.to ?? ethers.constants.AddressZero,
"data": transaction.data?.toString() ?? "0x",
"value": transaction.value?.toString() ?? "0",
"operation": 0
});
}
Expand Down
12 changes: 3 additions & 9 deletions src/submitters/safe-ima-legacy-marionette-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,9 @@ export class SafeImaLegacyMarionetteSubmitter extends SafeToImaSubmitter {
const transactionsToMarionette =
(await Promise.all(transactions.
map((transaction) => this.marionette.encodeFunctionCall(
transaction.to
? transaction.to
: ethers.constants.AddressZero,
transaction.value
? transaction.value
: zeroValue,
transaction.data
? transaction.data
: "0x"
transaction.to ?? ethers.constants.AddressZero,
transaction.value ?? zeroValue,
transaction.data ?? "0x"
) as Promise<BytesLike>))
).map((data) => ({
data,
Expand Down
12 changes: 3 additions & 9 deletions src/submitters/safe-ima-marionette-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,9 @@ export class SafeImaMarionetteSubmitter extends SafeToImaSubmitter {
const zeroValue = 0;
for (const transaction of transactions) {
functionCalls.push({
"receiver": transaction.to
? transaction.to
: ethers.constants.AddressZero,
"value": transaction.value
? transaction.value
: zeroValue,
"data": transaction.data
? transaction.data
: "0x"
"data": transaction.data ?? "0x",
"receiver": transaction.to ?? ethers.constants.AddressZero,
"value": transaction.value ?? zeroValue
});
}
await super.submit([
Expand Down

0 comments on commit 6fd5b75

Please sign in to comment.