aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-10-09 20:22:43 +0200
committerGitHub <[email protected]>2023-10-09 18:22:43 +0000
commit350dfbf2c57f023a78567da60bf4792ebd1a41f7 (patch)
tree876c2172b3a483e00ec888d8c981978a365cea9d
parent72bf57d9dfe6569f595e64441e02feb8d5d3165f (diff)
downloadfaker-350dfbf2c57f023a78567da60bf4792ebd1a41f7.tar.xz
faker-350dfbf2c57f023a78567da60bf4792ebd1a41f7.zip
infra(unicorn): no-array-push-push (#2454)
-rw-r--r--.eslintrc.js1
-rw-r--r--scripts/generateLocales.ts14
-rw-r--r--src/modules/helpers/index.ts12
3 files changed, 15 insertions, 12 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index afd06f44..5625ba35 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -57,7 +57,6 @@ module.exports = defineConfig({
'unicorn/import-style': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-for-each': 'off',
- 'unicorn/no-array-push-push': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-for-loop': 'off',
diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts
index fcf2fa26..67d0f779 100644
--- a/scripts/generateLocales.ts
+++ b/scripts/generateLocales.ts
@@ -183,14 +183,14 @@ async function generateLocalesIndexFile(
content.push(
...modules.map(
(module) => `import ${escapeImport(name, module)} from './${module}';`
- )
- );
-
- content.push(`\nconst ${name}${fieldType} = {
+ ),
+ '',
+ `const ${name}${fieldType} = {
${modules.map((module) => `${escapeField(name, module)},`).join('\n')}
- };\n`);
-
- content.push(`export default ${name};`);
+ };`,
+ '',
+ `export default ${name};`
+ );
writeFileSync(
resolve(path, 'index.ts'),
diff --git a/src/modules/helpers/index.ts b/src/modules/helpers/index.ts
index 3cc9e855..59a4041a 100644
--- a/src/modules/helpers/index.ts
+++ b/src/modules/helpers/index.ts
@@ -463,8 +463,10 @@ export class SimpleHelpersModule {
if (range[0].indexOf('-') === -1) {
// handle non-ranges
if (isCaseInsensitive && isNaN(Number(range[0]))) {
- rangeCodes.push(range[0].toUpperCase().charCodeAt(0));
- rangeCodes.push(range[0].toLowerCase().charCodeAt(0));
+ rangeCodes.push(
+ range[0].toUpperCase().charCodeAt(0),
+ range[0].toLowerCase().charCodeAt(0)
+ );
} else {
rangeCodes.push(range[0].charCodeAt(0));
}
@@ -481,8 +483,10 @@ export class SimpleHelpersModule {
for (let i = min; i <= max; i++) {
if (isCaseInsensitive && isNaN(Number(String.fromCharCode(i)))) {
const ch = String.fromCharCode(i);
- rangeCodes.push(ch.toUpperCase().charCodeAt(0));
- rangeCodes.push(ch.toLowerCase().charCodeAt(0));
+ rangeCodes.push(
+ ch.toUpperCase().charCodeAt(0),
+ ch.toLowerCase().charCodeAt(0)
+ );
} else {
rangeCodes.push(i);
}