Skip to content

Commit 7f18a75

Browse files
committed
biome formatter
1 parent 92d9a9c commit 7f18a75

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

tasks/compress_attributes.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,21 @@ var OPTIONAL_COMMA = ',?';
1010

1111
// one line string with or without trailing comma
1212
function makeStringRegex(attr) {
13-
return makeRegex(
14-
WHITESPACE_BEFORE + attr + ': \'.*\'' + OPTIONAL_COMMA
15-
);
13+
return makeRegex(WHITESPACE_BEFORE + attr + ": '.*'" + OPTIONAL_COMMA);
1614
}
1715

1816
// joined array of strings with or without trailing comma
1917
function makeJoinedArrayRegex(attr) {
20-
return makeRegex(
21-
WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + OPTIONAL_COMMA
22-
);
18+
return makeRegex(WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + '\\.join\\(.*' + OPTIONAL_COMMA);
2319
}
2420

2521
// array with or without trailing comma
2622
function makeArrayRegex(attr) {
27-
return makeRegex(
28-
WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + OPTIONAL_COMMA
29-
);
23+
return makeRegex(WHITESPACE_BEFORE + attr + ': \\[[\\s\\S]*?\\]' + OPTIONAL_COMMA);
3024
}
3125

3226
function makeRegex(regexStr) {
33-
return (
34-
new RegExp(regexStr, 'g')
35-
);
27+
return new RegExp(regexStr, 'g');
3628
}
3729

3830
const allRegexes = [
@@ -44,15 +36,18 @@ const allRegexes = [
4436
makeStringRegex('hrName')
4537
];
4638

47-
var esbuildPluginStripMeta = {
39+
const esbuildPluginStripMeta = {
4840
name: 'strip-meta-attributes',
4941
setup(build) {
5042
const loader = 'js';
51-
build.onLoad({ filter: /\.js$/ }, async file => ({
52-
contents: await fs.promises.readFile(file.path, 'utf-8').then(c => {
53-
allRegexes.forEach(r => { c = c.replace(r, ''); });
43+
build.onLoad({ filter: /\.js$/ }, async (file) => ({
44+
contents: await fs.promises.readFile(file.path, 'utf-8').then((c) => {
45+
allRegexes.forEach((r) => {
46+
c = c.replace(r, '');
47+
});
5448
return c;
55-
}), loader
49+
}),
50+
loader
5651
}));
5752
}
5853
};

0 commit comments

Comments
 (0)