Skip to content

πŸ“ˆ Open source, privacy-first web analytics β€” a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

lint

Blue Mousefa8eb7bd581e
diff --git a/backend/apps/cloud/src/auth/dtos/process-sso-code.dto.ts b/backend/apps/cloud/src/auth/dtos/process-sso-code.dto.ts
index 0f2686d73..932156c77 100644
--- a/backend/apps/cloud/src/auth/dtos/process-sso-code.dto.ts
+++ b/backend/apps/cloud/src/auth/dtos/process-sso-code.dto.ts
@@ -14,8 +14,11 @@ export class ProcessSSOCodeDto {
example: '123e4567-e89b-12d3-a456-426614174000',
})
@IsString()
- @Matches(/^(google|github):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, {
- message: 'Invalid SSO session identifier.',
- })
+ @Matches(
+ /^(google|github):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
+ {
+ message: 'Invalid SSO session identifier.',
+ },
+ )
hash: string
}
diff --git a/backend/apps/cloud/src/auth/dtos/sso-get-jwt-by-hash.dto.ts b/backend/apps/cloud/src/auth/dtos/sso-get-jwt-by-hash.dto.ts
index 35224dd1d..20e914303 100644
--- a/backend/apps/cloud/src/auth/dtos/sso-get-jwt-by-hash.dto.ts
+++ b/backend/apps/cloud/src/auth/dtos/sso-get-jwt-by-hash.dto.ts
@@ -9,9 +9,12 @@ export class SSOGetJWTByHashDto {
example: '123e4567-e89b-12d3-a456-426614174000',
})
@IsString()
- @Matches(/^(google|github):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, {
- message: 'Invalid SSO session identifier.',
- })
+ @Matches(
+ /^(google|github):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
+ {
+ message: 'Invalid SSO session identifier.',
+ },
+ )
hash: string
@ApiProperty({
diff --git a/backend/apps/cloud/src/auth/dtos/sso-link.dto.ts b/backend/apps/cloud/src/auth/dtos/sso-link.dto.ts
index 90ab279f2..2a8e96fc3 100644
--- a/backend/apps/cloud/src/auth/dtos/sso-link.dto.ts
+++ b/backend/apps/cloud/src/auth/dtos/sso-link.dto.ts
@@ -9,9 +9,12 @@ export class SSOLinkDto {
example: '123e4567-e89b-12d3-a456-426614174000',
})
@IsString()
- @Matches(/^(google|github):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, {
- message: 'Invalid SSO session identifier.',
- })
+ @Matches(
+ /^(google|github):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
+ {
+ message: 'Invalid SSO session identifier.',
+ },
+ )
hash: string
@ApiProperty({
diff --git a/backend/apps/cloud/src/blog/blog.service.ts b/backend/apps/cloud/src/blog/blog.service.ts
index fdf12ae8a..8537d722e 100644
--- a/backend/apps/cloud/src/blog/blog.service.ts
+++ b/backend/apps/cloud/src/blog/blog.service.ts
@@ -154,7 +154,10 @@ const getArticlesMetaData = async () => {
}),
)
- return _sortBy(_filter(articles, a => !!a), ['_date']).reverse()
+ return _sortBy(
+ _filter(articles, a => !!a),
+ ['_date'],
+ ).reverse()
} catch {
return null
}
@@ -210,7 +213,9 @@ export class BlogService {
let dirents: any[]
try {
- const dirPath = category ? resolveBlogPostsPath(category) : BLOG_POSTS_BASE
+ const dirPath = category
+ ? resolveBlogPostsPath(category)
+ : BLOG_POSTS_BASE
dirents = await fs.readdir(dirPath, { withFileTypes: true })
} catch (reason) {
this.logger.warn(
diff --git a/backend/apps/cloud/src/captcha/captcha.service.ts b/backend/apps/cloud/src/captcha/captcha.service.ts
index 34dcf0c7f..b824326ed 100644
--- a/backend/apps/cloud/src/captcha/captcha.service.ts
+++ b/backend/apps/cloud/src/captcha/captcha.service.ts
@@ -59,10 +59,7 @@ const getChallengeCacheKey = (challenge: string): string => {
const signCaptchaCiphertext = (ciphertext: string, key: string): string => {
// NOTE: Encryption alone (CryptoJS.Rabbit) is malleable; we add an HMAC to
// prevent token tampering and replay-bypass via ciphertext bitflips.
- return crypto
- .createHmac('sha256', key)
- .update(ciphertext)
- .digest('base64url')
+ return crypto.createHmac('sha256', key).update(ciphertext).digest('base64url')
}
const timingSafeEqualString = (a: string, b: string): boolean => {
@@ -204,8 +201,14 @@ export class CaptchaService {
pid,
}
- const ciphertext = encryptString(JSON.stringify(token), project.captchaSecretKey)
- const signature = signCaptchaCiphertext(ciphertext, project.captchaSecretKey)
+ const ciphertext = encryptString(
+ JSON.stringify(token),
+ project.captchaSecretKey,
+ )
+ const signature = signCaptchaCiphertext(
+ ciphertext,
+ project.captchaSecretKey,
+ )
// Token format: <ciphertext>.<hmac_sha256(ciphertext)>
return `${ciphertext}.${signature}`
diff --git a/backend/apps/cloud/src/common/constants.ts b/backend/apps/cloud/src/common/constants.ts
index 0436a5a7c..c514abee4 100644
--- a/backend/apps/cloud/src/common/constants.ts
+++ b/backend/apps/cloud/src/common/constants.ts
@@ -79,8 +79,6 @@ const MAX_PAGES_IN_FUNNEL = 10
const TRAFFIC_SPIKE_ALLOWED_PERCENTAGE = 0.3
-const BLOG_POSTS_ROOT = 'blog-posts/posts'
-
const BLOG_POSTS_PATH = isDevelopment
? path.join(__dirname, '../../../..', 'blog-posts', 'posts')
: path.join(__dirname, '../..', 'blog-posts', 'posts')
@@ -216,7 +214,6 @@ export {
MAX_PAGES_IN_FUNNEL,
MAX_FUNNELS,
ALL_COLUMNS,
- BLOG_POSTS_ROOT,
TRAFFIC_SPIKE_ALLOWED_PERCENTAGE,
AFFILIATE_CUT,
PID_REGEX,
diff --git a/backend/apps/cloud/src/experiment/dto/experiment.dto.ts b/backend/apps/cloud/src/experiment/dto/experiment.dto.ts
index a165de867..d102e7b9f 100644
--- a/backend/apps/cloud/src/experiment/dto/experiment.dto.ts
+++ b/backend/apps/cloud/src/experiment/dto/experiment.dto.ts
@@ -6,7 +6,6 @@ import {
IsArray,
ValidateNested,
IsBoolean,
- IsNumber,
IsInt,
Min,
Max,
@@ -136,7 +135,9 @@ export class CreateExperimentDto {
@ApiProperty({ type: [ExperimentVariantDto] })
@IsArray()
- @ArrayMaxSize(20, { message: 'An experiment cannot have more than 20 variants' })
+ @ArrayMaxSize(20, {
+ message: 'An experiment cannot have more than 20 variants',
+ })
@ValidateNested({ each: true })
@Type(() => ExperimentVariantDto)
variants: ExperimentVariantDto[]
@@ -211,7 +212,9 @@ export class UpdateExperimentDto {
@ApiPropertyOptional({ type: [ExperimentVariantDto] })
@IsOptional()
@IsArray()
- @ArrayMaxSize(20, { message: 'An experiment cannot have more than 20 variants' })
+ @ArrayMaxSize(20, {
+ message: 'An experiment cannot have more than 20 variants',
+ })
@ValidateNested({ each: true })
@Type(() => ExperimentVariantDto)
variants?: ExperimentVariantDto[]
diff --git a/backend/apps/cloud/src/feature-flag/feature-flag.service.ts b/backend/apps/cloud/src/feature-flag/feature-flag.service.ts
index eff24141c..0a9025e6d 100644
--- a/backend/apps/cloud/src/feature-flag/feature-flag.service.ts
+++ b/backend/apps/cloud/src/feature-flag/feature-flag.service.ts
@@ -42,10 +42,7 @@ export class FeatureFlagService {
)
}
- queryBuilder
- .orderBy('flag.key', 'ASC')
- .take(safeTake)
- .skip(safeSkip)
+ queryBuilder.orderBy('flag.key', 'ASC').take(safeTake).skip(safeSkip)
const [results, total] = await queryBuilder.getManyAndCount()
diff --git a/backend/apps/cloud/src/goal/goal.controller.ts b/backend/apps/cloud/src/goal/goal.controller.ts
index d146fa6bf..6df5c4ba4 100644
--- a/backend/apps/cloud/src/goal/goal.controller.ts
+++ b/backend/apps/cloud/src/goal/goal.controller.ts
@@ -51,11 +51,11 @@ const GOALS_MAXIMUM = 50 // Maximum goals per project
const timeBucketConversion: Record<string, string> = Object.assign(
Object.create(null),
{
- minute: 'toStartOfMinute',
- hour: 'toStartOfHour',
- day: 'toStartOfDay',
- month: 'toStartOfMonth',
- year: 'toStartOfYear',
+ minute: 'toStartOfMinute',
+ hour: 'toStartOfHour',
+ day: 'toStartOfDay',
+ month: 'toStartOfMonth',
+ year: 'toStartOfYear',
},
)
@@ -646,10 +646,12 @@ export class GoalController {
)
const table = goal.type === GoalType.CUSTOM_EVENT ? 'customEV' : 'analytics'
- const timeBucketFunc =
- Object.prototype.hasOwnProperty.call(timeBucketConversion, resolvedTimeBucket)
- ? timeBucketConversion[resolvedTimeBucket]
- : 'toStartOfDay'
+ const timeBucketFunc = Object.prototype.hasOwnProperty.call(
+ timeBucketConversion,
+ resolvedTimeBucket,
+ )
+ ? timeBucketConversion[resolvedTimeBucket]
+ : 'toStartOfDay'
const [selector, groupBy] = this.getGroupSubquery(resolvedTimeBucket)
const { condition: matchCondition, params: matchParams } =
diff --git a/backend/apps/cloud/src/integrations/telegram/scene/projects.scene.ts b/backend/apps/cloud/src/integrations/telegram/scene/projects.scene.ts
index 137485d3f..e064c26d1 100644
--- a/backend/apps/cloud/src/integrations/telegram/scene/projects.scene.ts
+++ b/backend/apps/cloud/src/integrations/telegram/scene/projects.scene.ts
@@ -91,7 +91,9 @@ export class ProjectsScene {
const safeProjectName = this.telegramService.escapeTelegramMarkdown(
project.name,
)
- const safeProjectId = this.telegramService.escapeTelegramMarkdown(project.id)
+ const safeProjectId = this.telegramService.escapeTelegramMarkdown(
+ project.id,
+ )
const text =
`πŸ“Š *${safeProjectName}*` +
diff --git a/backend/apps/cloud/src/revenue/adapters/stripe.adapter.ts b/backend/apps/cloud/src/revenue/adapters/stripe.adapter.ts
index 55fc0a308..0daa9e482 100644
--- a/backend/apps/cloud/src/revenue/adapters/stripe.adapter.ts
+++ b/backend/apps/cloud/src/revenue/adapters/stripe.adapter.ts
@@ -237,11 +237,6 @@ export class StripeAdapter {
const sessionId =
metadata.swetrix_session_id || chargeMeta.swetrix_session_id || null
- const customer =
- intent.customer && typeof intent.customer !== 'string'
- ? intent.customer
- : null
-
const productName =
invoice?.lines?.data?.[0]?.description || intent.description || null
diff --git a/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.controller.ts b/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.controller.ts
index 1b89bfcce..a1f6b4378 100644
--- a/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.controller.ts
+++ b/backend/apps/cloud/src/twoFactorAuth/twoFactorAuth.controller.ts
@@ -49,7 +49,9 @@ export class TwoFactorAuthController {
// Prevent re-issuing a new secret while 2FA is already enabled (would allow secret rotation
// using only a pre-2FA access token).
if (user.isTwoFactorAuthenticationEnabled) {
- throw new BadRequestException('Two-factor authentication is already enabled')
+ throw new BadRequestException(
+ 'Two-factor authentication is already enabled',
+ )
}
return this.twoFactorAuthService.generateTwoFactorAuthenticationSecret(user)
@@ -79,11 +81,15 @@ export class TwoFactorAuthController {
}
if (user.isTwoFactorAuthenticationEnabled) {
- throw new BadRequestException('Two-factor authentication is already enabled')
+ throw new BadRequestException(
+ 'Two-factor authentication is already enabled',
+ )
}
if (!user.twoFactorAuthenticationSecret) {
- throw new BadRequestException('Two-factor authentication is not initialised')
+ throw new BadRequestException(
+ 'Two-factor authentication is not initialised',
+ )
}
const isCodeValid =
diff --git a/backend/apps/community/src/analytics/analytics.service.ts b/backend/apps/community/src/analytics/analytics.service.ts
index d6e82663f..db339f23c 100644
--- a/backend/apps/community/src/analytics/analytics.service.ts
+++ b/backend/apps/community/src/analytics/analytics.service.ts
@@ -303,7 +303,8 @@ export enum DataType {
}
const isValidOrigin = (origins: string[], origin: string) => {
- const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ const escapeRegex = (str: string) =>
+ str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
for (let i = 0; i < _size(origins); ++i) {
const allowedOrigin = origins[i]
@@ -4094,7 +4095,12 @@ export class AnalyticsService {
const { data } = await clickhouse
.query({
query,
- query_params: { ...paramsData.params, timezone: safeTimezone, take, skip },
+ query_params: {
+ ...paramsData.params,
+ timezone: safeTimezone,
+ take,
+ skip,
+ },
})
.then(resultSet => resultSet.json())
@@ -4159,7 +4165,12 @@ export class AnalyticsService {
const { data } = await clickhouse
.query({
query,
- query_params: { ...paramsData.params, timezone: safeTimezone, take, skip },
+ query_params: {
+ ...paramsData.params,
+ timezone: safeTimezone,
+ take,
+ skip,
+ },
})
.then(resultSet => resultSet.json())
diff --git a/backend/apps/community/src/goal/goal.controller.ts b/backend/apps/community/src/goal/goal.controller.ts
index 4aeab72c6..00d55317a 100644
--- a/backend/apps/community/src/goal/goal.controller.ts
+++ b/backend/apps/community/src/goal/goal.controller.ts
@@ -38,11 +38,11 @@ const GOALS_MAXIMUM = 50 // Maximum goals per project
const timeBucketConversion: Record<string, string> = Object.assign(
Object.create(null),
{
- minute: 'toStartOfMinute',
- hour: 'toStartOfHour',
- day: 'toStartOfDay',
- month: 'toStartOfMonth',
- year: 'toStartOfYear',
+ minute: 'toStartOfMinute',
+ hour: 'toStartOfHour',
+ day: 'toStartOfDay',
+ month: 'toStartOfMonth',
+ year: 'toStartOfYear',
},
)
@@ -567,10 +567,12 @@ export class GoalController {
)
const table = goal.type === GoalType.CUSTOM_EVENT ? 'customEV' : 'analytics'
- const timeBucketFunc =
- Object.prototype.hasOwnProperty.call(timeBucketConversion, resolvedTimeBucket)
- ? timeBucketConversion[resolvedTimeBucket]
- : 'toStartOfDay'
+ const timeBucketFunc = Object.prototype.hasOwnProperty.call(
+ timeBucketConversion,
+ resolvedTimeBucket,
+ )
+ ? timeBucketConversion[resolvedTimeBucket]
+ : 'toStartOfDay'
const [selector, groupBy] = this.getGroupSubquery(resolvedTimeBucket)
const { condition: matchCondition, params: matchParams } =
diff --git a/web/app/pages/Project/View/components/InteractiveMap.tsx b/web/app/pages/Project/View/components/InteractiveMap.tsx
index 6ade73eb5..1bff2ef6a 100644
--- a/web/app/pages/Project/View/components/InteractiveMap.tsx
+++ b/web/app/pages/Project/View/components/InteractiveMap.tsx
@@ -353,7 +353,7 @@ const InteractiveMapCore = ({
},
})
},
- [findDataForFeature, total, onClick, mapView, theme, handleStyle, repositionTooltip],
+ [findDataForFeature, total, onClick, mapView, theme, handleStyle, repositionTooltip, isErrorsTab, isPerformanceTab],
)
const MapEventHandler = () => {
diff --git a/web/app/pages/Project/View/components/NoEvents.tsx b/web/app/pages/Project/View/components/NoEvents.tsx
index a2ac75dcb..f8f59aba5 100644
--- a/web/app/pages/Project/View/components/NoEvents.tsx
+++ b/web/app/pages/Project/View/components/NoEvents.tsx
@@ -21,11 +21,11 @@ const NoEvents = ({ filters }: NoEventsProps) => {
return (
<>
- {hasFilters && (
+ {hasFilters ? (
<div className='mt-4'>
<Filters tnMapping={tnMapping} />
</div>
- )}
+ ) : null}
<div className='mx-auto w-full max-w-2xl py-16 text-center'>
<div className='mx-auto mb-6 flex size-14 items-center justify-center rounded-xl bg-gray-100 dark:bg-slate-800'>
{hasFilters ? (
diff --git a/web/app/root.tsx b/web/app/root.tsx
index 0a786d003..98f896087 100644
--- a/web/app/root.tsx
+++ b/web/app/root.tsx
@@ -254,7 +254,9 @@ export default function App() {
/>
<script
dangerouslySetInnerHTML={{
- __html: `window.REMIX_ENV = ${JSON.stringify(REMIX_ENV).replace(/</g, '\\u003c').replace(/\u2028|\u2029/g, '')}`,
+ __html: `window.REMIX_ENV = ${JSON.stringify(REMIX_ENV)
+ .replace(/</g, '\\u003c')
+ .replace(/\u2028|\u2029/g, '')}`,
}}
/>
</head>