Skip to content

Commit

Permalink
removed unwanted eslint-disable
Browse files Browse the repository at this point in the history
- removed unwanted eslint disable respectfully to latest eslint-config-codex
- updated eslint-config-codex version in package.json
  • Loading branch information
e11sy committed Apr 3, 2024
1 parent 5150a4d commit 94643c4
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 96 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@types/pg": "^8.10.2",
"@vitest/coverage-v8": "^0.34.5",
"eslint": "^8.41.0",
"eslint-config-codex": "^1.8.3",
"eslint-config-codex": "^1.9.2",
"eslint-plugin-vitest": "^0.3.1",
"nodemon": "^2.0.22",
"pino-pretty": "^10.0.0",
Expand Down
3 changes: 1 addition & 2 deletions src/repository/storage/postgres/orm/sequelize/noteVisits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export default class NoteVisitsSequelizeStorage {
tableName: this.tableName,
sequelize: this.database,
/**
* Auto-generated timestamp attributes would be removed from the model
* (e.g. auto-generated created_at field conflicts with note.created_at when noteVisitModel is included)
* Disable auto-generated created_at and updated_at since we use own visited_at
*/
timestamps: false,
});
Expand Down
15 changes: 6 additions & 9 deletions src/tests/utils/database-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ export default class DatabaseHelpers {
const content = note.content ?? '{}';
const publicId = note.publicId ?? createPublicId();

/** eslint disabled because metadata variable is never user */
/* eslint-disable-next-line */
const [results, metadata] = await this.orm.connection.query(`INSERT INTO public.notes ("content", "creator_id", "created_at", "updated_at", "public_id")
const [results, _] = await this.orm.connection.query(`INSERT INTO public.notes ("content", "creator_id", "created_at", "updated_at", "public_id")
VALUES ('${content}', ${note.creatorId}, CURRENT_DATE, CURRENT_DATE, '${publicId}')
RETURNING "id", "content", "creator_id" AS "creatorId", "public_id" AS "publicId", "created_at" AS "createdAt", "updated_at" AS "updatedAt"`,
{
Expand Down Expand Up @@ -149,8 +147,7 @@ export default class DatabaseHelpers {
const name = user?.name ?? `CodeX-${randomPart}`;
const email = user?.email ?? `${randomPart}@codexmail.com`;

/* eslint-disable-next-line */
const [results, metadata] = await this.orm.connection.query(`INSERT INTO public.users ("email", "name", "created_at", "editor_tools")
const [results, _] = await this.orm.connection.query(`INSERT INTO public.users ("email", "name", "created_at", "editor_tools")
VALUES ('${email}', '${name}', CURRENT_DATE, '${editorTools}'::jsonb)
RETURNING "id", "email", "name", "editor_tools" AS "editorTools", "created_at" AS "createdAt", "photo"`,
{
Expand Down Expand Up @@ -230,8 +227,8 @@ export default class DatabaseHelpers {
public async insertEditorTool(editorTool: EditorToolMockCreationAttributes): Promise<EditorTool['id']> {
const isDefault = editorTool.isDefault ?? false;

/* eslint-disable-next-line */
const [result, metadata] = await this.orm.connection.query(`INSERT INTO public.editor_tools ("name", "title", "export_name", "source", "is_default")

const [result, _] = await this.orm.connection.query(`INSERT INTO public.editor_tools ("name", "title", "export_name", "source", "is_default")
VALUES ('${editorTool.name}', '${editorTool.title}', '${editorTool.exportName}', '${JSON.stringify(editorTool.source)}', ${isDefault})
RETURNING "id"`);

Expand All @@ -250,8 +247,8 @@ export default class DatabaseHelpers {
public async insertNoteVisit(visit: NoteVisitCreationAttributes): Promise<NoteVisit> {
const visitedAt = visit.visitedAt ?? 'NOW()';

/* eslint-disable-next-line */
const [results, metadata] = await this.orm.connection.query(`INSERT INTO public.note_visits ("user_id", "note_id", "visited_at")

const [results, _] = await this.orm.connection.query(`INSERT INTO public.note_visits ("user_id", "note_id", "visited_at")
VALUES (${visit.userId}, ${visit.noteId}, ${visitedAt})
RETURNING "user_id" AS "userId", "note_id" AS "noteId", "visited_at" AS "visitedAt"`,
{
Expand Down
Loading

0 comments on commit 94643c4

Please sign in to comment.