diff --git a/.eslintrc.js b/.eslintrc.js index 16d720b964f..6636c8f319f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -101,6 +101,7 @@ module.exports = defineConfig({ 'error', { allowNumber: true, allowBoolean: true }, ], + '@typescript-eslint/switch-exhaustiveness-check': 'error', '@typescript-eslint/unbound-method': 'off', '@typescript-eslint/unified-signatures': 'off', // incompatible with our api docs generation diff --git a/src/modules/color/index.ts b/src/modules/color/index.ts index ee626e096ac..5962ef71b67 100644 --- a/src/modules/color/index.ts +++ b/src/modules/color/index.ts @@ -64,6 +64,8 @@ function formatHexColor( case 'lower': hexColor = hexColor.toLowerCase(); break; + case 'mixed': + // Do nothing } if (options?.prefix) { @@ -156,6 +158,7 @@ function toColorFormat( return toCSS(values, cssFunction, space); case 'binary': return toBinary(values); + case 'decimal': default: return values; } diff --git a/src/modules/string/index.ts b/src/modules/string/index.ts index 7c159a21519..923c5286f79 100644 --- a/src/modules/string/index.ts +++ b/src/modules/string/index.ts @@ -79,8 +79,6 @@ export type NumericChar = export type AlphaChar = LowerAlphaChar | UpperAlphaChar; export type AlphaNumericChar = AlphaChar | NumericChar; -const SAMPLE_MAX_LENGTH = 2 ** 20; - /** * Module to generate string related entries. * @@ -621,7 +619,7 @@ export class StringModule extends SimpleModuleBase { /** * Returns a string containing UTF-16 chars between 33 and 125 (`!` to `}`). * - * @param length Length of the generated string. Max length is `2^20`. Defaults to `10`. + * @param length Length of the generated string. Defaults to `10`. * @param length.min The minimum number of characters to generate. * @param length.max The maximum number of characters to generate. * @@ -647,9 +645,6 @@ export class StringModule extends SimpleModuleBase { } = 10 ): string { length = this.faker.helpers.rangeToNumber(length); - if (length >= SAMPLE_MAX_LENGTH) { - length = SAMPLE_MAX_LENGTH; - } const charCodeOption = { min: 33, diff --git a/test/modules/datatype.spec.ts b/test/modules/datatype.spec.ts index db676fdc333..b4d154f4e0b 100644 --- a/test/modules/datatype.spec.ts +++ b/test/modules/datatype.spec.ts @@ -330,12 +330,6 @@ describe('datatype', () => { expect(generatedString).toBe(''); expect(generatedString).toHaveLength(0); }); - - it('should return string with length of 2^20 if bigger length value is passed', () => { - const overMaxValue = Math.pow(2, 28); - const generatedString = faker.datatype.string(overMaxValue); - expect(generatedString).toHaveLength(Math.pow(2, 20)); - }); }); describe('boolean', () => { diff --git a/test/modules/string.spec.ts b/test/modules/string.spec.ts index a4f7ecef0c5..e82fa93f653 100644 --- a/test/modules/string.spec.ts +++ b/test/modules/string.spec.ts @@ -724,12 +724,6 @@ describe('string', () => { expect(generatedString).toHaveLength(0); }); - it('should return string with length of 2^20 if bigger length value is passed', () => { - const overMaxValue = 2 ** 28; - const generatedString = faker.string.sample(overMaxValue); - expect(generatedString).toHaveLength(2 ** 20); - }); - it('should return string with a specific length', () => { const length = 1337; const generatedString = faker.string.sample(length);