From 3463c1a25b941d77678b70d84c3fc0878ab491b4 Mon Sep 17 00:00:00 2001 From: James Mejia Date: Fri, 21 Feb 2025 14:14:28 -0600 Subject: [PATCH] Revert "Run prettier on JS" This reverts commit 21a1fa84aafd4b4cc2f789c03dbd8fd9dc79bf64. --- config/crawl.js | 4 +++- config/gulp/build.js | 8 ++++---- config/gulp/images.js | 8 +++----- config/gulp/javascript.js | 2 +- js/copy-code.js | 5 +++-- js/scroll-to-top-for-hash.js | 2 +- js/sidenav.js | 2 +- js/start.js | 2 +- 8 files changed, 17 insertions(+), 16 deletions(-) diff --git a/config/crawl.js b/config/crawl.js index 4471dd5353..62f5a935d0 100644 --- a/config/crawl.js +++ b/config/crawl.js @@ -8,7 +8,9 @@ const runServer = require("./static-server"); // These pages incorporate content from other files in other repos, so // they should be considered "second class" by the link checker, and // only emit warnings on 404s rather than errors. -const WARNING_PAGES = ["/documentation/code-guidelines/"]; +const WARNING_PAGES = [ + "/documentation/code-guidelines/" +]; const WARNING = chalk.yellow("Warning"); const ERROR = chalk.red("Error"); diff --git a/config/gulp/build.js b/config/gulp/build.js index dc63776951..07fe2bf370 100644 --- a/config/gulp/build.js +++ b/config/gulp/build.js @@ -15,7 +15,7 @@ const cleanAssets = gulp.parallel( cleanImages, cleanJavascript, cleanStyles, - removeAssetsDir + removeAssetsDir, ); function spawnP(cmd, args, opts) { @@ -57,8 +57,8 @@ function buildUSWDSComponents() { new Error( `${gulpfile} does not exist! You need a newer version of USWDS; ` + `specifically, one that includes the following PR: ` + - `https://github.com/uswds/uswds/pull/2050` - ) + `https://github.com/uswds/uswds/pull/2050`, + ), ); } @@ -68,7 +68,7 @@ function buildUSWDSComponents() { * We need to: install USWDS deps and build components to HTML. */ return spawnP("npm", ["install"], sharedOpts).then(() => - spawnP("npm", ["run", "build:html"], sharedOpts) + spawnP("npm", ["run", "build:html"], sharedOpts), ); } } diff --git a/config/gulp/images.js b/config/gulp/images.js index e547051a2a..24424cc7c2 100644 --- a/config/gulp/images.js +++ b/config/gulp/images.js @@ -5,11 +5,9 @@ var task = "images"; function copyDocImages() { dutil.logMessage(task, "Copying images from img/"); - var stream = gulp - .src("./img/**/*", { - encoding: false, - }) - .pipe(gulp.dest("assets/img")); + var stream = gulp.src("./img/**/*", { + encoding: false, + }).pipe(gulp.dest("assets/img")); return stream; } diff --git a/config/gulp/javascript.js b/config/gulp/javascript.js index 0bcec9dd32..bf21f7f88f 100644 --- a/config/gulp/javascript.js +++ b/config/gulp/javascript.js @@ -31,7 +31,7 @@ function build() { .pipe( rename({ basename: "styleguide", - }) + }), ) .pipe(sourcemaps.write(".")) .pipe(gulp.dest("assets/js")); diff --git a/js/copy-code.js b/js/copy-code.js index 48fb5151b3..a646315689 100644 --- a/js/copy-code.js +++ b/js/copy-code.js @@ -45,8 +45,8 @@ const createCopyButton = () => { }; /** - * Creates a screen reader only div element for success text - * + * Creates a screen reader only div element for success text + * * @return {HTMLDivElement} - A div for screen reader text */ const createSRStatus = () => { @@ -69,6 +69,7 @@ const copyOnClick = (event) => { const labelVisual = copyBtn.querySelector("[aria-hidden]"); const labelSR = btnWrapper.querySelector(SR_STATUS_MESSAGE); + // Set success state copyBtn.classList.add(COPY_BUTTON_SUCCESS_CLASS); labelVisual.textContent = "Copied!"; diff --git a/js/scroll-to-top-for-hash.js b/js/scroll-to-top-for-hash.js index 544e34f8db..b7e977544f 100644 --- a/js/scroll-to-top-for-hash.js +++ b/js/scroll-to-top-for-hash.js @@ -11,7 +11,7 @@ var timeout; * top of the section. This interrupts that and positions section * title correctly. */ -function scrollToTopForHash() { +function scrollToTopForHash () { var hash = window.location.hash.substr(1); var scrollTopPos = hash ? calculateAnchorPosition(hash) : 0; diff --git a/js/sidenav.js b/js/sidenav.js index 22fc72a0f1..ee7a2d8aa7 100644 --- a/js/sidenav.js +++ b/js/sidenav.js @@ -16,7 +16,7 @@ $(".sidenav").on("keydown", "a", function (e) { $(".sidenav").on("click", "a", function (e) { // long url splitting - var hashLocation = $(this).attr("href").split("#")[1]; + var hashLocation = $(this).attr("href").split("#")[ 1 ]; var scrollTopPos = calculateAnchorPosition(hashLocation); //if anchor doesn't exist on the page, or calc fails diff --git a/js/start.js b/js/start.js index a97e437634..cc5470611d 100644 --- a/js/start.js +++ b/js/start.js @@ -10,5 +10,5 @@ require("./copy-code"); var stickyElements = document.getElementsByClassName("sticky"); for (var i = stickyElements.length - 1; i >= 0; i--) { - Stickyfill.add(stickyElements[i]); + Stickyfill.add(stickyElements[ i ]); }