Skip to content

Commit aab605a

Browse files
authored
Upgrade prettier to v3 (#88)
- Update prettier to v3 - Use default config for prettier - Switch from pretty-quick which does not work with prettier v3 to lint-staged
1 parent 7f9faf6 commit aab605a

File tree

13 files changed

+593
-465
lines changed

13 files changed

+593
-465
lines changed

.eleventy.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
const fs = require('node:fs');
2-
const inclusiveLangPlugin = require('@11ty/eleventy-plugin-inclusive-language');
3-
const cacheBuster = require('@mightyplow/eleventy-plugin-cache-buster');
4-
const pluginSitemap = require('@quasibit/eleventy-plugin-sitemap');
5-
const htmlmin = require('html-minifier');
6-
const { minify } = require('terser');
7-
const siteSettings = require('./src/globals/site.json');
1+
const fs = require("node:fs");
2+
const inclusiveLangPlugin = require("@11ty/eleventy-plugin-inclusive-language");
3+
const cacheBuster = require("@mightyplow/eleventy-plugin-cache-buster");
4+
const pluginSitemap = require("@quasibit/eleventy-plugin-sitemap");
5+
const htmlmin = require("html-minifier");
6+
const { minify } = require("terser");
7+
const siteSettings = require("./src/globals/site.json");
88

9-
const dateFormatter = Intl.DateTimeFormat('en-US', {
10-
year: 'numeric',
11-
month: 'long',
12-
day: 'numeric',
13-
weekday: 'long',
14-
hour: 'numeric',
15-
minute: 'numeric',
16-
timeZoneName: 'short',
9+
const dateFormatter = Intl.DateTimeFormat("en-US", {
10+
year: "numeric",
11+
month: "long",
12+
day: "numeric",
13+
weekday: "long",
14+
hour: "numeric",
15+
minute: "numeric",
16+
timeZoneName: "short",
1717
});
1818

1919
module.exports = function (eleventyConfig) {
2020
const runMode = process.env.ELEVENTY_RUN_MODE;
21-
const isProduction = runMode === 'build';
21+
const isProduction = runMode === "build";
2222

2323
eleventyConfig.addPlugin(pluginSitemap, {
2424
sitemap: {
2525
hostname: siteSettings.url,
2626
},
2727
});
2828

29-
eleventyConfig.addPassthroughCopy({ public: './' });
29+
eleventyConfig.addPassthroughCopy({ public: "./" });
3030

31-
eleventyConfig.addShortcode('year', function () {
31+
eleventyConfig.addShortcode("year", function () {
3232
return new Date().getFullYear().toString();
3333
});
3434

35-
eleventyConfig.addFilter('formatDateTime', function (date) {
35+
eleventyConfig.addFilter("formatDateTime", function (date) {
3636
return dateFormatter.format(date);
3737
});
3838

3939
eleventyConfig.addPlugin(inclusiveLangPlugin);
4040

4141
if (isProduction) {
42-
eleventyConfig.addPlugin(cacheBuster({ outputDirectory: 'dist' }));
42+
eleventyConfig.addPlugin(cacheBuster({ outputDirectory: "dist" }));
4343

44-
eleventyConfig.addTransform('htmlmin', function (content, outputPath) {
45-
if (outputPath && outputPath.endsWith('.html')) {
44+
eleventyConfig.addTransform("htmlmin", function (content, outputPath) {
45+
if (outputPath && outputPath.endsWith(".html")) {
4646
return htmlmin.minify(content, {
4747
useShortDoctype: true,
4848
removeComments: true,
@@ -54,13 +54,13 @@ module.exports = function (eleventyConfig) {
5454
});
5555
}
5656

57-
eleventyConfig.addAsyncFilter('jsmin', async function (code) {
57+
eleventyConfig.addAsyncFilter("jsmin", async function (code) {
5858
if (isProduction) {
5959
try {
6060
const minified = await minify(code);
6161
return minified.code;
6262
} catch (err) {
63-
console.error('Terser error: ', err);
63+
console.error("Terser error: ", err);
6464
// Fail gracefully.
6565
return code;
6666
}
@@ -72,11 +72,11 @@ module.exports = function (eleventyConfig) {
7272
return {
7373
pathPrefix: siteSettings.baseUrl,
7474
dir: {
75-
input: 'src',
76-
output: 'dist',
77-
includes: 'includes',
78-
layouts: 'includes/layouts',
79-
data: 'globals',
75+
input: "src",
76+
output: "dist",
77+
includes: "includes",
78+
layouts: "includes/layouts",
79+
data: "globals",
8080
},
8181
};
8282
};

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ jobs:
1313
node-version: '18.x'
1414
- name: Install dependencies
1515
run: npm ci
16+
- name: Check formatting
17+
run: npm run check
1618
- name: Build site
1719
run: npm run build

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
node-version: '18.x'
1515
- name: Install dependencies
1616
run: npm ci
17+
- name: Check formatting
18+
run: npm run check
1719
- name: Build site
1820
run: npm run build
1921
- name: Deploy

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/dist
2+
/public
23
*.include.css
34
package.json
4-
package-lock.json
5+
package-lock.json

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ PRs should be made against the `main` branch. Upon merging, a GitHub Action will
77
## Prerequisites
88

99
Install dependencies with `npm install`.
10+
Set up git hooks with `npm run setup-git-hooks`.
1011

1112
## Develop
1213

0 commit comments

Comments
 (0)