Skip to content

Commit cbc9244

Browse files
committed
Fix issues identified by the linter
1 parent 1107c30 commit cbc9244

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/homeworks/ts1/1_base.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export const removeFirstZeros = (value: string): string => value.replace(/^(-)?[
1010
export const getBeautifulNumber = (value: number, separator = ' '): string =>
1111
value?.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator);
1212

13-
export const round = (value: number, accuracy: number = 2): number => {
13+
export const round = (value: number, accuracy = 2): number => {
1414
const d = 10 ** accuracy;
1515
return Math.round(value * d) / d;
1616
};
1717

18-
const transformRegexp: RegExp =
18+
const transformRegexp =
1919
/(matrix\(-?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, -?\d+(\.\d+)?, )(-?\d+(\.\d+)?), (-?\d+(\.\d+)?)\)/;
2020

2121
type TransformedRegexp = {
@@ -42,8 +42,8 @@ type BlackOrWhite = 'black' | 'white';
4242

4343
export const getContrastType = (contrastValue: number): BlackOrWhite => (contrastValue > 125 ? 'black' : 'white');
4444

45-
export const shortColorRegExp: RegExp = /^#[0-9a-f]{3}$/i;
46-
export const longColorRegExp: RegExp = /^#[0-9a-f]{6}$/i;
45+
export const shortColorRegExp = /^#[0-9a-f]{3}$/i;
46+
export const longColorRegExp = /^#[0-9a-f]{6}$/i;
4747

4848
export const checkColor = (color: string): void | never => {
4949
if (!longColorRegExp.test(color) && !shortColorRegExp.test(color)) throw new Error(`invalid hex color: ${color}`);

src/shared/description/Description.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import React from 'react';
22
import cn from 'clsx';
33
import s from './Description.module.scss';
44

5-
type Description = {
5+
type DescriptionProps = {
66
description: string;
77
isShort?: boolean;
88
};
99

10-
export const Description = ({ description, isShort = false }: Description) => (
10+
export const Description = ({ description, isShort = false }: DescriptionProps) => (
1111
<div className={cn(s.description, { [s.short]: isShort })}>{description}</div>
1212
);

src/shared/i-shop/product-detail/ProductDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const ProductDetail = (data: ProductDetailProps) => (
1818
<div className={s['product-category']}>{data.category}</div>
1919
<div className={s['product-images']}>
2020
{data.images.map((image, index) => (
21-
<Image url={image} title={`${data.title} ${index ? index : ''}`.trim()} />
21+
<Image key={index} url={image} title={`${data.title} ${index ? index : ''}`.trim()} />
2222
))}
2323
</div>
2424
<Product {...data} />

0 commit comments

Comments
 (0)