Skip to content

Commit

Permalink
Merge branch 'next' into infra/unicorn/filename-case
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Oct 26, 2023
2 parents 417ab3e + 9297e5b commit d0ec807
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = defineConfig({
'unicorn/no-null': 'off', // incompatible with TypeScript
'unicorn/no-zero-fractions': 'off', // deactivated to raise awareness of floating operations
'unicorn/number-literal-case': 'off', // incompatible with prettier
'unicorn/prefer-ternary': 'off', // ternaries aren't always better

// TODO @Shinigami92 2023-09-23: prefer-at should be turned on when we drop support for Node 14.
'unicorn/prefer-at': 'off',
Expand All @@ -53,13 +54,11 @@ module.exports = defineConfig({
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/no-useless-switch-case': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/prefer-array-some': 'off',
'unicorn/prefer-code-point': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-negative-index': 'off',
'unicorn/prefer-string-slice': 'off',
'unicorn/prefer-ternary': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/require-array-join-separator': 'off',
Expand Down
24 changes: 8 additions & 16 deletions src/modules/date/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,15 +1097,11 @@ export class DateModule extends SimpleDateModule {
const source = this.faker.definitions.date.month;
let type: keyof DateEntryDefinition;
if (abbreviated) {
if (context && source['abbr_context'] != null) {
type = 'abbr_context';
} else {
type = 'abbr';
}
} else if (context && source['wide_context'] != null) {
type = 'wide_context';
const useContext = context && source['abbr_context'] != null;
type = useContext ? 'abbr_context' : 'abbr';
} else {
type = 'wide';
const useContext = context && source['wide_context'] != null;
type = useContext ? 'wide_context' : 'wide';
}

return this.faker.helpers.arrayElement(source[type]);
Expand Down Expand Up @@ -1287,15 +1283,11 @@ export class DateModule extends SimpleDateModule {
const source = this.faker.definitions.date.weekday;
let type: keyof DateEntryDefinition;
if (abbreviated) {
if (context && source['abbr_context'] != null) {
type = 'abbr_context';
} else {
type = 'abbr';
}
} else if (context && source['wide_context'] != null) {
type = 'wide_context';
const useContext = context && source['abbr_context'] != null;
type = useContext ? 'abbr_context' : 'abbr';
} else {
type = 'wide';
const useContext = context && source['wide_context'] != null;
type = useContext ? 'wide_context' : 'wide';
}

return this.faker.helpers.arrayElement(source[type]);
Expand Down
11 changes: 3 additions & 8 deletions src/modules/finance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,14 +599,9 @@ export class FinanceModule {
precision: 10 ** -dec,
});

let formattedString: string;
if (autoFormat) {
formattedString = randValue.toLocaleString(undefined, {
minimumFractionDigits: dec,
});
} else {
formattedString = randValue.toFixed(dec);
}
const formattedString = autoFormat
? randValue.toLocaleString(undefined, { minimumFractionDigits: dec })
: randValue.toFixed(dec);

return symbol + formattedString;
}
Expand Down
6 changes: 1 addition & 5 deletions src/modules/internet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1475,11 +1475,7 @@ export class InternetModule {
}

if (memorable) {
if (consonant.test(prefix)) {
pattern = vowel;
} else {
pattern = consonant;
}
pattern = consonant.test(prefix) ? vowel : consonant;
}

const n = this.faker.number.int(94) + 33;
Expand Down

0 comments on commit d0ec807

Please sign in to comment.