Skip to content

Commit

Permalink
refactor: format files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ffloriel committed Nov 26, 2021
1 parent 1a959c6 commit 365fb60
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/gulp-purgecss/src/index.ts
Expand Up @@ -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));
}
Expand All @@ -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));
}
Expand Down
6 changes: 4 additions & 2 deletions packages/purgecss-from-jsx/src/index.ts
Expand Up @@ -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";
Expand All @@ -23,7 +23,9 @@ function purgeFromJsx(options?: acorn.Options) {

// Parse and walk any JSXElement
walk.recursive<NodeState>(
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) {
Expand Down
4 changes: 3 additions & 1 deletion packages/purgecss/__tests__/rejectedCss.test.ts
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions packages/purgecss/src/index.ts
Expand Up @@ -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";
Expand All @@ -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 = {
Expand Down Expand Up @@ -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}`);
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 365fb60

Please sign in to comment.