diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml
index 779b600345..419d44ed46 100644
--- a/.github/workflows/lint.yaml
+++ b/.github/workflows/lint.yaml
@@ -19,4 +19,4 @@ jobs:
- name: Install
run: npm install --legacy-peer-deps
- name: Lint
- run: npm run lint
+ run: npm run check:code
diff --git a/webapp/.eslintrc.cjs b/webapp/.eslintrc.cjs
index eb81ca74cf..172e6c4458 100644
--- a/webapp/.eslintrc.cjs
+++ b/webapp/.eslintrc.cjs
@@ -17,7 +17,6 @@ module.exports = {
'@typescript-eslint/no-floating-promises': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-floating-promises
'@typescript-eslint/no-unsafe-return': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unsafe-return
'@typescript-eslint/naming-convention': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/naming-convention/
- '@typescript-eslint/no-unused-vars': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unused-vars
'@typescript-eslint/no-unnecessary-type-assertion': 'error', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unnecessary-type-assertion
'@typescript-eslint/explicit-module-boundary-types': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/explicit-module-boundary-types
'@typescript-eslint/restrict-template-expressions': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/restrict-template-expressions
@@ -26,7 +25,6 @@ module.exports = {
'@typescript-eslint/unbound-method': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/unbound-method
'@typescript-eslint/ban-ts-comment': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/ban-ts-comment
'no-prototype-builtins': 'off', // TODO: migrate code progressively to remove this line. https://eslint.org/docs/rules/no-prototype-builtins
- 'no-case-declarations': 'off', // TODO: migrate code progressively to remove this line. https://eslint.org/docs/rules/no-case-declarations
'@typescript-eslint/no-unsafe-assignment': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unsafe-assignment/
'@typescript-eslint/no-unsafe-call': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unsafe-call/
'@typescript-eslint/no-unsafe-member-access': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unsafe-member-access/
@@ -37,9 +35,7 @@ module.exports = {
'@typescript-eslint/await-thenable': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/await-thenable
'@typescript-eslint/no-unnecessary-type-constraint': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-unnecessary-type-constraint
'@typescript-eslint/no-misused-promises': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-misused-promises
- 'require-yield': 'off', // TODO: migrate code progressively to remove this line. https://eslint.org/docs/rules/require-yield
'import/order': 'off', // TODO: migrate code progressively to remove this line.
- 'no-empty': 'off', // TODO: migrate code progressively to remove this line. https://eslint.org/docs/rules/no-empty
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off', // TODO: migrate code progressively to remove this line. https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
'@typescript-eslint/no-unsafe-enum-comparison': 'off'
},
diff --git a/webapp/package.json b/webapp/package.json
index de8b671447..71a9ff56aa 100644
--- a/webapp/package.json
+++ b/webapp/package.json
@@ -107,7 +107,6 @@
"build": "tsc && node --max_old_space_size=8192 ./node_modules/vite/bin/vite.js build",
"test": "jest",
"test:coverage": "npm run test -- --coverage",
- "lint": "eslint -c .eslintrc.cjs --ext .ts src",
"check:code": "eslint -c .eslintrc.cjs src",
"fix:code": "npm run check:code -- --fix",
"pre-commit:fix:code": "eslint -c .eslintrc.cjs --fix",
diff --git a/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.tsx b/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.tsx
index 2d70b5ceea..3483797092 100644
--- a/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.tsx
+++ b/webapp/src/components/Modals/BuyWithCryptoModal/BuyWithCryptoModal.tsx
@@ -651,7 +651,7 @@ export const BuyWithCryptoModal = (props: Props) => {
{t('buy_with_crypto_modal.insufficient_funds', {
token: insufficientToken?.symbol || 'MANA',
- card: (text: string) => onBuyWithCard ? {text} : undefined
+ card: (text: string) => (onBuyWithCard ? {text} : undefined)
})}
) : null}
diff --git a/webapp/src/components/NamesPage/ClaimNamePage/ClaimNamePage.tsx b/webapp/src/components/NamesPage/ClaimNamePage/ClaimNamePage.tsx
index 5025ddbd10..4b6fabd025 100644
--- a/webapp/src/components/NamesPage/ClaimNamePage/ClaimNamePage.tsx
+++ b/webapp/src/components/NamesPage/ClaimNamePage/ClaimNamePage.tsx
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useLocation } from 'react-router-dom'
import classNames from 'classnames'
import { Button, Close, Container, Field, Icon, Loader, Popup, useTabletAndBelowMediaQuery } from 'decentraland-ui'
+import { isErrorWithMessage } from 'decentraland-dapps/dist/lib'
import { t } from 'decentraland-dapps/dist/modules/translation/utils'
import { config } from '../../../config'
import infoIcon from '../../../images/infoIcon.png'
@@ -51,7 +52,9 @@ const ClaimNamePage = (props: Props) => {
try {
const bannedNames = await lists.fetchBannedNames()
setBannedNames(bannedNames)
- } catch (error) {}
+ } catch (error) {
+ console.error('Error fetching banned names', isErrorWithMessage(error) ? error.message : 'Unknown error')
+ }
})()
}, [])
diff --git a/webapp/src/components/OnSaleOrRentList/AssetCell/AssetCell.tsx b/webapp/src/components/OnSaleOrRentList/AssetCell/AssetCell.tsx
index 5893b6c116..0fdf79bba6 100644
--- a/webapp/src/components/OnSaleOrRentList/AssetCell/AssetCell.tsx
+++ b/webapp/src/components/OnSaleOrRentList/AssetCell/AssetCell.tsx
@@ -11,14 +11,17 @@ const AssetCell = ({ asset, link: linkProp }: Props) => {
let subtitle: string | undefined
switch (asset.category) {
- case NFTCategory.ESTATE:
+ case NFTCategory.ESTATE: {
subtitle = t('global.parcel_count', {
count: asset.data.estate!.parcels.length
})
break
- case NFTCategory.PARCEL:
+ }
+ case NFTCategory.PARCEL: {
const { x, y } = asset.data.parcel!
subtitle = `${x},${y}`
+ break
+ }
}
const link = linkProp
diff --git a/webapp/src/components/RankingsTable/RankingsTable.tsx b/webapp/src/components/RankingsTable/RankingsTable.tsx
index ff6b17b859..70742aa159 100644
--- a/webapp/src/components/RankingsTable/RankingsTable.tsx
+++ b/webapp/src/components/RankingsTable/RankingsTable.tsx
@@ -143,7 +143,7 @@ const RankingsTable = (props: Props) => {
const getTableHeader = () => {
switch (currentEntity) {
case RankingEntities.EMOTES:
- case RankingEntities.WEARABLES:
+ case RankingEntities.WEARABLES: {
const label = currentEntity === RankingEntities.EMOTES ? 'emotes' : 'wearables'
return (
@@ -179,6 +179,7 @@ const RankingsTable = (props: Props) => {
)
+ }
case RankingEntities.CREATORS:
return (
diff --git a/webapp/src/lib/timer.spec.ts b/webapp/src/lib/timer.spec.ts
index eb58c8038f..80272a1cdb 100644
--- a/webapp/src/lib/timer.spec.ts
+++ b/webapp/src/lib/timer.spec.ts
@@ -22,7 +22,7 @@ describe('when the timer is running', () => {
describe("and the timer hasn't finished", () => {
it('should return isRunning as true', async () => {
const { result } = renderHook(() => useTimer(1200))
- const [_, startTimer] = result.current
+ const [, startTimer] = result.current
act(() => {
startTimer()
@@ -38,7 +38,7 @@ describe('when the timer is running', () => {
it('should return isRunning as false', async () => {
runTimerAutomaticallyOnce()
const { result } = renderHook(() => useTimer(1200))
- const [_, startTimer] = result.current
+ const [, startTimer] = result.current
act(() => {
startTimer()
@@ -53,7 +53,7 @@ describe('when the timer is running', () => {
describe('and the timer is re-started', () => {
it('should re-start the timeout procedure', () => {
const { result } = renderHook(() => useTimer(1200))
- const [_, startTimer] = result.current
+ const [, startTimer] = result.current
act(() => {
startTimer()
diff --git a/webapp/src/modules/analytics/reducer.ts b/webapp/src/modules/analytics/reducer.ts
index a639f07392..34fc768190 100644
--- a/webapp/src/modules/analytics/reducer.ts
+++ b/webapp/src/modules/analytics/reducer.ts
@@ -39,12 +39,13 @@ type AnalyticsReducerAction =
export function analyticsReducer(state = INITIAL_STATE, action: AnalyticsReducerAction): AnalyticsState {
switch (action.type) {
- case FETCH_ANALYTICS_VOLUME_DATA_REQUEST:
+ case FETCH_ANALYTICS_VOLUME_DATA_REQUEST: {
return {
...state,
loading: loadingReducer(state.loading, action)
}
- case FETCH_ANALYTICS_VOLUME_DATA_SUCCESS:
+ }
+ case FETCH_ANALYTICS_VOLUME_DATA_SUCCESS: {
const { analyticsVolumeData } = action.payload
return {
...state,
@@ -52,13 +53,15 @@ export function analyticsReducer(state = INITIAL_STATE, action: AnalyticsReducer
error: null,
volumeData: analyticsVolumeData
}
- case FETCH_ANALYTICS_VOLUME_DATA_FAILURE:
+ }
+ case FETCH_ANALYTICS_VOLUME_DATA_FAILURE: {
const { error } = action.payload
return {
...state,
loading: loadingReducer(state.loading, action),
error
}
+ }
case FETCH_RANKINGS_REQUEST: {
return {
...state,
diff --git a/webapp/src/modules/collection/reducer.ts b/webapp/src/modules/collection/reducer.ts
index c9d30f3465..02ec288962 100644
--- a/webapp/src/modules/collection/reducer.ts
+++ b/webapp/src/modules/collection/reducer.ts
@@ -40,13 +40,13 @@ type CollectionReducerAction =
export function collectionReducer(state = INITIAL_STATE, action: CollectionReducerAction): CollectionState {
switch (action.type) {
case FETCH_COLLECTIONS_REQUEST:
- case FETCH_SINGLE_COLLECTION_REQUEST:
+ case FETCH_SINGLE_COLLECTION_REQUEST: {
return {
...state,
loading: loadingReducer(state.loading, action)
}
-
- case FETCH_COLLECTIONS_SUCCESS:
+ }
+ case FETCH_COLLECTIONS_SUCCESS: {
const { collections, count } = action.payload
return {
@@ -62,8 +62,8 @@ export function collectionReducer(state = INITIAL_STATE, action: CollectionReduc
),
count
}
-
- case FETCH_SINGLE_COLLECTION_SUCCESS:
+ }
+ case FETCH_SINGLE_COLLECTION_SUCCESS: {
const { collection } = action.payload
return {
@@ -72,9 +72,9 @@ export function collectionReducer(state = INITIAL_STATE, action: CollectionReduc
error: null,
data: { ...state.data, [collection.urn]: collection }
}
-
+ }
case FETCH_COLLECTIONS_FAILURE:
- case FETCH_SINGLE_COLLECTION_FAILURE:
+ case FETCH_SINGLE_COLLECTION_FAILURE: {
const { error } = action.payload
return {
@@ -82,6 +82,7 @@ export function collectionReducer(state = INITIAL_STATE, action: CollectionReduc
loading: loadingReducer(state.loading, action),
error
}
+ }
default:
return state
}
diff --git a/webapp/src/modules/event/reducer.ts b/webapp/src/modules/event/reducer.ts
index e19693a27e..5df313c394 100644
--- a/webapp/src/modules/event/reducer.ts
+++ b/webapp/src/modules/event/reducer.ts
@@ -24,12 +24,13 @@ type EventReducerAction = FetchEventRequestAction | FetchEventSuccessAction | Fe
export function eventReducer(state = INITIAL_STATE, action: EventReducerAction): EventState {
switch (action.type) {
- case FETCH_EVENT_REQUEST:
+ case FETCH_EVENT_REQUEST: {
return {
...state,
loading: loadingReducer(state.loading, action)
}
- case FETCH_EVENT_SUCCESS:
+ }
+ case FETCH_EVENT_SUCCESS: {
const { eventTag, contracts } = action.payload
return {
...state,
@@ -40,13 +41,15 @@ export function eventReducer(state = INITIAL_STATE, action: EventReducerAction):
[eventTag]: contracts
}
}
- case FETCH_EVENT_FAILURE:
+ }
+ case FETCH_EVENT_FAILURE: {
const { error } = action.payload
return {
...state,
loading: loadingReducer(state.loading, action),
error
}
+ }
default:
return state
}
diff --git a/webapp/src/modules/favorites/reducer.ts b/webapp/src/modules/favorites/reducer.ts
index c2e71c0a3d..e6af52514d 100644
--- a/webapp/src/modules/favorites/reducer.ts
+++ b/webapp/src/modules/favorites/reducer.ts
@@ -132,7 +132,7 @@ export function favoritesReducer(state = INITIAL_STATE, action: FavoritesReducer
}
}
- case FETCH_ITEMS_SUCCESS:
+ case FETCH_ITEMS_SUCCESS: {
const { items } = action.payload
return {
@@ -158,7 +158,7 @@ export function favoritesReducer(state = INITIAL_STATE, action: FavoritesReducer
},
loading: loadingReducer(state.loading, action)
}
-
+ }
case FETCH_FAVORITED_ITEMS_SUCCESS: {
const { items, createdAt } = action.payload
diff --git a/webapp/src/modules/identity/sagas.ts b/webapp/src/modules/identity/sagas.ts
index c9dff326b2..0239b01088 100644
--- a/webapp/src/modules/identity/sagas.ts
+++ b/webapp/src/modules/identity/sagas.ts
@@ -74,6 +74,6 @@ function* handleConnectWalletSuccess(action: ConnectWalletSuccessAction) {
function* handleDisconnect(_action: DisconnectWalletAction) {
if (auxAddress) {
- localStorageClearIdentity(auxAddress)
+ yield localStorageClearIdentity(auxAddress)
}
}
diff --git a/webapp/src/modules/nft/hooks.spec.tsx b/webapp/src/modules/nft/hooks.spec.tsx
index bfa1dcdc23..26d7fefe44 100644
--- a/webapp/src/modules/nft/hooks.spec.tsx
+++ b/webapp/src/modules/nft/hooks.spec.tsx
@@ -35,13 +35,13 @@ describe('when the nft is not an estate', () => {
it('should return contractFingerprint as undefined', () => {
const { result } = renderHook(() => useFingerprint(nft))
- const [_contract, _isLoading, contractFingerprint] = result.current
+ const [, , contractFingerprint] = result.current
expect(contractFingerprint).toBe(undefined)
})
it('should return loading as false', () => {
const { result } = renderHook(() => useFingerprint(nft))
- const [_contract, isLoading] = result.current
+ const [, isLoading] = result.current
expect(isLoading).toBe(false)
})
})
diff --git a/webapp/src/modules/routing/sagas.ts b/webapp/src/modules/routing/sagas.ts
index d2df7fcf1a..c732a12248 100644
--- a/webapp/src/modules/routing/sagas.ts
+++ b/webapp/src/modules/routing/sagas.ts
@@ -239,7 +239,7 @@ export function* fetchAssetsFromRoute(options: BrowseOptions) {
})
)
break
- default:
+ default: {
const isWearableHead = section === Sections[VendorName.DECENTRALAND].WEARABLES_HEAD
const isWearableAccessory = section === Sections[VendorName.DECENTRALAND].WEARABLES_ACCESSORIES
@@ -313,6 +313,7 @@ export function* fetchAssetsFromRoute(options: BrowseOptions) {
})
)
}
+ }
}
}
diff --git a/webapp/src/modules/sale/reducer.ts b/webapp/src/modules/sale/reducer.ts
index 352e3523db..9cc81277ba 100644
--- a/webapp/src/modules/sale/reducer.ts
+++ b/webapp/src/modules/sale/reducer.ts
@@ -27,12 +27,13 @@ type SaleReducerAction = FetchSalesRequestAction | FetchSalesSuccessAction | Fet
export function saleReducer(state = INITIAL_STATE, action: SaleReducerAction): SaleState {
switch (action.type) {
- case FETCH_SALES_REQUEST:
+ case FETCH_SALES_REQUEST: {
return {
...state,
loading: loadingReducer(state.loading, action)
}
- case FETCH_SALES_SUCCESS:
+ }
+ case FETCH_SALES_SUCCESS: {
const { sales, count } = action.payload
return {
...state,
@@ -47,13 +48,15 @@ export function saleReducer(state = INITIAL_STATE, action: SaleReducerAction): S
),
count
}
- case FETCH_SALES_FAILURE:
+ }
+ case FETCH_SALES_FAILURE: {
const { error } = action.payload
return {
...state,
loading: loadingReducer(state.loading, action),
error
}
+ }
default:
return state
}
diff --git a/webapp/src/modules/store/reducer.ts b/webapp/src/modules/store/reducer.ts
index 0568e61b67..9d4dd9c823 100644
--- a/webapp/src/modules/store/reducer.ts
+++ b/webapp/src/modules/store/reducer.ts
@@ -88,12 +88,13 @@ export function storeReducer(state = INITIAL_STATE, action: StoreReducerAction):
error
}
}
- case UPDATE_LOCAL_STORE:
+ case UPDATE_LOCAL_STORE: {
const { store } = action.payload
return {
...state,
localStore: store
}
+ }
case REVERT_LOCAL_STORE: {
const { address } = action.payload
const previous = state.data[address]
diff --git a/webapp/src/modules/ui/browse/reducer.ts b/webapp/src/modules/ui/browse/reducer.ts
index 90626d339f..2d365899c5 100644
--- a/webapp/src/modules/ui/browse/reducer.ts
+++ b/webapp/src/modules/ui/browse/reducer.ts
@@ -74,14 +74,14 @@ export function browseReducer(state: BrowseUIState = INITIAL_STATE, action: UIRe
}
}
- case BULK_PICK_SUCCESS:
+ case BULK_PICK_SUCCESS: {
const { ownerRemovedFromCurrentList } = action.payload
return {
...state,
count: state.count !== undefined && ownerRemovedFromCurrentList ? --state.count : state.count
}
-
+ }
case BROWSE: {
const { view } = action.payload.options
return {
@@ -168,7 +168,7 @@ export function browseReducer(state: BrowseUIState = INITIAL_STATE, action: UIRe
itemIds: isLoadingMoreResults(state, action.payload.options.page) ? state.itemIds : []
}
- case FETCH_FAVORITED_ITEMS_SUCCESS:
+ case FETCH_FAVORITED_ITEMS_SUCCESS: {
const {
timestamp,
options: { page },
@@ -189,7 +189,7 @@ export function browseReducer(state: BrowseUIState = INITIAL_STATE, action: UIRe
page: forceLoadMore ? state.page : page,
count: total
}
-
+ }
case FETCH_ITEMS_SUCCESS: {
const {
timestamp,
diff --git a/webapp/src/modules/vendor/services.ts b/webapp/src/modules/vendor/services.ts
index 2f695a2f9a..61b81b1816 100644
--- a/webapp/src/modules/vendor/services.ts
+++ b/webapp/src/modules/vendor/services.ts
@@ -31,6 +31,7 @@ export interface NFTService {
) => Promise, Order | null, RentalListing | null]>
transfer: (wallet: Wallet | null, toAddress: string, nft: NFT) => Promise
}
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export class NFTService {}
export interface OrderService {
@@ -40,6 +41,7 @@ export interface OrderService {
cancel: (wallet: Wallet | null, order: Order) => Promise
canSell(): boolean
}
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export class OrderService {}
export interface BidService {
@@ -50,6 +52,7 @@ export interface BidService {
accept: (wallet: Wallet | null, bid: Bid) => Promise
cancel: (wallet: Wallet | null, bid: Bid) => Promise
}
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
export class BidService {}
export interface ContractService {