From f16e340fd2c673310955916ccb4bb8093c5d202d Mon Sep 17 00:00:00 2001 From: Antonio De Lucreziis Date: Thu, 14 Mar 2024 21:25:00 +0100 Subject: [PATCH] chore: some changes and run prettier everywhere --- src/client/Appunti.jsx | 15 +++++++++++++++ src/db/index.ts | 8 ++++---- src/db/migrate.ts | 6 +++--- src/db/schema.ts | 36 +++++++++++++++++------------------ src/pages/appunti/index.astro | 21 ++++++++++---------- src/scripts/circuits-art.ts | 4 ++-- src/styles/components.scss | 8 ++++++-- src/styles/typography.scss | 6 ++---- tsconfig.json | 3 ++- 9 files changed, 62 insertions(+), 45 deletions(-) diff --git a/src/client/Appunti.jsx b/src/client/Appunti.jsx index e7f77e3..415f73f 100644 --- a/src/client/Appunti.jsx +++ b/src/client/Appunti.jsx @@ -1,3 +1,18 @@ +/** + * @typedef {{ + * image?: string, + * course?: string, + * title?: string, + * author: string, + * courseYear: string + * }} AppuntiCardProps + */ + +/** + * + * @param {AppuntiCardProps} param0 + * @returns + */ export const AppuntiCard = ({ image, course, title, author, courseYear }) => { return (
diff --git a/src/db/index.ts b/src/db/index.ts index f1758b8..29dea8b 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,5 +1,5 @@ -import { drizzle } from "drizzle-orm/better-sqlite3"; -import Database from "better-sqlite3"; +import { drizzle } from 'drizzle-orm/better-sqlite3' +import Database from 'better-sqlite3' -const sql = new Database("out/website.sqlite"); -export const db = drizzle(sql); +const sql = new Database('out/website.sqlite') +export const db = drizzle(sql) diff --git a/src/db/migrate.ts b/src/db/migrate.ts index 4508ccc..6ecf662 100644 --- a/src/db/migrate.ts +++ b/src/db/migrate.ts @@ -1,4 +1,4 @@ -import { migrate } from "drizzle-orm/better-sqlite3/migrator"; -import { db } from "./index"; +import { migrate } from 'drizzle-orm/better-sqlite3/migrator' +import { db } from './index' -migrate(db, { migrationsFolder: "out/drizzle" }); +migrate(db, { migrationsFolder: 'out/drizzle' }) diff --git a/src/db/schema.ts b/src/db/schema.ts index bfb5bc6..b55ef25 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -1,9 +1,9 @@ -import { sql } from "drizzle-orm"; -import { text, sqliteTable } from "drizzle-orm/sqlite-core"; +import { sql } from 'drizzle-orm' +import { text, sqliteTable } from 'drizzle-orm/sqlite-core' -export const users = sqliteTable("users", { +export const users = sqliteTable('users', { // id è l'id unico di questo utente, non è modificabile una volta creato l'utente. - id: text("id") + id: text('id') .primaryKey() .default(sql`(lower(hex(randomblob(16))))`), @@ -14,30 +14,30 @@ export const users = sqliteTable("users", { // chiesto se usare quello dell'account che sta usando o se cambiarlo // (in teoria non dovrebbe essere un problema poterlo modificare // successivamente). - username: text("username").unique().notNull(), + username: text('username').unique().notNull(), // FullName da mostrare in giro per il sito - fullName: text("fullname"), + fullName: text('fullname'), // Email per eventuale contatto - email: text("email"), -}); + email: text('email'), +}) -export type User = typeof users.$inferSelect; // return type when queried -export type InsertUser = typeof users.$inferInsert; // insert type +export type User = typeof users.$inferSelect // return type when queried +export type InsertUser = typeof users.$inferInsert // insert type -export const accounts = sqliteTable("accounts", { +export const accounts = sqliteTable('accounts', { // id è l'id unico di questo account, non è modificabile una volta creato l'account. - id: text("id").primaryKey(), + id: text('id').primaryKey(), - userId: text("userId") + userId: text('userId') .notNull() .references(() => users.id), - provider: text("provider").$type<"poisson" | "ateneo">().notNull(), + provider: text('provider').$type<'poisson' | 'ateneo'>().notNull(), - token: text("token").notNull(), -}); + token: text('token').notNull(), +}) -export type Account = typeof accounts.$inferSelect; // return type when queried -export type InsertAccount = typeof accounts.$inferInsert; // insert type +export type Account = typeof accounts.$inferSelect // return type when queried +export type InsertAccount = typeof accounts.$inferInsert // insert type diff --git a/src/pages/appunti/index.astro b/src/pages/appunti/index.astro index 663a84a..388bb7a 100644 --- a/src/pages/appunti/index.astro +++ b/src/pages/appunti/index.astro @@ -14,7 +14,7 @@ import { AppuntiList, AppuntiCard } from '@client/Appunti'

In primo piano

-
+
@@ -28,15 +28,15 @@ import { AppuntiList, AppuntiCard } from '@client/Appunti'
- - - - - - - - - + + + + + + + + +

Algebra Lineare

@@ -61,5 +61,4 @@ import { AppuntiList, AppuntiCard } from '@client/Appunti'
- diff --git a/src/scripts/circuits-art.ts b/src/scripts/circuits-art.ts index fc76d7f..fc525c0 100644 --- a/src/scripts/circuits-art.ts +++ b/src/scripts/circuits-art.ts @@ -275,14 +275,14 @@ const DIR_AVAILABLE_PREDICATE: Record, position: Point2, - directions: WireDirection[] + directions: WireDirection[], ): WireDirection[] { return directions.filter(dir => DIR_AVAILABLE_PREDICATE[dir](position, grid)) } function generateWire( grid: Grid, - startingPoint: Point2 + startingPoint: Point2, ): { position: Point2; direction: WireCell }[] { const segmentLength = Math.floor(1 - Math.random() ** 2) * 10 + 30 let currentPosition = startingPoint diff --git a/src/styles/components.scss b/src/styles/components.scss index c2837e3..3bd2f43 100644 --- a/src/styles/components.scss +++ b/src/styles/components.scss @@ -12,7 +12,11 @@ $news-accent-bg: #f8e8b1; place-content: center; font-size: 24px; - font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; + font-variation-settings: + 'FILL' 0, + 'wght' 300, + 'GRAD' 0, + 'opsz' 24; } .search { @@ -26,7 +30,7 @@ $news-accent-bg: #f8e8b1; align-items: center; cursor: pointer; - + background: #fff; &:hover, diff --git a/src/styles/typography.scss b/src/styles/typography.scss index a8d115b..98dc01b 100644 --- a/src/styles/typography.scss +++ b/src/styles/typography.scss @@ -1,4 +1,3 @@ - @function pow($number, $exponent) { $value: 1; @@ -17,7 +16,7 @@ @for $i from 1 through 5 { $factor: pow($heading-scale, 5 - $i); - + h#{$i} { font-size: $base-font-size * $factor; font-family: 'Source Sans Pro', monospace; @@ -71,7 +70,6 @@ } } - p { line-height: 1.65; margin: 0.5rem auto; @@ -91,4 +89,4 @@ margin: 0 0.75rem; } } -} \ No newline at end of file +} diff --git a/tsconfig.json b/tsconfig.json index 9157059..423d21c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "astro/tsconfigs/strict", "compilerOptions": { + "strict": false, "jsx": "react-jsx", "jsxImportSource": "preact", "strictNullChecks": true, @@ -9,7 +10,7 @@ "paths": { "@/*": ["src/*"], "@layouts/*": ["src/layouts/*"], - "@client/*": ["src/client/*"], + "@client/*": ["src/client/*"] } } }