From 171d42ac1f7f6ba8bf3844e69576a8bf2977031c Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Tue, 27 Dec 2022 02:46:19 +0100 Subject: [PATCH] [dev] ESLint: Ignore max length for comments (#2220) --- .eslintrc | 5 ++++- src/components/common/helpers/renderText.tsx | 9 ++++++--- src/components/middle/message/Sticker.tsx | 1 - .../middle/message/helpers/calculateAuthorWidth.ts | 1 - src/global/helpers/users.ts | 1 - src/util/colors.ts | 1 - src/util/map.ts | 2 -- src/util/waveform.ts | 1 - src/util/windowSize.ts | 1 - 9 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.eslintrc b/.eslintrc index d676eea47..749affb19 100644 --- a/.eslintrc +++ b/.eslintrc @@ -20,7 +20,10 @@ ], "max-len": [ "error", - 120 + { + "code": 120, + "ignoreComments": true + } ], "array-bracket-newline": [ 2, diff --git a/src/components/common/helpers/renderText.tsx b/src/components/common/helpers/renderText.tsx index 78ac9d68c..aff5a6f1f 100644 --- a/src/components/common/helpers/renderText.tsx +++ b/src/components/common/helpers/renderText.tsx @@ -130,9 +130,12 @@ function replaceEmojis(textParts: TextPart[], size: 'big' | 'small', type: 'jsx' } if (type === 'html') { emojiResult.push( - // For preventing extra spaces in html - // eslint-disable-next-line max-len - `${emoji}`, + ``, ); } diff --git a/src/components/middle/message/Sticker.tsx b/src/components/middle/message/Sticker.tsx index 9d853025d..f219259e3 100644 --- a/src/components/middle/message/Sticker.tsx +++ b/src/components/middle/message/Sticker.tsx @@ -21,7 +21,6 @@ import AnimatedSticker from '../../common/AnimatedSticker'; import './Sticker.scss'; -// eslint-disable-next-line max-len // https://github.com/telegramdesktop/tdesktop/blob/master/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp#L42 const EFFECT_SIZE_MULTIPLIER = 1 + 0.245 * 2; diff --git a/src/components/middle/message/helpers/calculateAuthorWidth.ts b/src/components/middle/message/helpers/calculateAuthorWidth.ts index 125728a4b..7e25a4593 100644 --- a/src/components/middle/message/helpers/calculateAuthorWidth.ts +++ b/src/components/middle/message/helpers/calculateAuthorWidth.ts @@ -7,7 +7,6 @@ export default function calculateAuthorWidth(text: string) { if (!element) { element = document.createElement('span'); - // eslint-disable-next-line max-len element.style.font = `400 12px ${fontFamily}`; element.style.whiteSpace = 'nowrap'; element.style.position = 'absolute'; diff --git a/src/global/helpers/users.ts b/src/global/helpers/users.ts index 7c533955a..5eedace48 100644 --- a/src/global/helpers/users.ts +++ b/src/global/helpers/users.ts @@ -262,7 +262,6 @@ export function getUserIdDividend(userId: string) { return Math.abs(Number(userId)); } -// eslint-disable-next-line max-len // https://github.com/telegramdesktop/tdesktop/blob/371510cfe23b0bd226de8c076bc49248fbe40c26/Telegram/SourceFiles/data/data_peer.cpp#L53 export function getUserColorKey(peer: ApiUser | ApiChat | undefined) { const index = peer ? getUserIdDividend(peer.id) % 7 : 0; diff --git a/src/util/colors.ts b/src/util/colors.ts index e047f21e1..0d84b2cf0 100644 --- a/src/util/colors.ts +++ b/src/util/colors.ts @@ -191,7 +191,6 @@ export function getColorLuma(rgbColor: [number, number, number]) { return luma; } -// eslint-disable-next-line max-len // Function was adapted from https://github.com/telegramdesktop/tdesktop/blob/35ff621b5b52f7e3553fb0f990ea13ade7101b8e/Telegram/SourceFiles/data/data_wall_paper.cpp#L518 export function getPatternColor(rgbColor: [number, number, number]) { let [hue, saturation, value] = rgb2hsb(rgbColor); diff --git a/src/util/map.ts b/src/util/map.ts index 1d03508d5..3b64f3545 100644 --- a/src/util/map.ts +++ b/src/util/map.ts @@ -1,6 +1,5 @@ const PROVIDER = 'https://maps.google.com/maps'; -// eslint-disable-next-line max-len // https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L82 const VENUE_COLORS = new Map(Object.entries({ 'building/medical': '#43b3f4', @@ -42,7 +41,6 @@ export function getVenueIconUrl(type?: string) { return `https://ss3.4sqi.net/img/categories_v2/${type}_88.png`; } -// eslint-disable-next-line max-len // https://github.com/TelegramMessenger/Telegram-iOS/blob/2a32c871882c4e1b1ccdecd34fccd301723b30d9/submodules/LocationResources/Sources/VenueIconResources.swift#L104 export function getVenueColor(type?: string) { if (!type) return '#008df2'; diff --git a/src/util/waveform.ts b/src/util/waveform.ts index c89cb1c7a..8fd076afe 100644 --- a/src/util/waveform.ts +++ b/src/util/waveform.ts @@ -1,6 +1,5 @@ /* eslint-disable no-bitwise */ -// eslint-disable-next-line max-len // Ref: https://github.com/telegramdesktop/tdesktop/blob/0743e71ab6b928d2ee5bae1aed991849b1e2b291/Telegram/SourceFiles/data/data_document.cpp#L1018 export function decodeWaveform(encoded5bit: Uint8Array) { const bitsCount = encoded5bit.length * 8; diff --git a/src/util/windowSize.ts b/src/util/windowSize.ts index a8260fcbe..9bf30791e 100644 --- a/src/util/windowSize.ts +++ b/src/util/windowSize.ts @@ -72,7 +72,6 @@ function isLandscape() { return window.matchMedia('(orientation: landscape)').matches; } - // eslint-disable-next-line max-len // Source: https://web.archive.org/web/20160509220835/http://blog.abouthalf.com/development/orientation-media-query-challenges-in-android-browsers/ // Feature is marked as deprecated now, but it is still supported // https://developer.mozilla.org/en-US/docs/Web/CSS/@media/device-aspect-ratio#browser_compatibility