From ab4383113f8f2f196e89adca4de9e3edc566f8b6 Mon Sep 17 00:00:00 2001 From: Guillaume Cauchon Date: Tue, 7 Feb 2023 21:24:47 -0500 Subject: [PATCH] Format & Linting --- assets/css/app.css | 6 +- assets/js/app.js | 28 +++--- assets/tailwind.config.js | 41 ++++++--- .../components/branding.ex | 5 +- lib/elixir_boilerplate_web/components/core.ex | 92 +++---------------- mix.lock | 2 - 6 files changed, 65 insertions(+), 109 deletions(-) diff --git a/assets/css/app.css b/assets/css/app.css index de15c91d..a31e4441 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -1,3 +1,3 @@ -@import "tailwindcss/base"; -@import "tailwindcss/components"; -@import "tailwindcss/utilities"; \ No newline at end of file +@import 'tailwindcss/base'; +@import 'tailwindcss/components'; +@import 'tailwindcss/utilities'; diff --git a/assets/js/app.js b/assets/js/app.js index 267d895b..9667999d 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -1,25 +1,31 @@ // Include phoenix_html to handle method=PUT/DELETE in forms and buttons. -import "phoenix_html" +import 'phoenix_html'; // Show progress bar on live navigation and form submits -import topbar from "topbar" +import topbar from 'topbar'; -topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"}) -window.addEventListener("phx:page-loading-start", info => topbar.delayedShow(200)) -window.addEventListener("phx:page-loading-stop", info => topbar.hide()) +topbar.config({barColors: {0: '#29d'}, shadowColor: 'rgba(0, 0, 0, .3)'}); +window.addEventListener('phx:page-loading-start', (info) => + topbar.delayedShow(200) +); +window.addEventListener('phx:page-loading-stop', (info) => topbar.hide()); // Establish Phoenix Socket and LiveView configuration. -import {Socket} from "phoenix" -import {LiveSocket} from "phoenix_live_view" +import {Socket} from 'phoenix'; +import {LiveSocket} from 'phoenix_live_view'; -let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content") -let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}}) +let csrfToken = document + .querySelector("meta[name='csrf-token']") + .getAttribute('content'); +let liveSocket = new LiveSocket('/live', Socket, { + params: {_csrf_token: csrfToken} +}); // connect if there are any LiveViews on the page -liveSocket.connect() +liveSocket.connect(); // expose liveSocket on window for web console debug logs and latency simulation: // >> liveSocket.enableDebug() // >> liveSocket.enableLatencySim(1000) // enabled for duration of browser session // >> liveSocket.disableLatencySim() -window.liveSocket = liveSocket \ No newline at end of file +window.liveSocket = liveSocket; diff --git a/assets/tailwind.config.js b/assets/tailwind.config.js index b6117019..e9a25e2f 100644 --- a/assets/tailwind.config.js +++ b/assets/tailwind.config.js @@ -1,26 +1,39 @@ // See the Tailwind configuration guide for advanced usage // https://tailwindcss.com/docs/configuration -const plugin = require("tailwindcss/plugin") +const plugin = require('tailwindcss/plugin'); module.exports = { - content: [ - "./js/**/*.js", - "../lib/*_web.ex", - "../lib/*_web/**/*.*ex" - ], + content: ['./js/**/*.js', '../lib/*_web.ex', '../lib/*_web/**/*.*ex'], theme: { extend: { colors: { - brand: "#FD4F00", + brand: '#FD4F00' } - }, + } }, plugins: [ - require("@tailwindcss/forms"), - plugin(({addVariant}) => addVariant("phx-no-feedback", [".phx-no-feedback&", ".phx-no-feedback &"])), - plugin(({addVariant}) => addVariant("phx-click-loading", [".phx-click-loading&", ".phx-click-loading &"])), - plugin(({addVariant}) => addVariant("phx-submit-loading", [".phx-submit-loading&", ".phx-submit-loading &"])), - plugin(({addVariant}) => addVariant("phx-change-loading", [".phx-change-loading&", ".phx-change-loading &"])) + require('@tailwindcss/forms'), + plugin(({addVariant}) => + addVariant('phx-no-feedback', ['.phx-no-feedback&', '.phx-no-feedback &']) + ), + plugin(({addVariant}) => + addVariant('phx-click-loading', [ + '.phx-click-loading&', + '.phx-click-loading &' + ]) + ), + plugin(({addVariant}) => + addVariant('phx-submit-loading', [ + '.phx-submit-loading&', + '.phx-submit-loading &' + ]) + ), + plugin(({addVariant}) => + addVariant('phx-change-loading', [ + '.phx-change-loading&', + '.phx-change-loading &' + ]) + ) ] -} \ No newline at end of file +}; diff --git a/lib/elixir_boilerplate_web/components/branding.ex b/lib/elixir_boilerplate_web/components/branding.ex index 827947b6..c293f3b0 100644 --- a/lib/elixir_boilerplate_web/components/branding.ex +++ b/lib/elixir_boilerplate_web/components/branding.ex @@ -15,7 +15,10 @@ defmodule ElixirBoilerplateWeb.Components.Branding do def logo(assigns) do ~H""" - + """ end end diff --git a/lib/elixir_boilerplate_web/components/core.ex b/lib/elixir_boilerplate_web/components/core.ex index bdb7c525..a33e4c24 100644 --- a/lib/elixir_boilerplate_web/components/core.ex +++ b/lib/elixir_boilerplate_web/components/core.ex @@ -47,21 +47,9 @@ defmodule ElixirBoilerplateWeb.Components.Core do def modal(assigns) do ~H""" -