diff --git a/src/__mocks__/path.ts b/src/__mocks__/path.ts index 60941c0..7bc947c 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 d6f02e4..cbd3b0b 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 dd1f47a..ed8cb5b 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 3200dcf..e053710 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 87133bd..efe0ce3 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 e715ab5..be3a872 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 dbbe172..0e3364f 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 dd60887..b6130fc 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 f4c246f..3c01dc4 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 });