Skip to content

Commit

Permalink
refactor: run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Ffloriel committed Jul 4, 2022
1 parent 2085d60 commit 86d2305
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
21 changes: 9 additions & 12 deletions packages/postcss-purgecss/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ describe("Purgecss postcss plugin", () => {
content: [`${__dirname}/fixtures/src/simple/simple.html`],
rejected: true,
}),
])
.process(fileContents[0].input, { from: undefined });
]).process(fileContents[0].input, { from: undefined });

expect(result.css).toBe(fileContents[0].output);
expect(result.warnings().length).toBe(0);
expect(result.messages.length).toBeGreaterThan(0);
expect(result.messages[0].text).toMatch(/unused-class/);
expect(result.messages[0].text).toMatch(/another-one-not-found/);
expect(result.css).toBe(fileContents[0].output);
expect(result.warnings().length).toBe(0);
expect(result.messages.length).toBeGreaterThan(0);
expect(result.messages[0].text).toMatch(/unused-class/);
expect(result.messages[0].text).toMatch(/another-one-not-found/);
});

it(`lets other plugins transform selectors before purging`, async () => {
Expand Down Expand Up @@ -99,14 +98,12 @@ describe("Purgecss postcss plugin", () => {
expect(result.warnings().length).toBe(0);
});

it('should work with a purgecss config file', async () => {
it("should work with a purgecss config file", async () => {
const cwd = process.cwd();
const configTestDirectory = `${__dirname}/fixtures/src/config-test/`;
process.chdir(configTestDirectory);

const input = fs
.readFileSync(`${configTestDirectory}index.css`)
.toString();
const input = fs.readFileSync(`${configTestDirectory}index.css`).toString();
const output = fs
.readFileSync(`${configTestDirectory}expected.css`)
.toString();
Expand All @@ -121,5 +118,5 @@ describe("Purgecss postcss plugin", () => {
expect(result.warnings().length).toBe(0);

process.chdir(cwd);
})
});
});
2 changes: 1 addition & 1 deletion packages/postcss-purgecss/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import * as path from "path";
const rollupConfig = createRollupConfig("postcss-purgecss", [
"postcss",
"purgecss",
"path"
"path",
]);
await buildRollup(rollupConfig);
await extractAPI(__dirname);
Expand Down
12 changes: 7 additions & 5 deletions packages/postcss-purgecss/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* PostCSS Plugin for PurgeCSS
*
*
* Most bundlers and frameworks to build websites are using PostCSS.
* The easiest way to configure PurgeCSS is with its PostCSS plugin.
*
*
* @packageDocumentation
*/

Expand All @@ -24,7 +24,7 @@ const PLUGIN_NAME = "postcss-purgecss";

/**
* Execute PurgeCSS process on the postCSS root node
*
*
* @param opts - PurgeCSS options
* @param root - root node of postCSS
* @param helpers - postCSS helpers
Expand All @@ -48,7 +48,9 @@ async function purgeCSS(
...defaultOptions,
...configFileOptions,
...opts,
safelist: standardizeSafelist(opts?.safelist || configFileOptions?.safelist),
safelist: standardizeSafelist(
opts?.safelist || configFileOptions?.safelist
),
};

if (opts && typeof opts.contentFunction === "function") {
Expand Down Expand Up @@ -105,7 +107,7 @@ async function purgeCSS(

/**
* PostCSS Plugin for PurgeCSS
*
*
* @param opts - PurgeCSS Options
* @returns the postCSS plugin
*
Expand Down
4 changes: 2 additions & 2 deletions packages/purgecss-from-jsx/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import purgeJsx from "../src/index";
import { TEST_1_CONTENT, TEST_1_TAG, TEST_1_CLASS, TEST_1_ID } from "./data";

const plugin = purgeJsx({
ecmaVersion: 'latest',
sourceType: "module"
ecmaVersion: "latest",
sourceType: "module",
});

describe("purgePug", () => {
Expand Down

0 comments on commit 86d2305

Please sign in to comment.