Skip to content

Commit 80d7d4e

Browse files
committed
chore: blank line before block-like
1 parent 2d93e6f commit 80d7d4e

36 files changed

+121
-0
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module.exports = defineConfig({
5555
'@typescript-eslint/padding-line-between-statements': [
5656
'error',
5757
{ blankLine: 'always', prev: 'block-like', next: '*' },
58+
{ blankLine: 'always', prev: '*', next: 'block-like' },
5859
],
5960
'@typescript-eslint/restrict-template-expressions': [
6061
'error',

scripts/apidoc/apiDocsWriter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export function writeApiSearchIndex(project: ProjectReflection): void {
141141
link: moduleName.toLowerCase(),
142142
headers: [],
143143
};
144+
144145
if (module.kind !== ReflectionKind.Property) {
145146
apiSection.headers = module
146147
.getChildrenByKind(ReflectionKind.Method)

scripts/apidoc/moduleMethods.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function processModuleMethods(project: ProjectReflection): PageIndex {
3939

4040
export function extractModuleName(module: DeclarationReflection): string {
4141
const { name } = module;
42+
4243
// TODO @ST-DDT 2022-10-16: Remove in v10.
4344
// Typedoc prefers the name of the module that is exported first.
4445
if (name === 'AddressModule') {

scripts/apidoc/parameterDefaults.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const parameterDefaultReader: EventCallback = (
3131
symbol.declarations?.length
3232
) {
3333
const lastDeclaration = symbol.declarations[symbol.declarations.length - 1];
34+
3435
if (TypeScript.isFunctionLike(lastDeclaration)) {
3536
(reflection as ParameterDefaultsAware).implementationDefaultParameters =
3637
lastDeclaration.parameters.map((param) =>
@@ -90,6 +91,7 @@ export function patchProjectParameterDefaults(
9091
const functionOrMethods = project.getReflectionsByKind(
9192
reflectionKindFunctionOrMethod
9293
) as DeclarationReflection[];
94+
9395
for (const functionOrMethod of functionOrMethods) {
9496
patchMethodParameterDefaults(functionOrMethod);
9597
}
@@ -105,6 +107,7 @@ function patchMethodParameterDefaults(method: DeclarationReflection): void {
105107
const signature = signatures?.[signatures.length - 1];
106108
const parameterDefaults = (method as unknown as ParameterDefaultsAware)
107109
.implementationDefaultParameters;
110+
108111
if (signature && parameterDefaults) {
109112
patchSignatureParameterDefaults(signature, parameterDefaults);
110113
}
@@ -122,6 +125,7 @@ function patchSignatureParameterDefaults(
122125
): void {
123126
const signatureParameters =
124127
signature.parameters ?? Array.from({ length: parameterDefaults.length });
128+
125129
if (signatureParameters.length !== parameterDefaults.length) {
126130
throw new Error('Unexpected parameter length mismatch');
127131
}

scripts/apidoc/signature.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ function mdToHtml(md: string, inline: boolean = false): string {
9191
const rawHtml = inline ? markdown.renderInline(md) : markdown.render(md);
9292

9393
const safeHtml: string = sanitizeHtml(rawHtml, htmlSanitizeOptions);
94+
9495
// Revert some escaped characters for comparison.
9596
if (comparableSanitizedHtml(rawHtml) === comparableSanitizedHtml(safeHtml)) {
9697
return safeHtml;
@@ -113,6 +114,7 @@ export function analyzeSignature(
113114
// Collect Type Parameters
114115
const typeParameters = signature.typeParameters || [];
115116
const signatureTypeParameters: string[] = [];
117+
116118
for (const parameter of typeParameters) {
117119
signatureTypeParameters.push(parameter.name);
118120
parameters.push({
@@ -124,6 +126,7 @@ export function analyzeSignature(
124126

125127
// Collect Parameters
126128
const signatureParameters: string[] = [];
129+
127130
for (
128131
let index = 0;
129132
signature.parameters && index < signature.parameters.length;
@@ -139,23 +142,27 @@ export function analyzeSignature(
139142
// Generate usage section
140143

141144
let signatureTypeParametersString = '';
145+
142146
if (signatureTypeParameters.length !== 0) {
143147
signatureTypeParametersString = `<${signatureTypeParameters.join(', ')}>`;
144148
}
145149

146150
const signatureParametersString = signatureParameters.join(', ');
147151

148152
let examples: string;
153+
149154
if (moduleName) {
150155
examples = `faker.${moduleName}.${methodName}${signatureTypeParametersString}(${signatureParametersString}): ${signature.type?.toString()}\n`;
151156
} else {
152157
examples = `faker.${methodName}${signatureTypeParametersString}(${signatureParametersString}): ${signature.type?.toString()}\n`;
153158
}
154159

155160
faker.seed(0);
161+
156162
if (moduleName) {
157163
try {
158164
let example = JSON.stringify(faker[moduleName][methodName]());
165+
159166
if (example.length > 50) {
160167
example = `${example.substring(0, 47)}...`;
161168
}
@@ -168,6 +175,7 @@ export function analyzeSignature(
168175
}
169176

170177
const exampleTags = extractRawExamples(signature);
178+
171179
if (exampleTags.length > 0) {
172180
examples += `${exampleTags.join('\n').trim()}\n`;
173181
}
@@ -203,6 +211,7 @@ function analyzeParameter(parameter: ParameterReflection): {
203211
const defaultValue = parameter.defaultValue ?? commentDefault;
204212

205213
let signatureText = '';
214+
206215
if (defaultValue) {
207216
signatureText = ` = ${defaultValue}`;
208217
}
@@ -266,6 +275,7 @@ function typeToText(type_?: Type, short = false): string {
266275
}
267276

268277
const type = type_ as SomeType;
278+
269279
switch (type.type) {
270280
case 'array':
271281
return `${typeToText(type.elementType, short)}[]`;
@@ -274,6 +284,7 @@ function typeToText(type_?: Type, short = false): string {
274284
.map((t) => typeToText(t, short))
275285
.sort()
276286
.join(' | ');
287+
277288
case 'reference':
278289
if (!type.typeArguments || !type.typeArguments.length) {
279290
return type.name;
@@ -359,11 +370,13 @@ function extractDefaultFromComment(comment?: Comment): string | undefined {
359370

360371
const summary = comment.summary;
361372
const text = joinTagParts(summary).trim();
373+
362374
if (!text) {
363375
return;
364376
}
365377

366378
const result = /^(.*)[ \n]Defaults to `([^`]+)`\.(.*)$/s.exec(text);
379+
367380
if (!result) {
368381
return;
369382
}

scripts/apidoc/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function extractSeeAlsos(signature?: SignatureReflection): string[] {
119119
.split('\n')
120120
.map((link) => {
121121
link = link.trim();
122+
122123
if (link.startsWith('-')) {
123124
link = link.slice(1).trim();
124125
}

scripts/bundle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ if (existsSync(localeDir)) {
1414
}
1515

1616
mkdirSync(localeDir);
17+
1718
for (const locale of Object.keys(locales)) {
1819
writeFileSync(
1920
`${localeDir}/${locale}.js`,

scripts/generateLocales.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const autoGeneratedCommentHeader = `/*
7979

8080
function removeIndexTs(files: string[]): string[] {
8181
const index = files.indexOf('index.ts');
82+
8283
if (index !== -1) {
8384
files.splice(index, 1);
8485
}
@@ -130,6 +131,7 @@ function generateLocaleFile(locale: string): void {
130131

131132
function tryLoadLocalesMainIndexFile(pathModules: string): LocaleDefinition {
132133
let localeDef: LocaleDefinition;
134+
133135
// This call might fail, if the module setup is broken.
134136
// Unfortunately, we try to fix it with this script
135137
// Thats why have a fallback logic here, we only need the title and separator anyway
@@ -171,6 +173,7 @@ function generateLocalesIndexFile(
171173

172174
const content = [autoGeneratedCommentHeader];
173175
let fieldType = '';
176+
174177
if (type !== 'any') {
175178
fieldType = `: ${type}`;
176179
content.push(
@@ -208,9 +211,11 @@ function generateRecursiveModuleIndexes(
208211

209212
let submodules = readdirSync(path);
210213
submodules = removeIndexTs(submodules);
214+
211215
for (const submodule of submodules) {
212216
const pathModule = resolve(path, submodule);
213217
updateLocaleFile(pathModule);
218+
214219
// Only process sub folders recursively
215220
if (lstatSync(pathModule).isDirectory()) {
216221
let moduleDefinition =

src/faker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export class Faker {
211211
}
212212

213213
let result = target[module];
214+
214215
if (result) {
215216
return result;
216217
} else if (metadataKeys.includes(module)) {

src/internal/mersenne/twister.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export default class MersenneTwister19937 {
124124
*/
125125
private multiplication32(n1: number, n2: number): number {
126126
let sum = 0;
127+
127128
for (let i = 0; i < 32; ++i) {
128129
if ((n1 >>> i) & 0x1) {
129130
sum = this.addition32(sum, this.unsigned32(n2 << i));
@@ -140,6 +141,7 @@ export default class MersenneTwister19937 {
140141
*/
141142
initGenrand(seed: number): void {
142143
this.mt[0] = this.unsigned32(seed & 0xffffffff);
144+
143145
for (this.mti = 1; this.mti < this.N; this.mti++) {
144146
this.mt[this.mti] =
145147
//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);
@@ -172,6 +174,7 @@ export default class MersenneTwister19937 {
172174
let i = 1;
173175
let j = 0;
174176
let k = this.N > keyLength ? this.N : keyLength;
177+
175178
for (; k; k--) {
176179
// mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525)) + init_key[j] + j;
177180
this.mt[i] = this.addition32(
@@ -191,6 +194,7 @@ export default class MersenneTwister19937 {
191194
this.mt[i] = this.unsigned32(this.mt[i] & 0xffffffff);
192195
i++;
193196
j++;
197+
194198
if (i >= this.N) {
195199
this.mt[0] = this.mt[this.N - 1];
196200
i = 1;
@@ -216,6 +220,7 @@ export default class MersenneTwister19937 {
216220
// mt[i] &= 0xffffffff; for WORDSIZE > 32 machines
217221
this.mt[i] = this.unsigned32(this.mt[i] & 0xffffffff);
218222
i++;
223+
219224
if (i >= this.N) {
220225
this.mt[0] = this.mt[this.N - 1];
221226
i = 1;

src/modules/color/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function formatHexColor(
7474
function toBinary(values: number[]): string {
7575
const binary: string[] = values.map((value) => {
7676
const isFloat = value % 1 !== 0;
77+
7778
if (isFloat) {
7879
const buffer = new ArrayBuffer(4);
7980
new DataView(buffer).setFloat32(0, value);
@@ -99,6 +100,7 @@ function toCSS(
99100
space: CSSSpace = 'sRGB'
100101
): string {
101102
const percentage = (value: number) => Math.round(value * 100);
103+
102104
switch (cssFunction) {
103105
case 'rgba':
104106
return `rgba(${values[0]}, ${values[1]}, ${values[2]}, ${values[3]})`;
@@ -316,6 +318,7 @@ export class ColorModule {
316318
options = { format, includeAlpha, prefix, casing };
317319
let color: string | number[];
318320
let cssFunction: CSSFunction = 'rgb';
321+
319322
if (format === 'hex') {
320323
color = this.faker.string.hexadecimal({
321324
length: includeAlpha ? 8 : 6,
@@ -326,6 +329,7 @@ export class ColorModule {
326329
}
327330

328331
color = Array.from({ length: 3 }, () => this.faker.number.int(255));
332+
329333
if (includeAlpha) {
330334
color.push(this.faker.number.float());
331335
cssFunction = 'rgba';
@@ -463,6 +467,7 @@ export class ColorModule {
463467
includeAlpha?: boolean;
464468
}): string | number[] {
465469
const hsl: number[] = [this.faker.number.int(360)];
470+
466471
for (let i = 0; i < (options?.includeAlpha ? 3 : 2); i++) {
467472
hsl.push(this.faker.number.float());
468473
}
@@ -541,6 +546,7 @@ export class ColorModule {
541546
*/
542547
hwb(options?: { format?: ColorFormat }): string | number[] {
543548
const hsl: number[] = [this.faker.number.int(360)];
549+
544550
for (let i = 0; i < 2; i++) {
545551
hsl.push(this.faker.number.float());
546552
}
@@ -601,6 +607,7 @@ export class ColorModule {
601607
lab(options?: { format?: ColorFormat }): string | number[];
602608
lab(options?: { format?: ColorFormat }): string | number[] {
603609
const lab = [this.faker.number.float({ precision: 0.000001 })];
610+
604611
for (let i = 0; i < 2; i++) {
605612
lab.push(
606613
this.faker.number.float({ min: -100, max: 100, precision: 0.0001 })
@@ -675,6 +682,7 @@ export class ColorModule {
675682
lch(options?: { format?: ColorFormat }): string | number[];
676683
lch(options?: { format?: ColorFormat }): string | number[] {
677684
const lch = [this.faker.number.float({ precision: 0.000001 })];
685+
678686
for (let i = 0; i < 2; i++) {
679687
lch.push(this.faker.number.float({ max: 230, precision: 0.1 }));
680688
}

src/modules/datatype/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ export class DatatypeModule {
214214
}
215215

216216
const { probability = 0.5 } = options;
217+
217218
if (probability <= 0) {
218219
return false;
219220
}

src/modules/date/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { deprecated } from '../../internal/deprecated';
1111
*/
1212
function toDate(date?: string | Date | number): Date {
1313
date = new Date(date);
14+
1415
if (isNaN(date.valueOf())) {
1516
date = new Date();
1617
}
@@ -643,6 +644,7 @@ export class DateModule {
643644

644645
const source = this.faker.definitions.date.month;
645646
let type: keyof DateEntryDefinition;
647+
646648
if (abbr) {
647649
if (context && source['abbr_context'] != null) {
648650
type = 'abbr_context';
@@ -678,6 +680,7 @@ export class DateModule {
678680

679681
const source = this.faker.definitions.date.weekday;
680682
let type: keyof DateEntryDefinition;
683+
681684
if (abbr) {
682685
if (context && source['abbr_context'] != null) {
683686
type = 'abbr_context';
@@ -733,6 +736,7 @@ export class DateModule {
733736
// Convert to epoch timestamps
734737
let min: number;
735738
let max: number;
739+
736740
if (mode === 'age') {
737741
min = new Date(refDate).setUTCFullYear(refYear - (options.max ?? 80) - 1);
738742
max = new Date(refDate).setUTCFullYear(refYear - (options.min ?? 18));

src/modules/finance/iban.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,7 @@ const iban: Iban = {
13981398
],
13991399
mod97: (digitStr) => {
14001400
let m = 0;
1401+
14011402
for (let i = 0; i < digitStr.length; i++) {
14021403
m = (m * 10 + +digitStr[i]) % 97;
14031404
}

0 commit comments

Comments
 (0)