From bc14974f199fd8f1e8d0c2074129133d07b7bf7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20T=C3=B3rz?= Date: Fri, 18 Aug 2023 14:52:34 +0200 Subject: [PATCH] Add eslint rule for unnecessary backticks --- .eslintrc.json | 5 +++++ .../src/api/controllers/ForcedTradeOfferController.test.ts | 2 +- .../src/api/controllers/TransactionSubmitController.ts | 2 +- packages/backend/src/core/FreezeCheckService.ts | 4 ++-- packages/backend/src/core/TransactionHistory.test.ts | 2 +- packages/backend/src/core/TransactionValidator.ts | 2 +- .../src/core/collectors/AssetRegistrationCollector.ts | 2 +- .../backend/src/core/collectors/FeederGatewayCollector.ts | 2 +- packages/encoding/src/encoding/encodeState.test.ts | 2 +- .../perpetual/PerpetualL2TransactionsTable.tsx | 2 +- packages/shared/src/old/FinalizeExitData.ts | 2 +- packages/shared/src/toSignableCancelOffer.test.ts | 2 +- 12 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index afc528005..ab98d1404 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,11 @@ }, "plugins": ["simple-import-sort", "no-only-tests", "unused-imports"], "rules": { + "quotes": [ + "error", + "single", + { "avoidEscape": true, "allowTemplateLiterals": false } + ], "@typescript-eslint/ban-tslint-comment": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-extra-semi": "off", diff --git a/packages/backend/src/api/controllers/ForcedTradeOfferController.test.ts b/packages/backend/src/api/controllers/ForcedTradeOfferController.test.ts index 556936a74..21c38e0b3 100644 --- a/packages/backend/src/api/controllers/ForcedTradeOfferController.test.ts +++ b/packages/backend/src/api/controllers/ForcedTradeOfferController.test.ts @@ -499,7 +499,7 @@ describe(ForcedTradeOfferController.name, () => { expect(await controller.cancelOffer(1, '123')).toEqual({ type: 'not found', - message: `Offer #1 does not exist`, + message: 'Offer #1 does not exist', }) }) diff --git a/packages/backend/src/api/controllers/TransactionSubmitController.ts b/packages/backend/src/api/controllers/TransactionSubmitController.ts index 2add47bb5..d3d473290 100644 --- a/packages/backend/src/api/controllers/TransactionSubmitController.ts +++ b/packages/backend/src/api/controllers/TransactionSubmitController.ts @@ -146,7 +146,7 @@ export class TransactionSubmitController { return fetched.controllerResult } if (!tradeMatchesOffer(offer, fetched.data)) { - return { type: 'bad request', message: `Trade does not match offer` } + return { type: 'bad request', message: 'Trade does not match offer' } } // TODO: cross repository transaction diff --git a/packages/backend/src/core/FreezeCheckService.ts b/packages/backend/src/core/FreezeCheckService.ts index 87b3c8e07..15074c0bd 100644 --- a/packages/backend/src/core/FreezeCheckService.ts +++ b/packages/backend/src/core/FreezeCheckService.ts @@ -86,12 +86,12 @@ export class FreezeCheckService { 'function FREEZE_GRACE_PERIOD() view returns (uint256)' ) if (err) { - this.logger.error(`Failed calling FREEZE_GRACE_PERIOD()`) + this.logger.error('Failed calling FREEZE_GRACE_PERIOD()') throw err } if (freezeGracePeriod === undefined) { throw new Error( - `Failed calling FREEZE_GRACE_PERIOD(): received undefined` + 'Failed calling FREEZE_GRACE_PERIOD(): received undefined' ) } return freezeGracePeriod.toNumber() diff --git a/packages/backend/src/core/TransactionHistory.test.ts b/packages/backend/src/core/TransactionHistory.test.ts index 7d068d1c3..5565202ad 100644 --- a/packages/backend/src/core/TransactionHistory.test.ts +++ b/packages/backend/src/core/TransactionHistory.test.ts @@ -234,7 +234,7 @@ describe(TransactionHistory.name, () => { ) }) - it(`returns [INCLUDED, ...previousRegularTransactionHistoryResults] if userTransaction is included`, () => { + it('returns [INCLUDED, ...previousRegularTransactionHistoryResults] if userTransaction is included', () => { const forcedTradeOffer = fakeOffer() const sentTransaction = fakeSentTransaction() const userTransaction = fakeUserTransaction({ diff --git a/packages/backend/src/core/TransactionValidator.ts b/packages/backend/src/core/TransactionValidator.ts index 65254354c..0fc30c68b 100644 --- a/packages/backend/src/core/TransactionValidator.ts +++ b/packages/backend/src/core/TransactionValidator.ts @@ -35,7 +35,7 @@ export class TransactionValidator { isSuccess: false, controllerResult: { type: 'bad request', - message: `Invalid transaction`, + message: 'Invalid transaction', }, } } diff --git a/packages/backend/src/core/collectors/AssetRegistrationCollector.ts b/packages/backend/src/core/collectors/AssetRegistrationCollector.ts index 7e379c612..cca5e7c8a 100644 --- a/packages/backend/src/core/collectors/AssetRegistrationCollector.ts +++ b/packages/backend/src/core/collectors/AssetRegistrationCollector.ts @@ -13,7 +13,7 @@ import { LogTokenRegistered } from './events' const ETH_SELECTOR = '0x8322fff2' const ERC20_SELECTOR = '0xf47261b0' const ERC721_SELECTOR = '0x02571792' -const ERC1155_SELECTOR = `0x3348691d` +const ERC1155_SELECTOR = '0x3348691d' const MINTABLE_ERC721_SELECTOR = '0xb8b86672' const MINTABLE_ERC20_SELECTOR = '0x68646e2d' diff --git a/packages/backend/src/core/collectors/FeederGatewayCollector.ts b/packages/backend/src/core/collectors/FeederGatewayCollector.ts index 5678aafc3..384667638 100644 --- a/packages/backend/src/core/collectors/FeederGatewayCollector.ts +++ b/packages/backend/src/core/collectors/FeederGatewayCollector.ts @@ -52,7 +52,7 @@ export class FeederGatewayCollector { throw new Error(`State update ${stateUpdateId} not found`) } - this.logger.info(`Collecting transactions from Feeder Gateway`, { + this.logger.info('Collecting transactions from Feeder Gateway', { stateUpdateId: stateUpdate.id, }) diff --git a/packages/encoding/src/encoding/encodeState.test.ts b/packages/encoding/src/encoding/encodeState.test.ts index 4939c7563..7bb7f242e 100644 --- a/packages/encoding/src/encoding/encodeState.test.ts +++ b/packages/encoding/src/encoding/encodeState.test.ts @@ -28,7 +28,7 @@ describe(encodeStateAsInt256Array.name, () => { // encodeState is tested in encodeOnchainData.test.ts }) - it(`properly serialized state`, () => { + it('properly serialized state', () => { const result = encodeStateAsInt256Array(newState) expect(result).toEqual([ 4855295734011000137694901532041540081493925748614200896918173841152119144448n, diff --git a/packages/frontend/src/view/components/tables/l2-transactions/perpetual/PerpetualL2TransactionsTable.tsx b/packages/frontend/src/view/components/tables/l2-transactions/perpetual/PerpetualL2TransactionsTable.tsx index 15f568aba..3d9c81c0e 100644 --- a/packages/frontend/src/view/components/tables/l2-transactions/perpetual/PerpetualL2TransactionsTable.tsx +++ b/packages/frontend/src/view/components/tables/l2-transactions/perpetual/PerpetualL2TransactionsTable.tsx @@ -27,7 +27,7 @@ export function PerpetualL2TransactionsTable( props: PerpetualL2TransactionsTableProps ) { const columns: Column[] = [ - { header: `ID` }, + { header: 'ID' }, { header: 'Type' }, { header: 'Status' }, { header: 'Age' }, diff --git a/packages/shared/src/old/FinalizeExitData.ts b/packages/shared/src/old/FinalizeExitData.ts index 6cc634abd..5bcead07f 100644 --- a/packages/shared/src/old/FinalizeExitData.ts +++ b/packages/shared/src/old/FinalizeExitData.ts @@ -9,7 +9,7 @@ export function encodeFinalizeExitRequest(starkKey: StarkKey) { return coder.encodeFunctionData('withdraw', [ starkKey.toString(), //hardcoded just because it will take time to pass collateral asset to this function and it is going to be removed soon - `0x02893294412a4c8f915f75892b395ebbf6859ec246ec365c3b1f56f47c3a0a5d`, + '0x02893294412a4c8f915f75892b395ebbf6859ec246ec365c3b1f56f47c3a0a5d', ]) } diff --git a/packages/shared/src/toSignableCancelOffer.test.ts b/packages/shared/src/toSignableCancelOffer.test.ts index 0f4f9fb4a..c13845234 100644 --- a/packages/shared/src/toSignableCancelOffer.test.ts +++ b/packages/shared/src/toSignableCancelOffer.test.ts @@ -5,7 +5,7 @@ import { toSignableCancelOffer } from './toSignableCancelOffer' describe(toSignableCancelOffer.name, () => { it('works properly', () => { expect(toSignableCancelOffer(1)).toEqual( - ['{', ` "cancel": true,`, ` "offerId": 1`, '}'].join('\n') + ['{', ' "cancel": true,', ' "offerId": 1', '}'].join('\n') ) }) })