From 5e1c222550f03779634385d1f0ea6f417f5b9f8d Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 17 Dec 2023 15:55:11 +0200 Subject: [PATCH] chore: Autofix --- src/__mocks__/path.ts | 2 +- src/generators/asset-types/__tests__/eot.ts | 2 +- src/generators/asset-types/__tests__/json.ts | 2 +- src/generators/asset-types/__tests__/svg.ts | 4 ++-- src/generators/asset-types/__tests__/ts.ts | 2 +- src/generators/asset-types/__tests__/ttf.ts | 2 +- src/generators/asset-types/__tests__/woff.ts | 2 +- src/generators/asset-types/__tests__/woff2.ts | 2 +- src/utils/icon-id.ts | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/__mocks__/path.ts b/src/__mocks__/path.ts index 60941c07..7bc947c8 100644 --- a/src/__mocks__/path.ts +++ b/src/__mocks__/path.ts @@ -47,7 +47,7 @@ const join = (...segments: string[]): string => { return trimmed.join('/'); }; -const normalize = (path: string) => path.replace(/\\/g, '/'); +const normalize = (path: string) => path.replaceAll('\\', '/'); const isAbsolute = (path: string) => path.startsWith('/root'); diff --git a/src/generators/asset-types/__tests__/eot.ts b/src/generators/asset-types/__tests__/eot.ts index d6f02e49..cbd3b0bc 100644 --- a/src/generators/asset-types/__tests__/eot.ts +++ b/src/generators/asset-types/__tests__/eot.ts @@ -10,7 +10,7 @@ jest.mock('ttf2eot', () => ); const mockOptions = (eotOptions = { __mock: 'options__' } as any) => - ({} as unknown as FontGeneratorOptions); + ({}) as unknown as FontGeneratorOptions; const ttf = '::ttf::' as unknown as Buffer; diff --git a/src/generators/asset-types/__tests__/json.ts b/src/generators/asset-types/__tests__/json.ts index dd1f47a7..ed8cb5b1 100644 --- a/src/generators/asset-types/__tests__/json.ts +++ b/src/generators/asset-types/__tests__/json.ts @@ -8,7 +8,7 @@ const mockOptions = (jsonOptions: any = {}) => ({ codepoints: mockCodepoints, formatOptions: { [OtherAssetType.JSON]: jsonOptions } - } as any); + }) as any; const renderAndParse = async (jsonOptions?: any) => JSON.parse( diff --git a/src/generators/asset-types/__tests__/svg.ts b/src/generators/asset-types/__tests__/svg.ts index 3200dcfb..e053710f 100644 --- a/src/generators/asset-types/__tests__/svg.ts +++ b/src/generators/asset-types/__tests__/svg.ts @@ -17,7 +17,7 @@ jest.mock('fs', () => ({ jest.mock('svgicons2svgfont', () => { class MockStream { - public events = new EventEmitter(); + public events = new EventEmitter(); // eslint-disable-line unicorn/prefer-event-target public content = ''; public write(chunk: any) { @@ -56,7 +56,7 @@ const mockOptions = (svgOptions = { __mock: 'options__' } as any) => foo: { id: 'foo', absolutePath: '/root/foo.svg' }, bar: { id: 'bar', absolutePath: '/root/bar.svg' } } - } as unknown as FontGeneratorOptions); + }) as unknown as FontGeneratorOptions; describe('`SVG` font generator', () => { beforeEach(() => { diff --git a/src/generators/asset-types/__tests__/ts.ts b/src/generators/asset-types/__tests__/ts.ts index 87133bd3..efe0ce34 100644 --- a/src/generators/asset-types/__tests__/ts.ts +++ b/src/generators/asset-types/__tests__/ts.ts @@ -25,7 +25,7 @@ const mockOptions = { } as any; const cleanWhiteSpace = (subject: string): string => - subject.replace(/\n+/, '').replace(/\s+/g, ' '); + subject.replace(/\n+/, '').replaceAll(/\s+/g, ' '); const getCleanGen = async (options = {}) => cleanWhiteSpace( diff --git a/src/generators/asset-types/__tests__/ttf.ts b/src/generators/asset-types/__tests__/ttf.ts index e715ab51..be3a8729 100644 --- a/src/generators/asset-types/__tests__/ttf.ts +++ b/src/generators/asset-types/__tests__/ttf.ts @@ -13,7 +13,7 @@ jest.mock('svg2ttf', () => const mockOptions = (ttfOptions = { __mock: 'options__' } as any) => ({ formatOptions: { [FontAssetType.TTF]: ttfOptions } - } as unknown as FontGeneratorOptions); + }) as unknown as FontGeneratorOptions; const svg = '::svg::'; diff --git a/src/generators/asset-types/__tests__/woff.ts b/src/generators/asset-types/__tests__/woff.ts index dbbe1721..0e3364f7 100644 --- a/src/generators/asset-types/__tests__/woff.ts +++ b/src/generators/asset-types/__tests__/woff.ts @@ -13,7 +13,7 @@ jest.mock('ttf2woff', () => const mockOptions = (woffOptions = { __mock: 'options__' } as any) => ({ formatOptions: { [FontAssetType.WOFF]: woffOptions } - } as unknown as FontGeneratorOptions); + }) as unknown as FontGeneratorOptions; const ttf = '::ttf::' as unknown as Buffer; diff --git a/src/generators/asset-types/__tests__/woff2.ts b/src/generators/asset-types/__tests__/woff2.ts index dd608872..b6130fc0 100644 --- a/src/generators/asset-types/__tests__/woff2.ts +++ b/src/generators/asset-types/__tests__/woff2.ts @@ -10,7 +10,7 @@ jest.mock('ttf2woff2', () => ); const mockOptions = (woffOptions = { __mock: 'options__' } as any) => - ({} as unknown as FontGeneratorOptions); + ({}) as unknown as FontGeneratorOptions; const ttf = '::ttf::' as unknown as Buffer; diff --git a/src/utils/icon-id.ts b/src/utils/icon-id.ts index f4c246f2..3c01dc42 100644 --- a/src/utils/icon-id.ts +++ b/src/utils/icon-id.ts @@ -3,7 +3,7 @@ import { GetIconIdFn } from '../types/misc'; import { removeExtension } from './path'; export const getIconId: GetIconIdFn = ({ relativeFilePath }) => - slug(removeExtension(relativeFilePath).replace(/([./\\])+/g, '-'), { + slug(removeExtension(relativeFilePath).replaceAll(/([./\\])+/g, '-'), { replacement: '-', remove: /['"`]/g });