From 694b58ead1c89d5ac48e5d19b92dffcf62913c35 Mon Sep 17 00:00:00 2001 From: TimRudy <3942818+TimRudy@users.noreply.github.com> Date: Fri, 31 Jan 2025 14:20:19 -0500 Subject: [PATCH 1/2] Add prettier - first batch, .htmls - also remove some unused dependencies in .js --- .github/workflows/prettier-pr.yml | 54 ++ .jshintrc | 48 +- .prettierignore | 6 + .prettierrc | 4 + Gruntfile.js | 5 +- app/index.html | 891 +++++++++--------- app/package.json | 4 +- .../collectionManager2/collectionManager.html | 28 +- .../plugins/collectionManager2/manifest.json | 55 +- .../plugins/example-plugin/index.html | 72 +- .../plugins/example-plugin/manifest.json | 10 +- app/resources/plugins/icerok/index.html | 84 +- app/resources/plugins/icerok/manifest.json | 12 +- app/resources/plugins/launchBar/launchBar.js | 6 +- app/resources/plugins/launchBar/mainBar.html | 2 +- app/resources/plugins/launchBar/manifest.json | 30 +- .../plugins/launchBar/views/plugin-list.html | 6 +- app/resources/viewers/markdown/js/readme.js | 43 +- app/resources/viewers/markdown/readme.html | 12 +- app/resources/viewers/plain/output.html | 21 +- app/resources/viewers/plain/pcf.html | 22 +- app/resources/viewers/svg/pinout.html | 20 +- app/resources/viewers/system/js/system.js | 123 +-- app/resources/viewers/system/system.html | 43 +- app/resources/viewers/table/rules.html | 47 +- app/scripts/services/collections.js | 18 +- app/scripts/services/compiler.js | 12 +- app/scripts/services/drivers.js | 25 +- app/scripts/services/utils.js | 1 - app/views/advanced.html | 26 +- app/views/languages.html | 92 +- app/views/menu.html | 725 ++++++++------ app/views/uithemes.html | 12 +- app/views/version.html | 135 +-- package.json | 6 +- 35 files changed, 1519 insertions(+), 1181 deletions(-) create mode 100644 .github/workflows/prettier-pr.yml create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.github/workflows/prettier-pr.yml b/.github/workflows/prettier-pr.yml new file mode 100644 index 000000000..b27a68e9c --- /dev/null +++ b/.github/workflows/prettier-pr.yml @@ -0,0 +1,54 @@ +name: Prettier hook for PRs + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + branches: [develop, master] + push: + branches: [develop, master] + +jobs: + ci-pr: + # Run on any change from PR or direct push, but don't run on a cancel PR + if: github.event_name != 'pull_request' || ( + github.event.action == 'opened' || + github.event.action == 'synchronize' || + github.event.action == 'reopened' && github.event.before != github.event.after || + github.event.action == 'closed' && github.event.pull_request.merged == true + ) + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "latest" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Confirm code format + run: npm prettier + + - name: Commit changes + run: | + git config --global user.name "maria[bot]" + git config --global user.email "maria[bot]@users.noreply.github.com" + git add . + git commit -m "Auto-format code with prettier" || echo "No changes to commit" + git push + + ci-close-pr: + # Run on a cancel PR + if: github.event_name == 'pull_request' && github.event.pull_request.merged == false + + runs-on: ubuntu-latest + + steps: + - name: Just report closed, nothing to do + run: | + echo PR #${{ github.event.number }} has been closed, not merged diff --git a/.jshintrc b/.jshintrc index 045136980..3a8941c3c 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,6 +1,6 @@ { - "esversion": 11, - "node": true, + "esversion": 11, + "node": true, "browser": true, "bitwise": true, "camelcase": true, @@ -21,27 +21,27 @@ "-W069": true, "-W083": true, "-W084": true, - "globals": { - "iceStudio":false, - "Icestudio":false, - "iceStudioReady":false, - "domCache":false, - "iprof":false, - "IceProfiler":false, - "IceBlock":false, - "subModuleActive":false, - "ICEpm":false, - "IcePlugManager":false, - "iceConsole":false, - "IceLogger":false, - "IceEventBus":false, - "IceTemplateSystem":false, - "IceParametricHelper":false, - "Mustache":false, - "jexcel":false, - "nw":false, - "Snap":false, - "mina":false, + "globals": { + "iceStudio": false, + "Icestudio": false, + "iceStudioReady": false, + "domCache": false, + "iprof": false, + "IceProfiler": false, + "IceBlock": false, + "subModuleActive": false, + "ICEpm": false, + "IcePlugManager": false, + "iceConsole": false, + "IceLogger": false, + "IceEventBus": false, + "IceTemplateSystem": false, + "IceParametricHelper": false, + "Mustache": false, + "jexcel": false, + "nw": false, + "Snap": false, + "mina": false, "$": false, "angular": false, "console": false, @@ -55,7 +55,7 @@ "ace": false, "g": false, "V": false, - "IceCollection":false, + "IceCollection": false, "IceHD": false, "WafleModal": false } diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..46d7aba94 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +resources/libs/vendor/ +resources/fonts/ +*.md +icerok/vendor/sweetalert2.min.js +icerok/css/*.min.css +Gruntfile.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..30b4336be --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "quoteProps": "consistent", + "trailingComma": "es5" +} diff --git a/Gruntfile.js b/Gruntfile.js index e217ce3df..2af3eb5fc 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -824,7 +824,7 @@ module.exports = function (grunt) { }, //-- Download NWjs for ARM arquitecture, as it is not part of the - //-- oficial NWjs project + //-- official NWjs project //-- It is downloaded during the ARM build process //-- Only ARM nwjsAarch64: { @@ -1234,8 +1234,7 @@ module.exports = function (grunt) { path: MAC_EXEC_FILE, }, ], - /* -- For code oficial packages of Icestudio, for developers maintain commented - + /* -- For code official packages of Icestudio, for developers maintain commented "code-sign": { "signing-identity": "XXXX", } diff --git a/app/index.html b/app/index.html index 2ddfed62f..fbadf9665 100644 --- a/app/index.html +++ b/app/index.html @@ -1,79 +1,80 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+