aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-10-07 11:05:58 +0200
committerGitHub <[email protected]>2023-10-07 09:05:58 +0000
commiteb2b18b8a0e64eded3731bae4204d2925dbef3e7 (patch)
tree0ace6e551d0a75fae07e6acef448b48691589cdc /src/modules
parentc80c035333e3c832c46dc7dcac5c86a289829e0d (diff)
downloadfaker-eb2b18b8a0e64eded3731bae4204d2925dbef3e7.tar.xz
faker-eb2b18b8a0e64eded3731bae4204d2925dbef3e7.zip
infra(eslint): enable no-useless-escape eslint rule (#2434)
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/git/index.ts2
-rw-r--r--src/modules/helpers/index.ts12
-rw-r--r--src/modules/internet/index.ts2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/modules/git/index.ts b/src/modules/git/index.ts
index f19abeef..6a48efc7 100644
--- a/src/modules/git/index.ts
+++ b/src/modules/git/index.ts
@@ -97,7 +97,7 @@ export class GitModule {
const email = this.faker.internet.email({ firstName, lastName });
// Normalize user according to https://github.com/libgit2/libgit2/issues/5342
- user = user.replace(/^[\.,:;"\\']|[\<\>\n]|[\.,:;"\\']$/g, '');
+ user = user.replace(/^[.,:;"\\']|[<>\n]|[.,:;"\\']$/g, '');
lines.push(
`Author: ${user} <${email}>`,
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index 7ace1e91..3cc9e855 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -99,9 +99,9 @@ function legacyRegexpStringParse(
string: string = ''
): string {
// Deal with range repeat `{min,max}`
- const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/;
+ const RANGE_REP_REG = /(.)\{(\d+),(\d+)\}/;
const REP_REG = /(.)\{(\d+)\}/;
- const RANGE_REG = /\[(\d+)\-(\d+)\]/;
+ const RANGE_REG = /\[(\d+)-(\d+)\]/;
let min: number;
let max: number;
let tmp: number;
@@ -192,7 +192,7 @@ export class SimpleHelpersModule {
.normalize('NFKD') //for example è decomposes to as e + ̀
.replace(/[\u0300-\u036f]/g, '') // removes combining marks
.replace(/ /g, '-') // replaces spaces with hyphens
- .replace(/[^\w\.\-]+/g, ''); // removes all non-word characters except for dots and hyphens
+ .replace(/[^\w.-]+/g, ''); // removes all non-word characters except for dots and hyphens
}
/**
@@ -416,7 +416,7 @@ export class SimpleHelpersModule {
// Deal with single wildcards
const SINGLE_CHAR_REG =
- /([.A-Za-z0-9])(?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/;
+ /([.A-Za-z0-9])(?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+))(?![^[]*]|[^{]*})/;
let token = pattern.match(SINGLE_CHAR_REG);
while (token != null) {
const quantifierMin: string = token[2];
@@ -439,7 +439,7 @@ export class SimpleHelpersModule {
const SINGLE_RANGE_REG = /(\d-\d|\w-\w|\d|\w|[-!@#$&()`.+,/"])/;
const RANGE_ALPHANUMEMRIC_REG =
- /\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:\,(\d+)|)\}|(\?|\*|\+)|)/;
+ /\[(\^|)(-|)(.+?)\](?:\{(\d+)(?:,(\d+)|)\}|(\?|\*|\+)|)/;
// Deal with character classes with quantifiers `[a-z0-9]{min[, max]}`
token = pattern.match(RANGE_ALPHANUMEMRIC_REG);
while (token != null) {
@@ -548,7 +548,7 @@ export class SimpleHelpersModule {
token = pattern.match(RANGE_ALPHANUMEMRIC_REG);
}
- const RANGE_REP_REG = /(.)\{(\d+)\,(\d+)\}/;
+ const RANGE_REP_REG = /(.)\{(\d+),(\d+)\}/;
// Deal with quantifier ranges `{min,max}`
token = pattern.match(RANGE_REP_REG);
while (token != null) {
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index 842ab153..6e8f822f 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -265,7 +265,7 @@ export class InternetModule {
let localPart: string = this.userName({ firstName, lastName });
// Strip any special characters from the local part of the email address
// This could happen if invalid chars are passed in manually in the firstName/lastName
- localPart = localPart.replace(/[^A-Za-z0-9._+\-]+/g, '');
+ localPart = localPart.replace(/[^A-Za-z0-9._+-]+/g, '');
// The local part of an email address is limited to 64 chars per RFC 3696
// We limit to 50 chars to be more realistic