Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve eslint #240

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"start:services": "docker-compose up",
"build": "yarn typecheck && vite build",
"prettier": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
"lint": "eslint src/ cypress/",
"lint": "eslint src cypress --ext .js,.jsx,.ts,.tsx",
"fix": "yarn prettier && yarn lint --fix",
"test": "yarn test:unit && yarn test:e2e",
"test:e2e": "TZ=Etc/GMT-3 start-test 'yarn start:server --port 3030' 3030 'cypress run'",
Expand Down
6 changes: 2 additions & 4 deletions src/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ interface AvatarProps {
url: string | null;
}

// eslint-disable-next-line no-unused-vars
const iconSizes: { [key in AvatarSizes]: SizeProp } = {
const iconSizes: Record<AvatarSizes, SizeProp> = {
xl: '5x',
lg: '5x',
md: '3x',
sm: '1x',
};

// eslint-disable-next-line no-unused-vars
const imgSizes: { [key in AvatarSizes]: number } = {
const imgSizes: Record<AvatarSizes, number> = {
xl: 300,
lg: 128,
md: 64,
Expand Down
1 change: 0 additions & 1 deletion src/components/SearchForm/SearchForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useState, useEffect, ChangeEvent, useRef } from 'react';
import { useLocation } from 'react-router-dom';
import { Trans } from 'react-i18next';

import {
Expand Down
7 changes: 1 addition & 6 deletions src/components/UserCard/UserCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ type UserCardProps = {
export function UserCard({ name, user, isHeading, withLinkToProfile }: UserCardProps) {
const externalLink = (
<div>
<a
href={user.url || `https://last.fm/user/${name}`}
// eslint-disable-next-line react/jsx-no-target-blank
target="_blank"
rel="noopener noreferrer"
>
<a href={user.url || `https://last.fm/user/${name}`} target="_blank" rel="noopener noreferrer">
<Trans i18nKey="visitProfile">Visit profile</Trans>
</a>{' '}
<FontAwesomeIcon icon={faExternalLinkAlt} />
Expand Down
1 change: 0 additions & 1 deletion src/domains/scrobbleSong/ScrobbleSong.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { clearListOfScrobbles, scrobbleCounterEnabled } from 'store/actions/scro

import EmptyScrobbleListFiller from 'components/EmptyScrobbleListFiller';
import ScrobbleList from 'components/ScrobbleList';
import Spinner from 'components/Spinner';
import { SongForm } from './SongForm';

import { LastFmProfileHistory } from './partials/LastFmProfileHistory';
Expand Down
8 changes: 2 additions & 6 deletions src/domains/scrobbleUser/partials/UserResultsHeading.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { useParams, useNavigate } from 'react-router-dom';
import ReactGA from 'react-ga-neo';
import { keepPreviousData, useQuery, QueryClient, useQueryClient } from '@tanstack/react-query';
import { get } from 'lodash-es';
import { useNavigate } from 'react-router-dom';
import { useQueryClient } from '@tanstack/react-query';

import { Row, Button } from 'reactstrap';
import { Trans, useTranslation } from 'react-i18next';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const sizeMap = {
extralarge: 'xl',
};

// eslint-disable-next-line no-unused-vars
export function avatarTransformer(avatars: any[]): Avatar {
if (!avatars || avatars.length === 0) return null;

Expand Down
10 changes: 2 additions & 8 deletions src/utils/types/album.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
/* eslint-disable no-unused-vars */

type AlbumCoverSizeSteps = 'sm' | 'lg';

export type AlbumCover = {
[key in AlbumCoverSizeSteps]: string;
};
export type AlbumCover = Record<AlbumCoverSizeSteps, string>;

export type AlbumCoverSizes = {
[key in AlbumCoverSizeSteps]: number;
};
export type AlbumCoverSizes = Record<AlbumCoverSizeSteps, number>;

export type BaseAlbum = {
artist: string;
Expand Down
6 changes: 1 addition & 5 deletions src/utils/types/avatar.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export type AvatarSizes = 'xl' | 'lg' | 'md' | 'sm';

export type Avatar =
| {
[key in AvatarSizes]: string;
}
| null;
export type Avatar = Record<AvatarSizes, string> | null;
Loading