Skip to content

Commit

Permalink
fix(api): fix all lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-plahn committed Sep 21, 2022
1 parent 4dcc704 commit 7d76e86
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
"*.jsx"
],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error",{
"varsIgnorePattern": "^_",
"argsIgnorePattern": "^_"
}],
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
Expand Down
3 changes: 2 additions & 1 deletion apps/api/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
// TODO: Re-enable this
"@nrwl/nx/enforce-module-boundaries": [2],
// When dealing generically with class instances we need object as a type
"@typescript-eslint/ban-types": [0]
"@typescript-eslint/ban-types": [0],
"@typescript-eslint/no-unused-vars": [2]
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class DisallowedContextTypeForResourceError extends InternalError
contextType: EdgeConnectionContextType,
resourceCompositeIdentifier: ResourceCompositeIdentifier
) {
super(`Disallowed context type for resource type`);
super(
`Disallowed context type: ${contextType} for resource type: ${resourceCompositeIdentifier}`
);
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
import { InternalError } from '../../../../../../lib/errors/InternalError';
import formatPosition2D from '../../../../../../view-models/presentation/formatPosition2D';
import formatResourceCompositeIdentifier from '../../../../../../view-models/presentation/formatResourceCompositeIdentifier';
import { Position2D } from '../../../../../models/spatial-feature/types/Coordinates/Position2D';
import { ResourceCompositeIdentifier } from '../../../../../models/types/entityCompositeIdentifier';

// TODO refactor using format helpers in presentation layer
const formatPointsAsList = (points: Position2D[]): string =>
points
.reduce(
(accumulatedString, point) => accumulatedString.concat(formatPosition2D(point), ','),
''
)
// remove trailing ','
.slice(0, -1);

export default class FreeMultilineContextOutOfBoundsError extends InternalError {
constructor(
resourceCompositeIdentifier: ResourceCompositeIdentifier,
Expand Down
15 changes: 2 additions & 13 deletions apps/api/src/test-data/validateTestData.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { writeFileSync } from 'fs';
import { getValidatorForEntity } from '../domain/domainModelValidators';
import validateEdgeConnection from '../domain/domainModelValidators/contextValidators/validateEdgeConnection';
import { isValid, Valid } from '../domain/domainModelValidators/Valid';
import {
EdgeConnection,
EdgeConnectionMemberRole,
} from '../domain/models/context/edge-connection.entity';
import { EdgeConnectionMemberRole } from '../domain/models/context/edge-connection.entity';
import { Resource } from '../domain/models/resource.entity';
import {
isResourceType,
Expand All @@ -21,18 +18,10 @@ import mapEntityDTOToDatabaseDTO from '../persistence/database/utilities/mapEnti
import { DTO } from '../types/DTO';
import buildTestData from './buildTestData';

export type InMemorySnapshotOfResourceDTOs = {
type InMemorySnapshotOfResourceDTOs = {
[K in keyof ResourceTypeToInstance]?: DTO<ResourceTypeToInstance>[K][];
};

type InMemorySnapshotOfConnectionDTOs = {
connections?: DTO<EdgeConnection>[];
};

type InMemorySnapshotOfDTOs = {
resources: InMemorySnapshotOfResourceDTOs;
} & InMemorySnapshotOfConnectionDTOs;

describe('buildTestData', () => {
const testData = buildTestData();

Expand Down

0 comments on commit 7d76e86

Please sign in to comment.