Skip to content

Commit 4a865a8

Browse files
committed
refactor: run prettier
1 parent 646e419 commit 4a865a8

14 files changed

Lines changed: 227 additions & 210 deletions

File tree

packages/grunt-purgecss/__tests__/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ describe("Purgecss grunt plugin", () => {
1515
if (err) throw err;
1616

1717
for (const file of files) {
18-
fs.unlink(path.join(directory, file), err => {
18+
fs.unlink(path.join(directory, file), (err) => {
1919
if (err) throw err;
2020
});
21-
}
21+
}
2222
});
2323
}
2424

@@ -34,7 +34,7 @@ describe("Purgecss grunt plugin", () => {
3434
const expected = fs
3535
.readFileSync(`${__dirname}/fixtures/expected/${file}`)
3636
.toString();
37-
expect(actual.replace(/\s/g, '')).toBe(expected.replace(/\s/g, ''));
37+
expect(actual.replace(/\s/g, "")).toBe(expected.replace(/\s/g, ""));
3838
});
3939
}
4040
});

packages/grunt-purgecss/src/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ function gruntPurgeCSS(grunt: IGrunt): void {
3535
grunt.file.write(file.dest, purgeCSSResults[0].css);
3636
// Print a success message
3737
grunt.log.writeln(`File "${file.dest}" created.`);
38-
})
38+
});
3939

40-
promisedPurgedFiles.push(purgedCss);
40+
promisedPurgedFiles.push(purgedCss);
4141
}
42-
Promise.all(promisedPurgedFiles)
43-
.then(() => {
44-
done();
45-
}).catch(() => done(false))
46-
42+
Promise.all(promisedPurgedFiles)
43+
.then(() => {
44+
done();
45+
})
46+
.catch(() => done(false));
4747
});
4848
}
4949

packages/postcss-purgecss/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as postcss from "postcss";
22
import PurgeCSS, {
33
defaultOptions,
44
mergeExtractorSelectors,
5-
standardizeSafelist
5+
standardizeSafelist,
66
} from "purgecss";
77
import { RawContent, UserDefinedOptions } from "./types";
88

packages/purgecss-from-jsx/__tests__/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import purgeJsx from "../src/index";
22

33
import { TEST_1_CONTENT, TEST_1_TAG, TEST_1_CLASS, TEST_1_ID } from "./data";
44

5-
const plugin = purgeJsx({sourceType: "module"});
5+
const plugin = purgeJsx({ sourceType: "module" });
66

77
describe("purgePug", () => {
88
describe("from a normal html document", () => {

packages/purgecss-from-jsx/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import * as acorn from "acorn";
22
import jsx, {
33
JSXAttribute,
4-
JSXIdentifier, JSXNamespacedName,
4+
JSXIdentifier,
5+
JSXNamespacedName,
56
JSXOpeningElement,
6-
Literal
7+
Literal,
78
} from "acorn-jsx";
89
import { extend } from "acorn-jsx-walk";
910
import * as walk from "acorn-walk";

packages/purgecss-from-tsx/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import acorn from "acorn";
33
import * as ts from "typescript";
44

55
function purgeFromTsx(options?: {
6-
acornOptions?: acorn.Options,
7-
tsOptions?: ts.CompilerOptions
6+
acornOptions?: acorn.Options;
7+
tsOptions?: ts.CompilerOptions;
88
}): (content: string) => string[] {
99
return (content: string): string[] => {
1010
return purgeFromJsx(options?.acornOptions)(
1111
ts.transpileModule(content, {
1212
compilerOptions: {
1313
jsx: ts.JsxEmit.Preserve,
14-
...options?.tsOptions
15-
}
14+
...options?.tsOptions,
15+
},
1616
}).outputText
1717
);
1818
};

packages/purgecss/src/bin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
defaultOptions,
66
PurgeCSS,
77
setOptions,
8-
standardizeSafelist
8+
standardizeSafelist,
99
} from "./index";
1010

1111
async function writeCSSToFile(filePath: string, css: string) {

packages/purgecss/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
IGNORE_ANNOTATION_CURRENT,
1111
IGNORE_ANNOTATION_END,
1212
IGNORE_ANNOTATION_NEXT,
13-
IGNORE_ANNOTATION_START
13+
IGNORE_ANNOTATION_START,
1414
} from "./constants";
1515
import ExtractorResultSets from "./ExtractorResultSets";
1616
import { CSS_SAFELIST } from "./internal-safelist";
@@ -28,7 +28,7 @@ import {
2828
RawCSS,
2929
ResultPurge,
3030
UserDefinedOptions,
31-
UserDefinedSafelist
31+
UserDefinedSafelist,
3232
} from "./types";
3333
import { matchAll } from "./utils";
3434
import VariablesStructure from "./VariablesStructure";

packages/purgecss/src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as postcss from "postcss";
22

3-
export type PostCSSRoot = postcss.Root
3+
export type PostCSSRoot = postcss.Root;
44
export interface AtRules {
55
fontFace: Array<{
66
name: string;

packages/purgecss/src/utils.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
2-
31
export function matchAll(str: string, regexp: RegExp): RegExpMatchArray[] {
4-
const matches: RegExpMatchArray[] = [];
5-
str.replace(regexp, function () {
6-
// eslint-disable-next-line prefer-rest-params
7-
const args = arguments;
8-
const match: RegExpMatchArray = Array.prototype.slice.call(args, 0, -2);
9-
match.input = args[args.length - 1];
10-
match.index = args[args.length - 2];
11-
matches.push(match);
12-
return str;
13-
});
14-
return matches;
15-
}
2+
const matches: RegExpMatchArray[] = [];
3+
str.replace(regexp, function () {
4+
// eslint-disable-next-line prefer-rest-params
5+
const args = arguments;
6+
const match: RegExpMatchArray = Array.prototype.slice.call(args, 0, -2);
7+
match.input = args[args.length - 1];
8+
match.index = args[args.length - 2];
9+
matches.push(match);
10+
return str;
11+
});
12+
return matches;
13+
}

0 commit comments

Comments
 (0)