Skip to content

Commit fa9fa9b

Browse files
haydenbleaselsprettizadoesdev
authored
Ultracite fixes (#154)
* Bump Biome and Ultracite * Update biome.jsonc * Update biome.jsonc * Disable no-console * Run formatter * Update lint and format commands * Fix typo * Enable useAwait * Enable noForEach * quick fixxx (#145) * quick fixxx * Delete packages/db/src/drizzle/meta/0000_snapshot.json * Delete packages/db/src/drizzle/meta/_journal.json * fix: flagfs * Ignore shadcn files * Enable useTopLevelRegex * Enable noNamespaceImport * Enable useHookAtTopLevel * Enable noUnreachable * Enable noUnusedFunctionParameters * Enable noUnusedVariables * Enable noInvalidUseBeforeDeclaration * Enable noNestedComponentDefinitions * Enable noEvolvingTypes * Enable noImplicitAnyLet * Enable noShadowRestrictedNames * Enable useSemanticElements * Enable useAriaPropsForRole * Enable useFocusableInteractive * Enable useKeyWithClickEvents * feat stuff --------- Co-authored-by: Dino Hukanovic <[email protected]> Co-authored-by: Hyteq <[email protected]>
1 parent 6e2c00d commit fa9fa9b

File tree

77 files changed

+1106
-1639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1106
-1639
lines changed

apps/api/src/agent_v2/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function getPrompt(
4444
}
4545
}
4646

47-
export async function handleMessage(
47+
export function handleMessage(
4848
messages: ModelMessage[],
4949
mode: Mode,
5050
websiteId: string,

apps/api/src/routes/custom-sql.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,19 @@ async function validateAPIKeyAndPermissions(
699699
return { status: 200, response: null };
700700
}
701701

702+
const UNKNOWN_COLUMN_REGEX =
703+
/Unknown expression or function identifier `(\w+)`/;
704+
const TABLE_NOT_FOUND_REGEX = /Table\s+[\w.]*\.(\w+)\s+does not exist/;
705+
const SUBSTITUTION_NOT_SET_REGEX = /Substitution `(\w+)` is not set/;
706+
702707
function parseClickHouseError(errorMessage: string): {
703708
error: string;
704709
suggestion?: string;
705710
code: string;
706711
} {
707712
// Column not found errors
708713
if (errorMessage.includes('Unknown expression or function identifier')) {
709-
const columnMatch = errorMessage.match(
710-
/Unknown expression or function identifier `(\w+)`/
711-
);
714+
const columnMatch = errorMessage.match(UNKNOWN_COLUMN_REGEX);
712715
if (columnMatch) {
713716
const column = columnMatch[1];
714717
let suggestion = '';
@@ -746,9 +749,7 @@ function parseClickHouseError(errorMessage: string): {
746749
errorMessage.includes('Table') &&
747750
errorMessage.includes('does not exist')
748751
) {
749-
const tableMatch = errorMessage.match(
750-
/Table\s+[\w.]*\.(\w+)\s+does not exist/
751-
);
752+
const tableMatch = errorMessage.match(TABLE_NOT_FOUND_REGEX);
752753
if (tableMatch) {
753754
const table = tableMatch[1];
754755
return {
@@ -788,7 +789,7 @@ function parseClickHouseError(errorMessage: string): {
788789
errorMessage.includes('Substitution') &&
789790
errorMessage.includes('is not set')
790791
) {
791-
const paramMatch = errorMessage.match(/Substitution `(\w+)` is not set/);
792+
const paramMatch = errorMessage.match(SUBSTITUTION_NOT_SET_REGEX);
792793
if (paramMatch) {
793794
const param = paramMatch[1];
794795
return {

apps/api/src/routes/public/flags.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface UserContext {
1313
}
1414

1515
interface FlagRule {
16-
type: 'user_id' | 'email' | 'property' | 'percentage';
16+
type: 'user_id' | 'email' | 'property';
1717
operator: string;
1818
field?: string;
1919
value?: unknown;
@@ -311,7 +311,7 @@ describe('Flag Evaluation System', () => {
311311
describe('Percentage Rules', () => {
312312
it('should enable users within percentage threshold', () => {
313313
const rule: FlagRule = {
314-
type: 'percentage',
314+
type: 'property',
315315
operator: 'equals',
316316
value: 50,
317317
enabled: true,
@@ -335,7 +335,7 @@ describe('Flag Evaluation System', () => {
335335

336336
it('should be consistent for same user', () => {
337337
const rule: FlagRule = {
338-
type: 'percentage',
338+
type: 'property',
339339
operator: 'equals',
340340
value: 25,
341341
enabled: true,
@@ -354,7 +354,7 @@ describe('Flag Evaluation System', () => {
354354

355355
it('should handle invalid percentage values', () => {
356356
const rule: FlagRule = {
357-
type: 'percentage',
357+
type: 'property',
358358
operator: 'equals',
359359
value: 'invalid',
360360
enabled: true,
@@ -694,7 +694,7 @@ describe('Flag Evaluation System', () => {
694694
payload: { rollout: true },
695695
rules: [
696696
{
697-
type: 'percentage',
697+
type: 'property',
698698
operator: 'equals',
699699
value: 30,
700700
enabled: false,
@@ -703,7 +703,7 @@ describe('Flag Evaluation System', () => {
703703
],
704704
};
705705

706-
let enabledByRollout = 0;
706+
let _enabledByRollout = 0;
707707
let disabledByRule = 0;
708708
let totalEnabled = 0;
709709

@@ -714,7 +714,7 @@ describe('Flag Evaluation System', () => {
714714
if (result.enabled) {
715715
totalEnabled++;
716716
if (result.reason === 'ROLLOUT_ENABLED') {
717-
enabledByRollout++;
717+
_enabledByRollout++;
718718
}
719719
} else if (result.reason === 'USER_RULE_MATCH') {
720720
disabledByRule++;
@@ -785,7 +785,7 @@ describe('Flag Evaluation System', () => {
785785
payload: { percentage: true },
786786
rules: [
787787
{
788-
type: 'percentage',
788+
type: 'property',
789789
operator: 'equals',
790790
value: 25,
791791
enabled: true,

apps/api/src/routes/public/flags.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface UserContext {
2525
}
2626

2727
interface FlagRule {
28-
type: 'user_id' | 'email' | 'property' | 'percentage';
28+
type: 'user_id' | 'email' | 'property';
2929
operator: string;
3030
field?: string;
3131
value?: unknown;
@@ -155,15 +155,15 @@ export function evaluateRule(rule: FlagRule, context: UserContext): boolean {
155155
const propertyValue = context.properties?.[rule.field];
156156
return evaluateValueRule(propertyValue, rule);
157157
}
158-
case 'percentage': {
159-
if (typeof rule.value !== 'number') {
160-
return false;
161-
}
162-
const userId = context.userId || context.email || 'anonymous';
163-
const hash = hashString(`percentage:${userId}`);
164-
const percentage = hash % 100;
165-
return percentage < rule.value;
166-
}
158+
// case 'percentage': {
159+
// if (typeof rule.value !== 'number') {
160+
// return false;
161+
// }
162+
// const userId = context.userId || context.email || 'anonymous';
163+
// const hash = hashString(`percentage:${userId}`);
164+
// const percentage = hash % 100;
165+
// return percentage < rule.value;
166+
// }
167167
default:
168168
return false;
169169
}
@@ -336,7 +336,7 @@ export const flagsRoute = new Elysia({ prefix: '/v1/flags' })
336336
count: Object.keys(enabledFlags).length,
337337
timestamp: new Date().toISOString(),
338338
};
339-
} catch (error) {
339+
} catch (_error) {
340340
logger.error('Bulk flag evaluation failed');
341341
set.status = 500;
342342
return {

apps/basket/src/routes/basket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ const app = new Elysia()
928928
}
929929
}
930930

931-
const results = [];
931+
const results: any[] = [];
932932
const processingPromises = body.map(async (event: any) => {
933933
const eventType = event.type || 'track';
934934

apps/dashboard/app/(auth)/register/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function RegisterPageContent() {
155155
},
156156
},
157157
});
158-
} catch (error) {
158+
} catch (_error) {
159159
toast.error('Login failed. Please try again.');
160160
setIsLoading(false);
161161
}

apps/dashboard/app/(main)/billing/cost-breakdown/components/consumption-chart.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export function ConsumptionChart({
8484
{} as Record<string, number>
8585
);
8686

87-
return Array.from(dailyDataMap.entries()).map(([date, eventCounts]) => {
87+
const entries = Array.from(dailyDataMap.entries());
88+
89+
return entries.map(([date, eventCounts]) => {
8890
const dayData: any = {
8991
date: new Date(date).toLocaleDateString('en-US', {
9092
month: 'short',
@@ -94,10 +96,10 @@ export function ConsumptionChart({
9496
};
9597

9698
// Use real data from ClickHouse, not approximations
97-
Object.keys(EVENT_TYPE_COLORS).forEach((eventType) => {
99+
for (const eventType of Object.keys(EVENT_TYPE_COLORS)) {
98100
if (hiddenTypes[eventType]) {
99101
dayData[eventType] = 0;
100-
return;
102+
continue;
101103
}
102104
const actualAmount = eventCounts[eventType] || 0;
103105

@@ -107,7 +109,7 @@ export function ConsumptionChart({
107109
} else {
108110
dayData[eventType] = actualAmount;
109111
}
110-
});
112+
}
111113

112114
return dayData;
113115
});

apps/dashboard/app/(main)/billing/cost-breakdown/components/usage-breakdown-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export function UsageBreakdownTable({
102102
);
103103
}
104104

105-
const { eventTypeBreakdown, totalEvents } = usageData;
105+
const { eventTypeBreakdown } = usageData;
106106

107107
const sortedBreakdown = [...eventTypeBreakdown].sort(
108108
(a, b) => b.event_count - a.event_count

apps/dashboard/app/(main)/sandbox/api-testing/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function ApiTestingPage() {
3434
await new Promise((resolve) => setTimeout(resolve, 1000));
3535

3636
// Mock response based on endpoint
37-
let mockResponse;
37+
let mockResponse: any;
3838
if (endpoint.includes('analytics')) {
3939
mockResponse = {
4040
status: 200,

apps/dashboard/app/(main)/settings/_components/password-form.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ const formSchema = z
4949

5050
type FormValues = z.infer<typeof formSchema>;
5151

52+
const LOWERCASE_REGEX = /[a-z]/;
53+
const UPPERCASE_REGEX = /[A-Z]/;
54+
const NUMBERS_REGEX = /\d/;
55+
const SPECIAL_CHARS_REGEX = /[!@#$%^&*(),.?":{}|<>]/;
56+
5257
function calculatePasswordStrength(password: string): {
5358
score: number;
5459
feedback: string;
@@ -61,10 +66,10 @@ function calculatePasswordStrength(password: string): {
6166
let score = 0;
6267
const checks = {
6368
length: password.length >= 8,
64-
lowercase: /[a-z]/.test(password),
65-
uppercase: /[A-Z]/.test(password),
66-
numbers: /\d/.test(password),
67-
special: /[!@#$%^&*(),.?":{}|<>]/.test(password),
69+
lowercase: LOWERCASE_REGEX.test(password),
70+
uppercase: UPPERCASE_REGEX.test(password),
71+
numbers: NUMBERS_REGEX.test(password),
72+
special: SPECIAL_CHARS_REGEX.test(password),
6873
};
6974

7075
score += checks.length ? 20 : 0;

0 commit comments

Comments
 (0)