Skip to content

Commit

Permalink
happy lintin' round2
Browse files Browse the repository at this point in the history
  • Loading branch information
pazbardanl committed Jan 17, 2024
1 parent f6fdee2 commit eb2e874
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/lib/mock-observations/helpers/CommonGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Generator} from '../interfaces';
class CommonGenerator implements Generator {
private name = '';
private generateObject: {} = {};
initialise(name: string, config:{[key:string]: any}): void {
initialise(name: string, config: {[key: string]: any}): void {
this.name = this.validateName(name);
// TODO PB -- validate config is not null, not empty and a valid yml object, use yaml.parse(input)
// TODO PB -- object immutabilty - copy by value here
Expand All @@ -12,9 +12,9 @@ class CommonGenerator implements Generator {

next(_historical: Object[]): Object {

Check warning on line 13 in src/lib/mock-observations/helpers/CommonGenerator.ts

View workflow job for this annotation

GitHub Actions / build

'_historical' is defined but never used
// TODO PB -- object immutabilty - copy by value here
return this.generateObject
return this.generateObject;
}

public getName(): String {
return this.name;
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/mock-observations/helpers/RandIntGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class RandIntGenerator implements Generator {
private min = 0;
private max = 0;

initialise(fieldToPopulate: string, config: { [key: string]: any }): void {
initialise(fieldToPopulate: string, config: {[key: string]: any}): void {
this.fieldToPopulate = this.validateName(fieldToPopulate);
this.validateConfig(config);
this.min = config[RandIntGenerator.MIN];
Expand All @@ -34,12 +34,12 @@ class RandIntGenerator implements Generator {
}

// TODO PB: extract to a utils class?
private validateConfig(config: {[key: string]: any }): void {
if (!config.hasOwnProperty(RandIntGenerator.MIN)) {
private validateConfig(config: { [key: string]: any }): void {

Check failure on line 37 in src/lib/mock-observations/helpers/RandIntGenerator.ts

View workflow job for this annotation

GitHub Actions / build

Replace `·[key:·string]:·any·` with `[key:·string]:·any`
if (!Object.prototype.hasOwnProperty.call(config, RandIntGenerator.MIN)) {
// TODO PB - custom / more specific error?
throw new Error('config is missing ' + RandIntGenerator.MIN);
}
if (!config.hasOwnProperty(RandIntGenerator.MAX)) {
if (!Object.prototype.hasOwnProperty.call(config, RandIntGenerator.MAX)) {
// TODO PB - custom / more specific error?
throw new Error('config is missing ' + RandIntGenerator.MAX);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mock-observations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class MockObservations implements ModelPluginInterface {
duration: this.duration,
};
// TODO PB -- consider this way to copy key-value pairs from component to observation, it looks like an overkill
for (const key in component) {
for (const key in component) {
if (Object.prototype.hasOwnProperty.call(component, key)) {

Check failure on line 44 in src/lib/mock-observations/index.ts

View workflow job for this annotation

GitHub Actions / build

Delete `␍`
observation[key] = component[key];

Check failure on line 45 in src/lib/mock-observations/index.ts

View workflow job for this annotation

GitHub Actions / build

Delete `␍`
}

Check failure on line 46 in src/lib/mock-observations/index.ts

View workflow job for this annotation

GitHub Actions / build

Delete `␍`
Expand Down

0 comments on commit eb2e874

Please sign in to comment.