Skip to content

Commit 51434bf

Browse files
committed
Format code with deno fmt
1 parent 111f9b3 commit 51434bf

15 files changed

+98
-77
lines changed

.github/workflows/hugo.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Install Hugo CLI
3838
run: |
3939
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
40-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
40+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
4141
- name: Install Dart Sass Embedded
4242
run: sudo snap install dart-sass-embedded
4343
- name: Checkout
@@ -59,7 +59,7 @@ jobs:
5959
hugo \
6060
--gc \
6161
--minify \
62-
--baseURL "${{ steps.pages.outputs.base_url }}/"
62+
--baseURL "${{ steps.pages.outputs.base_url }}/"
6363
- name: Upload artifact
6464
uses: actions/upload-pages-artifact@v1
6565
with:

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
helmetjs.github.io
2-
==================
1+
# helmetjs.github.io
32

43
This is the documentation for Helmet, built with [Hugo](https://gohugo.io/).

archetypes/faq.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
---
22
title: "{{ replace .Name "-" " " | title }}"
33
---
4-

assets/sass/global.scss

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
* { box-sizing: border-box; }
1+
* {
2+
box-sizing: border-box;
3+
}
24

35
body {
46
color: var(--text-color);
57
background: var(--background-color);
6-
font-family: "Helvetica Neue", "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
8+
font-family:
9+
"Helvetica Neue",
10+
"Segoe UI",
11+
"Noto Sans",
12+
Helvetica,
13+
Arial,
14+
sans-serif;
715
font-size: 20px;
816
line-height: 2em;
917
-webkit-font-smoothing: antialiased;

content/_index.md

+31-31
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ app.use(
5454
"script-src": ["'self'", "example.com"],
5555
},
5656
},
57-
})
57+
}),
5858
);
5959
```
6060

@@ -67,7 +67,7 @@ app.use(
6767
helmet({
6868
contentSecurityPolicy: false,
6969
xDownloadOptions: false,
70-
})
70+
}),
7171
);
7272
```
7373

@@ -99,7 +99,7 @@ app.use(
9999
"style-src": null,
100100
},
101101
},
102-
})
102+
}),
103103
);
104104
```
105105

@@ -117,7 +117,7 @@ app.use(
117117
scriptSrc: ["'self'", (req, res) => `'nonce-${res.locals.cspNonce}'`],
118118
},
119119
},
120-
})
120+
}),
121121
);
122122
```
123123

@@ -138,7 +138,7 @@ app.use(
138138
upgradeInsecureRequests: [],
139139
},
140140
},
141-
})
141+
}),
142142
);
143143
```
144144

@@ -172,7 +172,7 @@ app.use(
172172
},
173173
reportOnly: true,
174174
},
175-
})
175+
}),
176176
);
177177
```
178178

@@ -184,7 +184,7 @@ To disable the `Content-Security-Policy` header:
184184
app.use(
185185
helmet({
186186
contentSecurityPolicy: false,
187-
})
187+
}),
188188
);
189189
```
190190

@@ -234,7 +234,7 @@ app.use(helmet());
234234
app.use(
235235
helmet({
236236
crossOriginOpenerPolicy: { policy: "same-origin-allow-popups" },
237-
})
237+
}),
238238
);
239239
```
240240

@@ -244,7 +244,7 @@ To disable the `Cross-Origin-Opener-Policy` header:
244244
app.use(
245245
helmet({
246246
crossOriginOpenerPolicy: false,
247-
})
247+
}),
248248
);
249249
```
250250

@@ -277,7 +277,7 @@ To disable the `Cross-Origin-Resource-Policy` header:
277277
app.use(
278278
helmet({
279279
crossOriginResourcePolicy: false,
280-
})
280+
}),
281281
);
282282
```
283283

@@ -309,7 +309,7 @@ To disable the `Origin-Agent-Cluster` header:
309309
app.use(
310310
helmet({
311311
originAgentCluster: false,
312-
})
312+
}),
313313
);
314314
```
315315

@@ -342,7 +342,7 @@ app.use(
342342
referrerPolicy: {
343343
policy: "no-referrer",
344344
},
345-
})
345+
}),
346346
);
347347

348348
// Sets "Referrer-Policy: origin,unsafe-url"
@@ -351,7 +351,7 @@ app.use(
351351
referrerPolicy: {
352352
policy: ["origin", "unsafe-url"],
353353
},
354-
})
354+
}),
355355
);
356356
```
357357

@@ -361,7 +361,7 @@ To disable the `Referrer-Policy` header:
361361
app.use(
362362
helmet({
363363
referrerPolicy: false,
364-
})
364+
}),
365365
);
366366
```
367367

@@ -398,7 +398,7 @@ app.use(
398398
strictTransportSecurity: {
399399
maxAge: 123456,
400400
},
401-
})
401+
}),
402402
);
403403

404404
// Sets "Strict-Transport-Security: max-age=123456"
@@ -408,7 +408,7 @@ app.use(
408408
maxAge: 123456,
409409
includeSubDomains: false,
410410
},
411-
})
411+
}),
412412
);
413413

414414
// Sets "Strict-Transport-Security: max-age=123456; includeSubDomains; preload"
@@ -418,7 +418,7 @@ app.use(
418418
maxAge: 63072000,
419419
preload: true,
420420
},
421-
})
421+
}),
422422
);
423423
```
424424

@@ -428,7 +428,7 @@ To disable the `Strict-Transport-Security` header:
428428
app.use(
429429
helmet({
430430
strictTransportSecurity: false,
431-
})
431+
}),
432432
);
433433
```
434434

@@ -460,7 +460,7 @@ To disable the `X-Content-Type-Options` header:
460460
app.use(
461461
helmet({
462462
xContentTypeOptions: false,
463-
})
463+
}),
464464
);
465465
```
466466

@@ -493,14 +493,14 @@ Examples:
493493
app.use(
494494
helmet({
495495
xDnsPrefetchControl: { allow: false },
496-
})
496+
}),
497497
);
498498

499499
// Sets "X-DNS-Prefetch-Control: on"
500500
app.use(
501501
helmet({
502502
xDnsPrefetchControl: { allow: true },
503-
})
503+
}),
504504
);
505505
```
506506

@@ -510,7 +510,7 @@ To disable the `X-DNS-Prefetch-Control` header and use the browser's default val
510510
app.use(
511511
helmet({
512512
xDnsPrefetchControl: false,
513-
})
513+
}),
514514
);
515515
```
516516

@@ -542,7 +542,7 @@ To disable the `X-Download-Options` header:
542542
app.use(
543543
helmet({
544544
xDownloadOptions: false,
545-
})
545+
}),
546546
);
547547
```
548548

@@ -575,14 +575,14 @@ Examples:
575575
app.use(
576576
helmet({
577577
xFrameOptions: { action: "deny" },
578-
})
578+
}),
579579
);
580580

581581
// Sets "X-Frame-Options: SAMEORIGIN"
582582
app.use(
583583
helmet({
584584
xFrameOptions: { action: "sameorigin" },
585-
})
585+
}),
586586
);
587587
```
588588

@@ -592,7 +592,7 @@ To disable the `X-Frame-Options` header:
592592
app.use(
593593
helmet({
594594
xFrameOptions: false,
595-
})
595+
}),
596596
);
597597
```
598598

@@ -627,7 +627,7 @@ app.use(
627627
xPermittedCrossDomainPolicies: {
628628
permittedPolicies: "none",
629629
},
630-
})
630+
}),
631631
);
632632

633633
// Sets "X-Permitted-Cross-Domain-Policies: by-content-type"
@@ -636,7 +636,7 @@ app.use(
636636
xPermittedCrossDomainPolicies: {
637637
permittedPolicies: "by-content-type",
638638
},
639-
})
639+
}),
640640
);
641641
```
642642

@@ -646,7 +646,7 @@ To disable the `X-Permitted-Cross-Domain-Policies` header:
646646
app.use(
647647
helmet({
648648
xPermittedCrossDomainPolicies: false,
649-
})
649+
}),
650650
);
651651
```
652652

@@ -675,7 +675,7 @@ app.disable("x-powered-by");
675675
app.use(
676676
helmet({
677677
xPoweredBy: false,
678-
})
678+
}),
679679
);
680680
```
681681

@@ -703,7 +703,7 @@ To disable the `X-XSS-Protection` header:
703703
app.use(
704704
helmet({
705705
xXssProtection: false,
706-
})
706+
}),
707707
);
708708
```
709709

content/faq/conditional-options.md

+14-9
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ To change a header conditionally, create your own small middleware function that
77
For example, you could decide to conditionally change the Referrer Policy for a subset of users. Here's how that could look:
88

99
```javascript
10-
const helmetWithNoReferrer = helmet({ referrerPolicy: { policy: "no-referrer" }})
11-
const helmetWithSameOrigin = helmet({ referrerPolicy: { policy: "same-origin" }})
10+
const helmetWithNoReferrer = helmet({
11+
referrerPolicy: { policy: "no-referrer" },
12+
});
13+
const helmetWithSameOrigin = helmet({
14+
referrerPolicy: { policy: "same-origin" },
15+
});
1216

1317
app.use((req, res, next) => {
1418
if (req.user.useSameOrigin) {
15-
helmetWithSameOrigin(req,res,next)
19+
helmetWithSameOrigin(req, res, next);
1620
} else {
17-
helmetWithNoReferrer(req,res,next)
21+
helmetWithNoReferrer(req, res, next);
1822
}
1923
});
2024
```
@@ -26,13 +30,14 @@ app.use((req, res, next) => {
2630
res.locals.cspNonce = crypto.randomBytes(16).toString("hex");
2731
next();
2832
});
33+
2934
app.use(
3035
helmet({
31-
contentSecurityPolicy:{
32-
directives: {
33-
scriptSrc: ["'self'", (req, res) => `'nonce-${res.locals.cspNonce}'`],
36+
contentSecurityPolicy: {
37+
directives: {
38+
scriptSrc: ["'self'", (req, res) => `'nonce-${res.locals.cspNonce}'`],
39+
},
3440
},
35-
}
36-
})
41+
}),
3742
);
3843
```

content/faq/conditional-skip.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
title: "Conditionally skipping headers"
33
---
4+
45
To skip a header conditionally, create your own small middleware function that conditionally calls different invocations of Helmet.
56

67
For example, you could decide to conditionally enable a Content Security Policy for a subset of users. Here's how that could look:
78

89
```javascript
9-
const helmetWithCsp = helmet()
10-
const helmetWithoutCsp = helmet({contentSecurityPolicy:false})
10+
const helmetWithCsp = helmet();
11+
const helmetWithoutCsp = helmet({ contentSecurityPolicy: false });
1112

1213
app.use((req, res, next) => {
1314
if (req.user.isContentSecurityPolicyEnabled) {
14-
helmetWithCsp(req,res,next)
15+
helmetWithCsp(req, res, next);
1516
} else {
16-
helmetWithoutCsp(req,res,next)
17+
helmetWithoutCsp(req, res, next);
1718
}
1819
});
1920
```

0 commit comments

Comments
 (0)