aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helpers.ts2
-rw-r--r--src/internet.ts9
-rw-r--r--src/locales/ar/name/last_name.ts1
-rw-r--r--src/name.ts6
-rw-r--r--src/unique.ts4
-rw-r--r--src/vendor/unique.ts2
-rw-r--r--src/vendor/user-agent.ts4
-rw-r--r--src/word.ts11
8 files changed, 16 insertions, 23 deletions
diff --git a/src/helpers.ts b/src/helpers.ts
index 5b95e25f..3082ace1 100644
--- a/src/helpers.ts
+++ b/src/helpers.ts
@@ -280,6 +280,8 @@ export class Helpers {
}
}
} finally {
+ // TODO @Shinigami92 2022-01-21: Check what to do here
+ // eslint-disable-next-line no-unsafe-finally
return Array.from(set);
}
}
diff --git a/src/internet.ts b/src/internet.ts
index 30331234..1fd25046 100644
--- a/src/internet.ts
+++ b/src/internet.ts
@@ -490,10 +490,8 @@ export class Internet {
* Copyright(c) 2011-2013 Bermi Ferrer <[email protected]>
* MIT Licensed
*/
- // TODO @Shinigami92 2022-01-11: letter is not used
- let letter = /[a-zA-Z]$/;
- let vowel = /[aeiouAEIOU]$/;
- let consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/;
+ const vowel = /[aeiouAEIOU]$/;
+ const consonant = /[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]$/;
const _password = (
length = 10,
memorable = true,
@@ -501,7 +499,6 @@ export class Internet {
prefix = ''
): string => {
let char: string;
- let n: number;
if (prefix.length >= length) {
return prefix;
}
@@ -512,7 +509,7 @@ export class Internet {
pattern = consonant;
}
}
- n = this.faker.datatype.number(94) + 33;
+ const n = this.faker.datatype.number(94) + 33;
char = String.fromCharCode(n);
if (memorable) {
char = char.toLowerCase();
diff --git a/src/locales/ar/name/last_name.ts b/src/locales/ar/name/last_name.ts
index fb37403a..77bb8719 100644
--- a/src/locales/ar/name/last_name.ts
+++ b/src/locales/ar/name/last_name.ts
@@ -28,7 +28,6 @@ export default [
'السقاط',
'ادريس',
'بن حسين',
- ,
'القلشاني',
'الحجيج',
'بن عبد الكريم',
diff --git a/src/name.ts b/src/name.ts
index e19dab2c..84f1623d 100644
--- a/src/name.ts
+++ b/src/name.ts
@@ -139,8 +139,8 @@ export class Name {
gender?: string | number
): string {
const r = this.faker.datatype.number(8);
- let prefix: string = '',
- suffix: string = '';
+ let prefix = '';
+ let suffix = '';
// in particular locales first and last names split by gender,
// thus we keep consistency by passing 0 as male and 1 as female
@@ -158,6 +158,8 @@ export class Name {
if (prefix) {
return prefix + ' ' + firstName + ' ' + lastName;
}
+ // TODO @Shinigami92 2022-01-21: Not sure if this fallthrough is wanted
+ // eslint-disable-next-line no-fallthrough
case 1:
suffix = this.faker.name.suffix();
if (suffix) {
diff --git a/src/unique.ts b/src/unique.ts
index 382d2e2d..eef662b2 100644
--- a/src/unique.ts
+++ b/src/unique.ts
@@ -2,10 +2,10 @@ import * as uniqueExec from './vendor/unique';
export class Unique {
// maximum time unique.exec will attempt to run before aborting
- maxTime: number = 10;
+ maxTime = 10;
// maximum retries unique.exec will recurse before aborting ( max loop depth )
- maxRetries: number = 10;
+ maxRetries = 10;
// time the script started
// startTime: number = 0;
diff --git a/src/vendor/unique.ts b/src/vendor/unique.ts
index 1fc80d5f..dbe82480 100644
--- a/src/vendor/unique.ts
+++ b/src/vendor/unique.ts
@@ -9,7 +9,7 @@ const found: Record<string, string> = {};
const exclude: string[] = [];
// current iteration or retries of unique.exec ( current loop depth )
-let currentIterations = 0;
+const currentIterations = 0;
// uniqueness compare function
// default behavior is to check value as key against object hash
diff --git a/src/vendor/user-agent.ts b/src/vendor/user-agent.ts
index 4aef3381..b2982b99 100644
--- a/src/vendor/user-agent.ts
+++ b/src/vendor/user-agent.ts
@@ -57,8 +57,8 @@ export function generate(faker: Faker) {
let max = 0;
let return_val: string;
- for (let key in obj) {
- if (obj.hasOwnProperty(key)) {
+ for (const key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
max = obj[key] + min;
return_val = key;
if (rand >= min && rand <= max) {
diff --git a/src/word.ts b/src/word.ts
index 5bd9cefa..a5ee8241 100644
--- a/src/word.ts
+++ b/src/word.ts
@@ -19,10 +19,9 @@ export class Word {
*/
adjective(length?: number): string {
let wordList = this.faker.definitions.word.adjective;
-
if (length) {
wordList = this.faker.definitions.word.adjective.filter(
- (word: string) => word.length == length
+ (word) => word.length == length
);
}
@@ -41,8 +40,7 @@ export class Word {
* @param optional length of word to return
*/
adverb(length?: number): string {
- var wordList = this.faker.definitions.word.adverb;
-
+ let wordList = this.faker.definitions.word.adverb;
if (length) {
wordList = this.faker.definitions.word.adverb.filter(
(word: string) => word.length == length
@@ -65,7 +63,6 @@ export class Word {
*/
conjunction(length?: number): string {
let wordList = this.faker.definitions.word.conjunction;
-
if (length) {
wordList = this.faker.definitions.word.conjunction.filter(
(word: string) => word.length == length
@@ -88,7 +85,6 @@ export class Word {
*/
interjection(length?: number): string {
let wordList = this.faker.definitions.word.interjection;
-
if (length) {
wordList = this.faker.definitions.word.interjection.filter(
(word: string) => word.length == length
@@ -111,7 +107,6 @@ export class Word {
*/
noun(length?: number): string {
let wordList = this.faker.definitions.word.noun;
-
if (length) {
wordList = this.faker.definitions.word.noun.filter(
(word: string) => word.length == length
@@ -134,7 +129,6 @@ export class Word {
*/
preposition(length?: number): string {
let wordList = this.faker.definitions.word.preposition;
-
if (length) {
wordList = this.faker.definitions.word.preposition.filter(
(word: string) => word.length == length
@@ -157,7 +151,6 @@ export class Word {
*/
verb(length?: number): string {
let wordList = this.faker.definitions.word.verb;
-
if (length) {
wordList = this.faker.definitions.word.verb.filter(
(word: string) => word.length == length