From 87dead8f8e24c3d4c6f7927a956a474861dd6ea8 Mon Sep 17 00:00:00 2001 From: robyngit Date: Thu, 9 May 2024 11:27:19 -0400 Subject: [PATCH] Add & configure prettier; fix syntax errors pre-format - Initial prettier setup; do not format yet - Fix syntax errors in files that would prevent prettier from formatting them Issue #2096 --- .github/FUNDING.yml | 2 +- .prettierignore | 8 ++ .prettierrc | 19 +++ package-lock.json | 174 ++++++++++++++++++++++-- package.json | 8 +- src/css/metacatui-common.css | 4 - src/js/themes/default/css/metacatui.css | 2 +- 7 files changed, 195 insertions(+), 22 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6a8d51715..1d0eec770 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: ['https://giving.ucsb.edu/Funds/Give?id=353] +custom: ['https://giving.ucsb.edu/Funds/Give?id=353'] diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..ada4c118f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +# Prettier doesn't format underscore.js templates correctly +src/**/*.html +# Don't modify third-party code +src/components +# docs/docs is auto-generated +docs/docs +# Ignore any minimized files +**/*.min.* \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..9982ea82c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,19 @@ +{ + "plugins": [ + "@shopify/prettier-plugin-liquid" + ], + "overrides": [ + { + "files": "docs/_includes/*.html", + "options": { + "parser": "liquid-html" + } + }, + { + "files": "docs/_layouts/*.html", + "options": { + "parser": "liquid-html" + } + } + ] +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 3f9fd99e9..ab160d038 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,10 +18,12 @@ "devDependencies": { "@jsdoc/salty": "^0.2.3", "@jsdoc/util": "^0.2.4", + "@shopify/prettier-plugin-liquid": "^1.5.0", "code-prettify": "^0.1.0", "common-path-prefix": "^3.0.0", "jsdoc": "^4.0.0", - "open-sans-fonts": "^1.6.2" + "open-sans-fonts": "^1.6.2", + "prettier": "^3.2.5" } }, "node_modules/@actions/core": { @@ -79,6 +81,29 @@ "node": ">=v14.17.6" } }, + "node_modules/@shopify/liquid-html-parser": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@shopify/liquid-html-parser/-/liquid-html-parser-2.0.3.tgz", + "integrity": "sha512-aIkZ5TJWG7/ztd1sZm5XNpBNTG3B+Q0gv3WN/QahmNQzm2wmKYSHiRLOA8JALAnOGTmH0uqOJ7jzdqoATcZSxw==", + "dev": true, + "dependencies": { + "line-column": "^1.0.2", + "ohm-js": "^16.3.0" + } + }, + "node_modules/@shopify/prettier-plugin-liquid": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@shopify/prettier-plugin-liquid/-/prettier-plugin-liquid-1.5.0.tgz", + "integrity": "sha512-CuWjUnBCvq/RTmubEa5RfwW2oP2gYfTXaJ39t4apAYm//1v5Ftvv1bbhEnoEZwCjPshaAJLhSzP9dvCel4cebw==", + "dev": true, + "dependencies": { + "@shopify/liquid-html-parser": "^2.0.3", + "html-styles": "^1.0.0" + }, + "peerDependencies": { + "prettier": "^2.0.0 || ^3.0.0" + } + }, "node_modules/@sindresorhus/is": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", @@ -931,6 +956,14 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, "node_modules/has-property-descriptors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", @@ -953,14 +986,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -983,6 +1008,12 @@ "node": ">= 0.4" } }, + "node_modules/html-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/html-styles/-/html-styles-1.0.0.tgz", + "integrity": "sha512-cDl5dcj73oI4Hy0DSUNh54CAwslNLJRCCoO+RNkVo+sBrjA/0+7E/xzvj3zH/GxbbBLGJhE0hBe1eg+0FINC6w==", + "dev": true + }, "node_modules/htmlparser2": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz", @@ -1089,6 +1120,24 @@ "node": ">=8" } }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "node_modules/isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==", + "dev": true, + "dependencies": { + "isarray": "1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/js2xmlparser": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", @@ -1150,6 +1199,16 @@ "graceful-fs": "^4.1.11" } }, + "node_modules/line-column": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/line-column/-/line-column-1.0.2.tgz", + "integrity": "sha512-Ktrjk5noGYlHsVnYWh62FLVs4hTb8A3e+vucNZMgPeAOITdshMSgv4cCZQeRDjm7+goqmo6+liZwTXo+U3sVww==", + "dev": true, + "dependencies": { + "isarray": "^1.0.0", + "isobject": "^2.0.0" + } + }, "node_modules/linkify-it": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", @@ -1376,6 +1435,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ohm-js": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/ohm-js/-/ohm-js-16.6.0.tgz", + "integrity": "sha512-X9P4koSGa7swgVQ0gt71UCYtkAQGOjciJPJAz74kDxWt8nXbH5HrDOQG6qBDH7SR40ktNv4x61BwpTDE9q4lRA==", + "dev": true, + "engines": { + "node": ">=0.12.1" + } + }, "node_modules/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -1523,6 +1591,21 @@ "node": ">=8" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", @@ -2081,6 +2164,26 @@ "ow": "^0.27.0" } }, + "@shopify/liquid-html-parser": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@shopify/liquid-html-parser/-/liquid-html-parser-2.0.3.tgz", + "integrity": "sha512-aIkZ5TJWG7/ztd1sZm5XNpBNTG3B+Q0gv3WN/QahmNQzm2wmKYSHiRLOA8JALAnOGTmH0uqOJ7jzdqoATcZSxw==", + "dev": true, + "requires": { + "line-column": "^1.0.2", + "ohm-js": "^16.3.0" + } + }, + "@shopify/prettier-plugin-liquid": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@shopify/prettier-plugin-liquid/-/prettier-plugin-liquid-1.5.0.tgz", + "integrity": "sha512-CuWjUnBCvq/RTmubEa5RfwW2oP2gYfTXaJ39t4apAYm//1v5Ftvv1bbhEnoEZwCjPshaAJLhSzP9dvCel4cebw==", + "dev": true, + "requires": { + "@shopify/liquid-html-parser": "^2.0.3", + "html-styles": "^1.0.0" + } + }, "@sindresorhus/is": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", @@ -2735,6 +2838,11 @@ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, "has-property-descriptors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", @@ -2748,11 +2856,6 @@ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==" }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" - }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -2766,6 +2869,12 @@ "function-bind": "^1.1.2" } }, + "html-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/html-styles/-/html-styles-1.0.0.tgz", + "integrity": "sha512-cDl5dcj73oI4Hy0DSUNh54CAwslNLJRCCoO+RNkVo+sBrjA/0+7E/xzvj3zH/GxbbBLGJhE0hBe1eg+0FINC6w==", + "dev": true + }, "htmlparser2": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz", @@ -2836,6 +2945,21 @@ "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, "js2xmlparser": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", @@ -2891,6 +3015,16 @@ "graceful-fs": "^4.1.11" } }, + "line-column": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/line-column/-/line-column-1.0.2.tgz", + "integrity": "sha512-Ktrjk5noGYlHsVnYWh62FLVs4hTb8A3e+vucNZMgPeAOITdshMSgv4cCZQeRDjm7+goqmo6+liZwTXo+U3sVww==", + "dev": true, + "requires": { + "isarray": "^1.0.0", + "isobject": "^2.0.0" + } + }, "linkify-it": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", @@ -3059,6 +3193,12 @@ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==" }, + "ohm-js": { + "version": "16.6.0", + "resolved": "https://registry.npmjs.org/ohm-js/-/ohm-js-16.6.0.tgz", + "integrity": "sha512-X9P4koSGa7swgVQ0gt71UCYtkAQGOjciJPJAz74kDxWt8nXbH5HrDOQG6qBDH7SR40ktNv4x61BwpTDE9q4lRA==", + "dev": true + }, "on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -3166,6 +3306,12 @@ "find-up": "^4.0.0" } }, + "prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true + }, "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", diff --git a/package.json b/package.json index e0ec01f32..2da7b6348 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,12 @@ "devDependencies": { "@jsdoc/salty": "^0.2.3", "@jsdoc/util": "^0.2.4", + "@shopify/prettier-plugin-liquid": "^1.5.0", "code-prettify": "^0.1.0", "common-path-prefix": "^3.0.0", "jsdoc": "^4.0.0", - "open-sans-fonts": "^1.6.2" + "open-sans-fonts": "^1.6.2", + "prettier": "^3.2.5" }, "scripts": { "dev": "node server.js", @@ -25,7 +27,9 @@ "doc": "cd docs; bundle exec jekyll serve", "test": "node test/server.js", "integration-test": "node test/server.js integration", - "view-tests": "node test/server.js keep-running" + "view-tests": "node test/server.js keep-running", + "format": "prettier --write .", + "format-check": "prettier --check ." }, "repository": { "type": "git", diff --git a/src/css/metacatui-common.css b/src/css/metacatui-common.css index 55b684fd7..f563d1f65 100644 --- a/src/css/metacatui-common.css +++ b/src/css/metacatui-common.css @@ -8040,10 +8040,6 @@ ul.side-nav-items { margin-left: -5px; margin-right: 5px; } - border: none; - background-color: inherit; - width: auto; -} /* Editor package table button dropdown */ .Editor #data-package-table td:last-of-type ul { diff --git a/src/js/themes/default/css/metacatui.css b/src/js/themes/default/css/metacatui.css index 4ae3b9101..8af226ecb 100644 --- a/src/js/themes/default/css/metacatui.css +++ b/src/js/themes/default/css/metacatui.css @@ -1398,7 +1398,7 @@ padding-left: 0px; content: "Datasets "; } #statcounts{ - float: left;s + float: left; } .sort-by{ float: right;