From 365fb60ef5832bddd04e7d3df0d0444652eb6e72 Mon Sep 17 00:00:00 2001 From: Ffloriel Date: Fri, 26 Nov 2021 13:24:43 +0000 Subject: [PATCH] refactor: format files --- packages/gulp-purgecss/src/index.ts | 4 ++-- packages/purgecss-from-jsx/src/index.ts | 6 ++++-- packages/purgecss/__tests__/rejectedCss.test.ts | 4 +++- packages/purgecss/src/index.ts | 12 +++++++----- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/gulp-purgecss/src/index.ts b/packages/gulp-purgecss/src/index.ts index 22ba8243..98c80058 100644 --- a/packages/gulp-purgecss/src/index.ts +++ b/packages/gulp-purgecss/src/index.ts @@ -39,7 +39,7 @@ function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform { : purge.css; file.contents = Buffer.from(result, "utf-8"); callback(null, file); - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { this.emit("error", new PluginError(PLUGIN_NAME, e.message)); } @@ -65,7 +65,7 @@ function gulpPurgeCSS(options: UserDefinedOptions): internal.Transform { // @ts-ignore streamFile.contents = Buffer.from(result, "utf-8"); callback(null, file); - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { this.emit("error", new PluginError(PLUGIN_NAME, e.message)); } diff --git a/packages/purgecss-from-jsx/src/index.ts b/packages/purgecss-from-jsx/src/index.ts index 57e4dc09..4019193d 100644 --- a/packages/purgecss-from-jsx/src/index.ts +++ b/packages/purgecss-from-jsx/src/index.ts @@ -4,7 +4,7 @@ import jsx, { JSXIdentifier, JSXNamespacedName, JSXOpeningElement, - Literal + Literal, } from "acorn-jsx"; import { extend } from "acorn-jsx-walk"; import * as walk from "acorn-walk"; @@ -23,7 +23,9 @@ function purgeFromJsx(options?: acorn.Options) { // Parse and walk any JSXElement walk.recursive( - acorn.Parser.extend(jsx() as (BaseParser: typeof acorn.Parser) => typeof acorn.Parser).parse(content, options), + acorn.Parser.extend( + jsx() as (BaseParser: typeof acorn.Parser) => typeof acorn.Parser + ).parse(content, options), state, { JSXOpeningElement(acornNode, state, callback) { diff --git a/packages/purgecss/__tests__/rejectedCss.test.ts b/packages/purgecss/__tests__/rejectedCss.test.ts index 8ab5bcad..2150526a 100644 --- a/packages/purgecss/__tests__/rejectedCss.test.ts +++ b/packages/purgecss/__tests__/rejectedCss.test.ts @@ -23,7 +23,9 @@ describe("rejectedCss", () => { rejected: true, rejectedCss: true, }); - expect(resultsPurge[0].rejectedCss?.trim()).toContain(resultsPurge[0].rejected?.[0]); + expect(resultsPurge[0].rejectedCss?.trim()).toContain( + resultsPurge[0].rejected?.[0] + ); }); /** * https://github.com/FullHuman/purgecss/pull/763#discussion_r754618902 diff --git a/packages/purgecss/src/index.ts b/packages/purgecss/src/index.ts index 63b19e63..04961ef0 100644 --- a/packages/purgecss/src/index.ts +++ b/packages/purgecss/src/index.ts @@ -10,7 +10,7 @@ import { IGNORE_ANNOTATION_CURRENT, IGNORE_ANNOTATION_END, IGNORE_ANNOTATION_NEXT, - IGNORE_ANNOTATION_START + IGNORE_ANNOTATION_START, } from "./constants"; import ExtractorResultSets from "./ExtractorResultSets"; import { CSS_SAFELIST } from "./internal-safelist"; @@ -28,13 +28,13 @@ import { RawCSS, ResultPurge, UserDefinedOptions, - UserDefinedSafelist + UserDefinedSafelist, } from "./types"; import { matchAll } from "./utils"; import VariablesStructure from "./VariablesStructure"; export { defaultOptions } from "./options"; -export * from './types'; +export * from "./types"; export { PurgeCSS }; const asyncFs = { @@ -68,7 +68,7 @@ export async function setOptions( try { const t = path.resolve(process.cwd(), configFile); options = await import(t); - // eslint-disable-next-line @typescript-eslint/no-explicit-any + // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (err: any) { throw new Error(`${ERROR_CONFIG_FILE_LOADING} ${err.message}`); } @@ -555,7 +555,9 @@ class PurgeCSS { } if (this.options.rejectedCss) { - result.rejectedCss = postcss.root({ nodes: this.removedNodes }).toString(); + result.rejectedCss = postcss + .root({ nodes: this.removedNodes }) + .toString(); } sources.push(result);