From 7a8492190c95eac6f778f2bc758c080c7f3bde60 Mon Sep 17 00:00:00 2001 From: Anita Lipsky <7695311+purplebugs@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:18:34 +0200 Subject: [PATCH] chore: Prettier formatting. Ran command. (#21) --- .prettierignore | 2 ++ .prettierrc | 7 +++++++ README.md | 4 ++++ build.js | 2 +- package.json | 2 ++ public/element.html | 3 +-- src/alpaca-map.js | 9 +++++++-- src/element.js | 4 +++- 8 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..284ef2f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +# Ignore artifacts: +public/build \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e776df4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "printWidth": 80, + "trailingComma": "es5", + "tabWidth": 2, + "semi": true, + "singleQuote": false +} diff --git a/README.md b/README.md index 87ce2e0..6bac458 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,10 @@ Standard build `npm run build` +Format the code + +`npm run prettier` + ### Run app 🚀 `npm run start` diff --git a/build.js b/build.js index 3833a14..2d4ef3c 100644 --- a/build.js +++ b/build.js @@ -11,7 +11,7 @@ const inputOptions = { rollupPluginCommonjs({ include: /node_modules/ }), rollupPluginReplace({ "process.env.NODE_ENV": JSON.stringify("production"), - "preventAssignment": true, + preventAssignment: true, }), rollupPluginTerser({ format: { comments: false } }), ], diff --git a/package.json b/package.json index 9b8520f..756e863 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "build:watch": "node --watch-path=./src build.js", "build": "node build.js", + "prettier": "prettier . --write", "start": "node dev-server.js" }, "author": "", @@ -18,6 +19,7 @@ "@rollup/plugin-replace": "5.0.7", "@rollup/plugin-terser": "0.4.4", "fastify": "4.28.0", + "prettier": "3.3.2", "rollup": "4.18.0" }, "dependencies": { diff --git a/public/element.html b/public/element.html index 33b943f..8da4051 100644 --- a/public/element.html +++ b/public/element.html @@ -5,7 +5,6 @@ h3 { color: purple; } - @@ -18,7 +17,7 @@

This is the header

This is the footer

- +
diff --git a/src/alpaca-map.js b/src/alpaca-map.js index 805b7d2..0f4c31b 100644 --- a/src/alpaca-map.js +++ b/src/alpaca-map.js @@ -129,7 +129,9 @@ export default class AlpacaMap extends LitElement { // markers can only be keyboard focusable when they have click listeners // open info window when marker is clicked marker.addListener("click", () => { - infoWindow.setContent(farm.location.lat_lng.lat + ", " + farm.location.lat_lng.lng); + infoWindow.setContent( + farm.location.lat_lng.lat + ", " + farm.location.lat_lng.lng + ); infoWindow.open(this.map, marker); }); @@ -145,7 +147,10 @@ export default class AlpacaMap extends LitElement { _filterMarkers(element) { const form = new FormData(element.target.parentElement); - console.log("element.target.parentElement.id", element.target.parentElement.id); + console.log( + "element.target.parentElement.id", + element.target.parentElement.id + ); console.log("has public", form.has("public")); console.log("has private", form.has("private")); diff --git a/src/element.js b/src/element.js index a788e1a..02e007a 100644 --- a/src/element.js +++ b/src/element.js @@ -31,7 +31,9 @@ export class AlpacaElement extends LitElement { _title() { // Calling this._increase without parentheses ensures it is not run on page load, but only when the h3 element is clicked - return html``; + return html``; } render() {