Skip to content

Commit

Permalink
Fix eslint rules and errors (#7729)
Browse files Browse the repository at this point in the history
  • Loading branch information
daneryl authored Feb 27, 2025
1 parent aff1f11 commit 5d806bf
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ module.exports = {
parserOptions: { project: './tsconfig.json' },
rules: {
...rules,
'no-empty-function': ['error', { allow: ['constructors'] }],
'no-empty-function': ['warn', { allow: ['constructors'] }],
'no-useless-constructor': 'off',
},
},
Expand Down
2 changes: 1 addition & 1 deletion app/api/files.v2/infrastructure/FileSystemStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class FileSystemStorage implements FileStorage {
throw new Error('Method not implemented.');
}

getPath(file: UwaziFile): string {
getPath(_file: UwaziFile): string {
throw new Error('Method not implemented.');
}
}
4 changes: 2 additions & 2 deletions app/api/files.v2/specs/FilesHealthCheck.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ afterAll(async () => {

let testStorageFiles: StoredFile[] = [];
class TestFileStorage implements FileStorage {
async getFiles(inputs: GetFileInput[]): Promise<File[]> {
async getFiles(_inputs: GetFileInput[]): Promise<File[]> {
throw new Error('Method not implemented.');
}

async getFile(input: GetFileInput): Promise<File> {
async getFile(_input: GetFileInput): Promise<File> {
throw new Error('Method not implemented.');
}
// eslint-disable-next-line class-methods-use-this
Expand Down
1 change: 0 additions & 1 deletion app/api/paragraphExtraction/application/specs/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { FileBuilder } from 'api/files.v2/model/specs/utils/FileBuilder';
import { PXExtraction } from 'api/paragraphExtraction/domain/PXExtraction';
import { MongoPXExtractionDBO } from 'api/paragraphExtraction/infrastructure/MongoPXExtractionDBO';
import { MongoPXExtractorDBO } from 'api/paragraphExtraction/infrastructure/MongoPXExtractorDBO';
import { tenants } from 'api/tenants';
import { getFixturesFactory } from 'api/utils/fixturesFactory';
import { ObjectId } from 'mongodb';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { ResultSet } from 'api/common.v2/contracts/ResultSet';
import { MongoDataSource } from 'api/common.v2/database/MongoDataSource';
import { MongoResultSet } from 'api/common.v2/database/MongoResultSet';

import {
GetExtractorsInput,
GetExtractorsOutput,
PXExtractorsQueryService,
} from '../domain/PXExtractorsQueryService';
import { GetExtractorsOutput, PXExtractorsQueryService } from '../domain/PXExtractorsQueryService';
import { MongoPXExtractorDBO } from './MongoPXExtractorDBO';
import { mongoPXExtractorsCollection } from './MongoPXExtractorsDataSource';

Expand All @@ -16,7 +12,7 @@ class MongoPXExtractorsQueryService
{
protected collectionName = mongoPXExtractorsCollection;

getExtractors(input: GetExtractorsInput): ResultSet<GetExtractorsOutput> {
getExtractors(): ResultSet<GetExtractorsOutput> {
const cursor = this.getCollection().aggregate([
// Join with the templates collection to get sourceTemplate details
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('MongoPXExtractorsQueryService', () => {
it('should return target and source', async () => {
const { extractorsQueryService } = setUpSut();

const extractors = await extractorsQueryService.getExtractors({}).all();
const extractors = await extractorsQueryService.getExtractors().all();

expect(extractors).toMatchObject([
{
Expand All @@ -91,7 +91,7 @@ describe('MongoPXExtractorsQueryService', () => {
it('should count source Entities to be extracted which belongs to Extractor', async () => {
const { extractorsQueryService } = setUpSut();

const extractors = await extractorsQueryService.getExtractors({}).all();
const extractors = await extractorsQueryService.getExtractors().all();

expect(extractors).toMatchObject([
{
Expand Down
21 changes: 10 additions & 11 deletions app/api/services/pdfsegmentation/PDFSegmentation.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { TaskManager, ResultsMessage } from 'api/services/tasksmanager/TaskManager';
import { uploadsPath, storage } from 'api/files';
import { Readable } from 'stream';
import urljoin from 'url-join';
import { storage, uploadsPath } from 'api/files';
import { FileNotFound } from 'api/files/FileNotFound';
import { filesModel } from 'api/files/filesModel';
import path from 'path';
import { Settings } from 'shared/types/settingsType';
import { ResultsMessage, TaskManager } from 'api/services/tasksmanager/TaskManager';
import settings from 'api/settings/settings';
import { tenants } from 'api/tenants/tenantContext';
import { ObjectIdSchema } from 'shared/types/commonTypes';
import request from 'shared/JSONRequest';
import { handleError } from 'api/utils';
import { SegmentationType } from 'shared/types/segmentationType';
import path from 'path';
import request from 'shared/JSONRequest';
import { ObjectIdSchema } from 'shared/types/commonTypes';
import { FileType } from 'shared/types/fileType';
import { SegmentationType } from 'shared/types/segmentationType';
import { Settings } from 'shared/types/settingsType';
import { Readable } from 'stream';
import urljoin from 'url-join';
import { SegmentationModel } from './segmentationModel';
import { FileNotFound } from 'api/files/FileNotFound';
import { inspect } from 'util';

class PDFSegmentation {
static SERVICE_NAME = 'segmentation';
Expand Down
1 change: 0 additions & 1 deletion app/api/utils/testing_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { ThesaurusSchema } from 'shared/types/thesaurusType';
import { UserGroupSchema } from 'shared/types/userGroupType';
import uniqueID from 'shared/uniqueID';
import { config } from 'api/config';
import { mongoPXExtractorsCollection } from 'api/paragraphExtraction/infrastructure/MongoPXExtractorsDataSource';
import { UserSchema } from '../../shared/types/userType';
import { elasticTesting } from './elastic_testing';
import { testingTenants } from './testingTenants';
Expand Down

0 comments on commit 5d806bf

Please sign in to comment.