Skip to content

Commit

Permalink
Merge #194
Browse files Browse the repository at this point in the history
194: setup prettier r=nikomatsakis a=vemoo

I have left prettier default settings, but I'm open to suggestions.

Prettier can also format *.md files, but I have excluded them for now because it removes the whitespaces I mention in #193.

Co-authored-by: Bernardo Uriarte <[email protected]>
  • Loading branch information
bors[bot] and vemoo authored Jul 13, 2022
2 parents ca84ece b45a0f0 commit e5c02cf
Show file tree
Hide file tree
Showing 19 changed files with 564 additions and 481 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 65,7 @@ jobs:
- uses: actions-rs/[email protected]
with:
command: xtask
args: deploy
args: deploy --check

rustfmt:
name: Rustfmt
Expand Down
8 changes: 8 additions & 0 deletions book/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
/node_modules
/.docusaurus

/build

/blog
/docs
/static
3 changes: 3 additions & 0 deletions book/.prettierrc.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
// empty file to prevent editor settings from taking effect
// and esure we use prettier default settings
{}
2 changes: 1 addition & 1 deletion book/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
105 changes: 53 additions & 52 deletions book/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,41 1,42 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Dada',
tagline: 'Dada',
url: 'https://dada-lang.org',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/dada.svg',
organizationName: 'dada-lang',
projectName: 'dada', // Usually your repo name.
title: "Dada",
tagline: "Dada",
url: "https://dada-lang.org",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/dada.svg",
organizationName: "dada-lang",
projectName: "dada", // Usually your repo name.

presets: [
[
'classic',
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo.
editUrl: 'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
editUrl:
"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/',
"https://github.com/facebook/docusaurus/tree/main/packages/create-docusaurus/templates/shared/",
},
theme: {
customCss: [
require.resolve('./src/css/custom.css'),
require.resolve('./src/css/speech-bubbles.css')
require.resolve("./src/css/custom.css"),
require.resolve("./src/css/speech-bubbles.css"),
],
},
}),
Expand All @@ -46,54 47,54 @@ const config = {
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
navbar: {
title: 'Dada',
title: "Dada",
logo: {
alt: 'My Site Logo',
src: 'https://raw.githubusercontent.com/dada-lang/dada-artwork/main/dada.svg',
alt: "My Site Logo",
src: "https://raw.githubusercontent.com/dada-lang/dada-artwork/main/dada.svg",
},
items: [
{
type: 'doc',
docId: 'about',
position: 'left',
label: 'About',
type: "doc",
docId: "about",
position: "left",
label: "About",
},
{
type: 'doc',
docId: 'tutorials',
position: 'left',
label: 'Tutorials',
type: "doc",
docId: "tutorials",
position: "left",
label: "Tutorials",
},
{ to: '/blog', label: 'Blog', position: 'left' },
{ to: '/playground', label: 'Playground', position: 'left' },
{ to: "/blog", label: "Blog", position: "left" },
{ to: "/playground", label: "Playground", position: "left" },
{
type: 'doc',
docId: 'design_docs',
position: 'left',
label: 'Design Docs',
type: "doc",
docId: "design_docs",
position: "left",
label: "Design Docs",
},
{
type: 'doc',
docId: 'contributing',
position: 'left',
label: 'Contributing',
type: "doc",
docId: "contributing",
position: "left",
label: "Contributing",
},
{
href: 'https://github.com/dada-lang/dada',
label: 'GitHub',
position: 'right',
href: "https://github.com/dada-lang/dada",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: 'dark',
style: "dark",
links: [
{
title: 'Docs',
title: "Docs",
items: [
{
label: 'Tutorials',
to: '/docs/tutorials',
label: "Tutorials",
to: "/docs/tutorials",
},
],
},
Expand All @@ -115,15 116,15 @@ const config = {
// ],
// },
{
title: 'More',
title: "More",
items: [
{
label: 'Blog',
to: '/blog',
label: "Blog",
to: "/blog",
},
{
label: 'GitHub',
href: 'https://github.com/dada-lang/dada',
label: "GitHub",
href: "https://github.com/dada-lang/dada",
},
],
},
Expand All @@ -140,9 141,9 @@ const config = {
async function myPlugin(context, options) {
// ...
return {
name: 'theme-dada-codeblock/components',
name: "theme-dada-codeblock/components",
getThemePath() {
return 'src/theme-dada-codeblock/components';
return "src/theme-dada-codeblock/components";
},
};
},
Expand Down
22 changes: 22 additions & 0 deletions book/package-lock.json

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

5 changes: 4 additions & 1 deletion book/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 12,9 @@
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"typecheck": "tsc",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"dependencies": {
"@docusaurus/core": "2.0.0-beta.18",
Expand All @@ -32,6 34,7 @@
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.18",
"@tsconfig/docusaurus": "^1.0.5",
"prettier": "^2.7.1",
"typescript": "^4.6.3"
},
"browserslist": {
Expand Down
Loading

0 comments on commit e5c02cf

Please sign in to comment.