Skip to content

Commit

Permalink
Update prettier and use default double quotes everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
lttr committed May 3, 2024
1 parent 8e992dc commit 79702eb
Show file tree
Hide file tree
Showing 83 changed files with 764 additions and 764 deletions.
126 changes: 63 additions & 63 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
const glob = require('glob')

const inclusiveLangPlugin = require('@11ty/eleventy-plugin-inclusive-language')
const lazyImagesPlugin = require('eleventy-plugin-lazyimages')
const pluginRss = require('@11ty/eleventy-plugin-rss')
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')

const markdownIt = require('markdown-it')
const markdownItFootnote = require('markdown-it-footnote')
const markdownItAnchor = require('markdown-it-anchor')
const markdownItToc = require('markdown-it-table-of-contents')
const markdownItFigures = require('markdown-it-implicit-figures')

const markdownItKlipse = require('./src/_plugins/markdown-it-klipse')
const markdownItTitle = require('./src/_plugins/markdown-it-title')
const markdownItMermaid = require('./src/_plugins/markdown-it-mermaid')
const markdownItDefaultType = require('./src/_plugins/markdown-it-default-type')
const markdownItArrow = require('./src/_plugins/markdown-it-arrow')
const svgContents = require('eleventy-plugin-svg-contents')

module.exports = function(eleventyConfig) {
const glob = require("glob")

const inclusiveLangPlugin = require("@11ty/eleventy-plugin-inclusive-language")
const lazyImagesPlugin = require("eleventy-plugin-lazyimages")
const pluginRss = require("@11ty/eleventy-plugin-rss")
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight")

const markdownIt = require("markdown-it")
const markdownItFootnote = require("markdown-it-footnote")
const markdownItAnchor = require("markdown-it-anchor")
const markdownItToc = require("markdown-it-table-of-contents")
const markdownItFigures = require("markdown-it-implicit-figures")

const markdownItKlipse = require("./src/_plugins/markdown-it-klipse")
const markdownItTitle = require("./src/_plugins/markdown-it-title")
const markdownItMermaid = require("./src/_plugins/markdown-it-mermaid")
const markdownItDefaultType = require("./src/_plugins/markdown-it-default-type")
const markdownItArrow = require("./src/_plugins/markdown-it-arrow")
const svgContents = require("eleventy-plugin-svg-contents")

module.exports = function (eleventyConfig) {
// Ignore files and folders

eleventyConfig.ignores.add('_drafts/')
eleventyConfig.ignores.add("_drafts/")

// Copy files

eleventyConfig.addPassthroughCopy('_redirects')
eleventyConfig.addPassthroughCopy('src/{blog,notes,talks,labs}/**/*')
eleventyConfig.addPassthroughCopy('src/css/*.css')
eleventyConfig.addPassthroughCopy('src/fonts/*.woff2')
eleventyConfig.addPassthroughCopy('src/js/*.js')
eleventyConfig.addPassthroughCopy('src/favicon.ico')
eleventyConfig.addPassthroughCopy('src/robots.txt')
eleventyConfig.addPassthroughCopy('src/shortcuts/*')
eleventyConfig.addPassthroughCopy('src/images/*')
eleventyConfig.addPassthroughCopy("_redirects")
eleventyConfig.addPassthroughCopy("src/{blog,notes,talks,labs}/**/*")
eleventyConfig.addPassthroughCopy("src/css/*.css")
eleventyConfig.addPassthroughCopy("src/fonts/*.woff2")
eleventyConfig.addPassthroughCopy("src/js/*.js")
eleventyConfig.addPassthroughCopy("src/favicon.ico")
eleventyConfig.addPassthroughCopy("src/robots.txt")
eleventyConfig.addPassthroughCopy("src/shortcuts/*")
eleventyConfig.addPassthroughCopy("src/images/*")
// All attachment images will be in one folder '/' because it is easier
// to manage correct references to them (only the name)
eleventyConfig.addPassthroughCopy({
'src/**/*.{ico,png,svg,gif,jpg,jpeg}': '/',
"src/**/*.{ico,png,svg,gif,jpg,jpeg}": "/",
})

// Create collections

eleventyConfig.addCollection('blog', collectionByFolders('blog/'))
eleventyConfig.addCollection('notes', collectionByFolders('notes/'))
eleventyConfig.addCollection("blog", collectionByFolders("blog/"))
eleventyConfig.addCollection("notes", collectionByFolders("notes/"))
eleventyConfig.addCollection(
'labs',
collectionByFolderAndFile('labs/', 'README')
"labs",
collectionByFolderAndFile("labs/", "README"),
)
eleventyConfig.addCollection(
'talks',
collectionByFolderAndFile('talks/', 'README')
"talks",
collectionByFolderAndFile("talks/", "README"),
)
eleventyConfig.addCollection('feed', collectionByFolders('blog/'))
eleventyConfig.addCollection("feed", collectionByFolders("blog/"))
eleventyConfig.addCollection(
'posts',
collectionByFolders('blog/', 'labs/', 'notes/')
"posts",
collectionByFolders("blog/", "labs/", "notes/"),
)
eleventyConfig.addCollection('tagList', getTagList)
eleventyConfig.addCollection("tagList", getTagList)

// Configure front matter

eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: '---',
excerpt_separator: "---",
})

// Configure markdown
Expand Down Expand Up @@ -99,37 +99,37 @@ module.exports = function(eleventyConfig) {
<section class="footnotes">
<ol class="footnotes-list">`

eleventyConfig.setLibrary('md', md)
eleventyConfig.setLibrary("md", md)

// Configure watch mode

eleventyConfig.addWatchTarget('**/*.md')
eleventyConfig.addWatchTarget('./src/**/*.js')
eleventyConfig.addWatchTarget('./src/**/*.css')
eleventyConfig.addWatchTarget("**/*.md")
eleventyConfig.addWatchTarget("./src/**/*.js")
eleventyConfig.addWatchTarget("./src/**/*.css")

// Add plugins

eleventyConfig.addPlugin(lazyImagesPlugin, {
cacheFile: '.datacache/lazyimages',
imgSelector: '.post-content img',
cacheFile: ".datacache/lazyimages",
imgSelector: ".post-content img",
transformImgPath: (relativePath) => {
// For image paths find the full path relative to project root
// otherwise lazyImagesPlugin would not be able to locate the image.
if (relativePath.startsWith('/') || relativePath.startsWith('./')) {
relativePath = relativePath.replace(/^.*\/(.*)/, '$1')
if (relativePath.startsWith("/") || relativePath.startsWith("./")) {
relativePath = relativePath.replace(/^.*\/(.*)/, "$1")
}
const files = glob.sync('src/**/' + relativePath)
const files = glob.sync("src/**/" + relativePath)
if (Array.isArray(files) && files[0]) {
relativePath = files[0]
if (files.length > 1) {
console.warn('More than one file with the same name was found!')
console.warn("More than one file with the same name was found!")
}
}
return relativePath
},
})
eleventyConfig.addPlugin(inclusiveLangPlugin, {
words: 'simply,obviously,basically,of course,clearly,just,everyone knows',
words: "simply,obviously,basically,of course,clearly,just,everyone knows",
})
eleventyConfig.addPlugin(pluginRss)
eleventyConfig.addPlugin(syntaxHighlight, {
Expand All @@ -140,41 +140,41 @@ module.exports = function(eleventyConfig) {
// Prism.js does not know mermaid, it has to be processed manually here
const highlighter = eleventyConfig.markdownHighlighter
eleventyConfig.addMarkdownHighlighter((str, language) => {
if (language === 'mermaid') {
if (language === "mermaid") {
return `<pre class="mermaid">${str}</pre>`
}
return highlighter(str, language)
})

return {
// Configure used template formats
templateFormats: ['11ty.js', 'md', 'njk'],
templateFormats: ["11ty.js", "md", "njk"],
dir: {
input: 'src',
output: 'dist',
input: "src",
output: "dist",
},
}
}

function collectionByFolders(...folderNames) {
return function(collection) {
return function (collection) {
return collection
.getAllSorted()
.filter((item) =>
folderNames.some((folderName) => item.inputPath.includes(folderName))
folderNames.some((folderName) => item.inputPath.includes(folderName)),
)
.reverse()
}
}

function collectionByFolderAndFile(folderName, fileName) {
return function(collection) {
return function (collection) {
return collection
.getAllSorted()
.filter(
(item) =>
item.inputPath.includes(folderName) &&
item.inputPath.includes(fileName)
item.inputPath.includes(fileName),
)
.reverse()
}
Expand All @@ -186,7 +186,7 @@ function getTagList(collection) {
collection
.getAll()
.filter((item) => Array.isArray(item.data.tags))
.flatMap((item) => item.data.tags)
.flatMap((item) => item.data.tags),
),
]
}
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: 'monthly'
interval: "monthly"

- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: 'monthly'
interval: "monthly"
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 2 * * 6'
- cron: "0 2 * * 6"

jobs:
analyze:
Expand All @@ -19,7 +19,7 @@ jobs:
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['javascript']
language: ["javascript"]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/periodic-netlify-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Trigger Netlify Build
on:
schedule:
# Run at 3:15 daily
- cron: '15 3 * * *'
- cron: "15 3 * * *"
jobs:
build:
name: Request Netlify Webhook
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ cypress/screenshots

pnpm-lock.yaml

src/talks
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"singleQuote": true,
"semi": false
}
6 changes: 3 additions & 3 deletions cypress/integration/smoke.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Smoke test site', () => {
it('Should load the main page', () => {
cy.visit('/')
describe("Smoke test site", () => {
it("Should load the main page", () => {
cy.visit("/")
})
})
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'
import "./commands"

// Alternatively you can use CommonJS syntax:
// require('./commands')
8 changes: 4 additions & 4 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import js from '@eslint/js'
import markdown from 'eslint-plugin-markdown'
import eslintConfigPrettier from 'eslint-config-prettier'
import globals from 'globals'
import js from "@eslint/js"
import markdown from "eslint-plugin-markdown"
import eslintConfigPrettier from "eslint-config-prettier"
import globals from "globals"

export default [
js.configs.recommended,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"netlify-plugin-no-more-404": "^0.0.15",
"node-fetch": "^2.6.6",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"prettier": "^3.2.5",
"puppeteer": "^13.0.1",
"rimraf": "^3.0.2",
"simple-icons": "^6.6.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/README.11ty.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const inline = require('./_lib/inline')
const inline = require("./_lib/inline")

module.exports = {
data: {
layout: 'layouts/plain',
templateEngineOverride: '11ty.js,md',
layout: "layouts/plain",
templateEngineOverride: "11ty.js,md",
},
render() {
return inline('README.md')
return inline("README.md")
},
}
2 changes: 1 addition & 1 deletion src/_data/eleventyComputed.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
// Exclude all content with `draft: true` from the build
eleventyExcludeFromCollections: (data) => {
return process.env.ELEVENTY_ENV === 'production' ? data.draft : false
return process.env.ELEVENTY_ENV === "production" ? data.draft : false
},
}
Loading

0 comments on commit 79702eb

Please sign in to comment.