Skip to content

chore: fix JSDoc comments in vehicle.ts#274

Merged
Shinigami92 merged 6 commits intofaker-js:mainfrom
pkuczynski:jsdoc-vehicle
Jan 25, 2022
Merged

chore: fix JSDoc comments in vehicle.ts#274
Shinigami92 merged 6 commits intofaker-js:mainfrom
pkuczynski:jsdoc-vehicle

Conversation

@pkuczynski
Copy link
Member

@pkuczynski pkuczynski commented Jan 23, 2022

Refs #203

@pkuczynski pkuczynski requested a review from a team as a code owner January 23, 2022 21:14
@ejcheng ejcheng added the c: chore PR that doesn't affect the runtime behavior label Jan 23, 2022
@ejcheng ejcheng added this to the v6.0.0 - Project stability milestone Jan 23, 2022
@Shinigami92
Copy link
Member

Suggested edit:

diff --git a/src/vehicle.ts b/src/vehicle.ts
--- src/vehicle.ts
+++ src/vehicle.ts
@@ -13,112 +13,61 @@
         continue;
       }
       this[name] = this[name].bind(this);
     }
-
-    // TODO @Shinigami92 2022-01-13: Find better strategy
-    // @ts-expect-error
-    this.vehicle.schema = {
-      description: 'Generates a random vehicle.',
-      sampleResults: ['BMW Explorer', 'Ford Camry', 'Lamborghini Ranchero'],
-    };
-    // @ts-expect-error
-    this.manufacturer.schema = {
-      description: 'Generates a manufacturer name.',
-      sampleResults: ['Ford', 'Jeep', 'Tesla'],
-    };
-    // @ts-expect-error
-    this.model.schema = {
-      description: 'Generates a vehicle model.',
-      sampleResults: ['Explorer', 'Camry', 'Ranchero'],
-    };
-    // @ts-expect-error
-    this.type.schema = {
-      description: 'Generates a vehicle type.',
-      sampleResults: ['Coupe', 'Convertable', 'Sedan', 'SUV'],
-    };
-    // @ts-expect-error
-    this.fuel.schema = {
-      description: 'Generates a fuel type.',
-      sampleResults: ['Electric', 'Gasoline', 'Diesel'],
-    };
-    // @ts-expect-error
-    this.vin.schema = {
-      description: 'Generates a valid VIN number.',
-      sampleResults: ['YV1MH682762184654', '3C7WRMBJ2EG208836'],
-    };
-    // @ts-expect-error
-    this.color.schema = {
-      description: 'Generates a color',
-      sampleResults: ['red', 'white', 'black'],
-    };
-    // @ts-expect-error
-    this.vrm.schema = {
-      description: 'Generates a vehicle vrm',
-      sampleResults: ['MF56UPA', 'GL19AAQ', 'SF20TTA'],
-    };
-    // @ts-expect-error
-    this.bicycle.schema = {
-      description: 'Generates a type of bicycle',
-      sampleResults: [
-        'Adventure Road Bicycle',
-        'City Bicycle',
-        'Recumbent Bicycle',
-      ],
-    };
   }
 
   /**
-   * vehicle
+   * Returns a random vehicle.
    *
-   * @method faker.vehicle.vehicle
+   * @example 'BMW Explorer', 'Ford Camry', 'Lamborghini Ranchero'
    */
   vehicle(): string {
     return fake('{{vehicle.manufacturer}} {{vehicle.model}}');
   }
 
   /**
-   * manufacturer
+   * Returns a manufacturer name.
    *
-   * @method faker.vehicle.manufacturer
+   * @example 'Ford', 'Jeep', 'Tesla'
    */
   manufacturer(): string {
     return this.faker.random.arrayElement(
       this.faker.definitions.vehicle.manufacturer
     );
   }
 
   /**
-   * model
+   * Returns a vehicle model.
    *
-   * @method faker.vehicle.model
+   * @example 'Explorer', 'Camry', 'Ranchero'
    */
   model(): string {
     return this.faker.random.arrayElement(this.faker.definitions.vehicle.model);
   }
 
   /**
-   * type
+   * Returns a vehicle type.
    *
-   * @method faker.vehicle.type
+   * @example 'Coupe', 'Convertable', 'Sedan', 'SUV'
    */
   type(): string {
     return this.faker.random.arrayElement(this.faker.definitions.vehicle.type);
   }
 
   /**
-   * fuel
+   * Returns a fuel type.
    *
-   * @method faker.vehicle.fuel
+   * @example 'Electric', 'Gasoline', 'Diesel'
    */
   fuel(): string {
     return this.faker.random.arrayElement(this.faker.definitions.vehicle.fuel);
   }
 
   /**
-   * vin
+   * Returns a valid VIN number.
    *
-   * @method faker.vehicle.vin
+   * @example 'YV1MH682762184654', '3C7WRMBJ2EG208836'
    */
   vin(): string {
     const bannedChars = ['o', 'i', 'q'];
     return (
@@ -134,20 +83,20 @@
       .toUpperCase();
   }
 
   /**
-   * color
+   * Returns a vehicle color.
    *
-   * @method faker.vehicle.color
+   * @example 'red', 'white', 'black'
    */
   color(): string {
     return fake('{{commerce.color}}');
   }
 
   /**
-   * vrm
+   * Returns a vehicle vrm.
    *
-   * @method faker.vehicle.vrm
+   * @example 'MF56UPA', 'GL19AAQ', 'SF20TTA'
    */
   vrm(): string {
     return (
       this.faker.random.alpha({ count: 2, upcase: true }) +
@@ -157,11 +106,11 @@
     ).toUpperCase();
   }
 
   /**
-   * bicycle
+   * Returns a type of bicycle.
    *
-   * @method faker.vehicle.bicycle
+   * @example 'Adventure Road Bicycle', 'City Bicycle', 'Recumbent Bicycle'
    */
   bicycle(): string {
     return this.faker.random.arrayElement(
       this.faker.definitions.vehicle.bicycle_type

1 similar comment
@Shinigami92
Copy link
Member

Suggested edit:

diff --git a/src/vehicle.ts b/src/vehicle.ts
--- src/vehicle.ts
+++ src/vehicle.ts
@@ -13,112 +13,61 @@
         continue;
       }
       this[name] = this[name].bind(this);
     }
-
-    // TODO @Shinigami92 2022-01-13: Find better strategy
-    // @ts-expect-error
-    this.vehicle.schema = {
-      description: 'Generates a random vehicle.',
-      sampleResults: ['BMW Explorer', 'Ford Camry', 'Lamborghini Ranchero'],
-    };
-    // @ts-expect-error
-    this.manufacturer.schema = {
-      description: 'Generates a manufacturer name.',
-      sampleResults: ['Ford', 'Jeep', 'Tesla'],
-    };
-    // @ts-expect-error
-    this.model.schema = {
-      description: 'Generates a vehicle model.',
-      sampleResults: ['Explorer', 'Camry', 'Ranchero'],
-    };
-    // @ts-expect-error
-    this.type.schema = {
-      description: 'Generates a vehicle type.',
-      sampleResults: ['Coupe', 'Convertable', 'Sedan', 'SUV'],
-    };
-    // @ts-expect-error
-    this.fuel.schema = {
-      description: 'Generates a fuel type.',
-      sampleResults: ['Electric', 'Gasoline', 'Diesel'],
-    };
-    // @ts-expect-error
-    this.vin.schema = {
-      description: 'Generates a valid VIN number.',
-      sampleResults: ['YV1MH682762184654', '3C7WRMBJ2EG208836'],
-    };
-    // @ts-expect-error
-    this.color.schema = {
-      description: 'Generates a color',
-      sampleResults: ['red', 'white', 'black'],
-    };
-    // @ts-expect-error
-    this.vrm.schema = {
-      description: 'Generates a vehicle vrm',
-      sampleResults: ['MF56UPA', 'GL19AAQ', 'SF20TTA'],
-    };
-    // @ts-expect-error
-    this.bicycle.schema = {
-      description: 'Generates a type of bicycle',
-      sampleResults: [
-        'Adventure Road Bicycle',
-        'City Bicycle',
-        'Recumbent Bicycle',
-      ],
-    };
   }
 
   /**
-   * vehicle
+   * Returns a random vehicle.
    *
-   * @method faker.vehicle.vehicle
+   * @example 'BMW Explorer', 'Ford Camry', 'Lamborghini Ranchero'
    */
   vehicle(): string {
     return fake('{{vehicle.manufacturer}} {{vehicle.model}}');
   }
 
   /**
-   * manufacturer
+   * Returns a manufacturer name.
    *
-   * @method faker.vehicle.manufacturer
+   * @example 'Ford', 'Jeep', 'Tesla'
    */
   manufacturer(): string {
     return this.faker.random.arrayElement(
       this.faker.definitions.vehicle.manufacturer
     );
   }
 
   /**
-   * model
+   * Returns a vehicle model.
    *
-   * @method faker.vehicle.model
+   * @example 'Explorer', 'Camry', 'Ranchero'
    */
   model(): string {
     return this.faker.random.arrayElement(this.faker.definitions.vehicle.model);
   }
 
   /**
-   * type
+   * Returns a vehicle type.
    *
-   * @method faker.vehicle.type
+   * @example 'Coupe', 'Convertable', 'Sedan', 'SUV'
    */
   type(): string {
     return this.faker.random.arrayElement(this.faker.definitions.vehicle.type);
   }
 
   /**
-   * fuel
+   * Returns a fuel type.
    *
-   * @method faker.vehicle.fuel
+   * @example 'Electric', 'Gasoline', 'Diesel'
    */
   fuel(): string {
     return this.faker.random.arrayElement(this.faker.definitions.vehicle.fuel);
   }
 
   /**
-   * vin
+   * Returns a valid VIN number.
    *
-   * @method faker.vehicle.vin
+   * @example 'YV1MH682762184654', '3C7WRMBJ2EG208836'
    */
   vin(): string {
     const bannedChars = ['o', 'i', 'q'];
     return (
@@ -134,20 +83,20 @@
       .toUpperCase();
   }
 
   /**
-   * color
+   * Returns a vehicle color.
    *
-   * @method faker.vehicle.color
+   * @example 'red', 'white', 'black'
    */
   color(): string {
     return fake('{{commerce.color}}');
   }
 
   /**
-   * vrm
+   * Returns a vehicle vrm.
    *
-   * @method faker.vehicle.vrm
+   * @example 'MF56UPA', 'GL19AAQ', 'SF20TTA'
    */
   vrm(): string {
     return (
       this.faker.random.alpha({ count: 2, upcase: true }) +
@@ -157,11 +106,11 @@
     ).toUpperCase();
   }
 
   /**
-   * bicycle
+   * Returns a type of bicycle.
    *
-   * @method faker.vehicle.bicycle
+   * @example 'Adventure Road Bicycle', 'City Bicycle', 'Recumbent Bicycle'
    */
   bicycle(): string {
     return this.faker.random.arrayElement(
       this.faker.definitions.vehicle.bicycle_type

Shinigami92
Shinigami92 previously approved these changes Jan 24, 2022
@pkuczynski pkuczynski added the c: docs Improvements or additions to documentation label Jan 24, 2022
Shinigami92
Shinigami92 previously approved these changes Jan 25, 2022
Copy link
Member

@ST-DDT ST-DDT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just some minor nit picking for non native Americans.

@Shinigami92 Shinigami92 merged commit 97db2b2 into faker-js:main Jan 25, 2022
@pkuczynski pkuczynski deleted the jsdoc-vehicle branch January 27, 2022 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: chore PR that doesn't affect the runtime behavior c: docs Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants