From fe77ede49ed6a1d3e885d6bb2a42a40fcf23f480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Koral?= <45078678+oguzhankoral@users.noreply.github.com> Date: Wed, 14 May 2025 10:05:51 +0300 Subject: [PATCH] feat: introduce CI linting & fix various issues (#5) * introduce CI checks * fixx * add caching * fixes * wip * server bridge linting * No lint errors * fix paths on lint:prettier * make files pretty again * fix stylelint * fix lock --------- Co-authored-by: Kristaps Fabians Geikins --- .eslintcache | 1 - .github/workflows/pr-ci.yml | 44 + .prettierignore | 35 + .prettierrc | 11 + .vscode/extensions.json | 32 +- .yarnrc.yml | 2 +- app.vue | 1 - assets/css/tailwind.css | 3 +- components/accounts/Item.vue | 2 +- components/automate/CreateDialog.vue | 7 +- components/common/Dialog.vue | 1 + components/common/ModelNotification.vue | 22 +- components/filter/Selection.vue | 2 +- components/model/CardBase.vue | 6 +- components/report/Item.vue | 2 +- components/wizard/ProjectSelector.vue | 20 +- components/wizard/WorkspaceSelector.vue | 11 +- components/wizard/list/VersionCard.vue | 2 +- eslint.config.mjs | 60 +- lib/accounts/composables/setup.ts | 136 -- lib/bindings/definitions/IAccountBinding.ts | 5 +- lib/bindings/definitions/IReceiveBinding.ts | 2 +- lib/bindings/definitions/ISendBinding.ts | 2 +- lib/bridge/generic-v2.ts | 156 -- lib/bridge/generic.ts | 124 +- lib/bridge/server.ts | 8 +- lib/bridge/sketchup.ts | 4 +- lib/models/card.ts | 6 +- lib/models/card/notification.ts | 6 +- nuxt.config.ts | 1 + package.json | 17 +- pages/test.vue | 2 +- plugins/00.bindings.ts | 2 +- store/accounts.ts | 5 +- store/config.ts | 2 +- store/hostApp.ts | 11 +- stylelint.config.js | 8 +- tailwind.config.mjs | 2 +- yarn.lock | 1927 ++++++++----------- 39 files changed, 1127 insertions(+), 1563 deletions(-) delete mode 100644 .eslintcache create mode 100644 .github/workflows/pr-ci.yml create mode 100644 .prettierignore create mode 100644 .prettierrc delete mode 100644 lib/accounts/composables/setup.ts delete mode 100644 lib/bridge/generic-v2.ts diff --git a/.eslintcache b/.eslintcache deleted file mode 100644 index e06b005..0000000 --- a/.eslintcache +++ /dev/null @@ -1 +0,0 @@ -[{"/home/fabis/Code/speckle/speckle-server/packages/dui3/components/header/UserAccount.vue":"1","/home/fabis/Code/speckle/speckle-server/packages/dui3/components/header/UserMenu.vue":"2","/home/fabis/Code/speckle/speckle-server/packages/dui3/eslint.config.mjs":"3","/home/fabis/Code/speckle/speckle-server/packages/dui3/lib/accounts/composables/setup.ts":"4","/home/fabis/Code/speckle/speckle-server/packages/dui3/lib/bridge/sketchup.ts":"5","/home/fabis/Code/speckle/speckle-server/packages/dui3/lib/core/configs/apollo.ts":"6","/home/fabis/Code/speckle/speckle-server/packages/dui3/nuxt.config.ts":"7","/home/fabis/Code/speckle/speckle-server/packages/dui3/pages/test.vue":"8","/home/fabis/Code/speckle/speckle-server/packages/dui3/store/documentInfo.ts":"9","/home/fabis/Code/speckle/speckle-server/packages/dui3/store/uiConfig.ts":"10"},{"size":1778,"mtime":1746791265927,"results":"11","hashOfConfig":"12"},{"size":4013,"mtime":1746792386391,"results":"13","hashOfConfig":"12"},{"size":3414,"mtime":1746791026344,"results":"14","hashOfConfig":"15"},{"size":4189,"mtime":1746793749374,"results":"16","hashOfConfig":"17"},{"size":5468,"mtime":1746791768634,"results":"18","hashOfConfig":"17"},{"size":10366,"mtime":1746793776685,"results":"19","hashOfConfig":"17"},{"size":2192,"mtime":1746792232360,"results":"20","hashOfConfig":"17"},{"size":4278,"mtime":1746792415762,"results":"21","hashOfConfig":"22"},{"size":680,"mtime":1746791283346,"results":"23","hashOfConfig":"17"},{"size":878,"mtime":1746791257987,"results":"24","hashOfConfig":"17"},{"filePath":"25","messages":"26","suppressedMessages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"x0whug",{"filePath":"28","messages":"29","suppressedMessages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","suppressedMessages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"xgr6d3",{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"14esv3d",{"filePath":"37","messages":"38","suppressedMessages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","suppressedMessages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"43","messages":"44","suppressedMessages":"45","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"46","messages":"47","suppressedMessages":"48","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"1qmr9kz",{"filePath":"49","messages":"50","suppressedMessages":"51","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"52","messages":"53","suppressedMessages":"54","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/home/fabis/Code/speckle/speckle-server/packages/dui3/components/header/UserAccount.vue",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/components/header/UserMenu.vue",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/eslint.config.mjs",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/lib/accounts/composables/setup.ts",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/lib/bridge/sketchup.ts",[],["55","56","57","58"],"/home/fabis/Code/speckle/speckle-server/packages/dui3/lib/core/configs/apollo.ts",[],["59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78"],"/home/fabis/Code/speckle/speckle-server/packages/dui3/nuxt.config.ts",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/pages/test.vue",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/store/documentInfo.ts",[],[],"/home/fabis/Code/speckle/speckle-server/packages/dui3/store/uiConfig.ts",[],[],{"ruleId":"79","severity":2,"message":"80","line":109,"column":7,"nodeType":"81","messageId":"82","endLine":109,"endColumn":17,"suppressions":"83"},{"ruleId":"79","severity":2,"message":"84","line":111,"column":7,"nodeType":"81","messageId":"82","endLine":111,"endColumn":19,"suppressions":"85"},{"ruleId":"86","severity":2,"message":"87","line":137,"column":24,"nodeType":"88","messageId":"89","endLine":137,"endColumn":38,"suggestions":"90","suppressions":"91"},{"ruleId":"92","severity":2,"message":"93","line":157,"column":5,"nodeType":"88","messageId":"94","endLine":159,"endColumn":6,"suppressions":"95"},{"ruleId":"96","severity":2,"message":"97","line":45,"column":65,"nodeType":"98","messageId":"99","endLine":45,"endColumn":76,"suppressions":"100"},{"ruleId":"101","severity":2,"message":"102","line":48,"column":15,"nodeType":"103","messageId":"104","endLine":48,"endColumn":30,"suppressions":"105"},{"ruleId":"101","severity":2,"message":"102","line":53,"column":15,"nodeType":"103","messageId":"104","endLine":53,"endColumn":54,"suppressions":"106"},{"ruleId":"96","severity":2,"message":"97","line":57,"column":58,"nodeType":"98","messageId":"99","endLine":57,"endColumn":69,"suppressions":"107"},{"ruleId":"101","severity":2,"message":"102","line":60,"column":15,"nodeType":"103","messageId":"104","endLine":60,"endColumn":30,"suppressions":"108"},{"ruleId":"96","severity":2,"message":"97","line":66,"column":58,"nodeType":"98","messageId":"99","endLine":66,"endColumn":69,"suppressions":"109"},{"ruleId":"101","severity":2,"message":"102","line":69,"column":15,"nodeType":"103","messageId":"104","endLine":69,"endColumn":30,"suppressions":"110"},{"ruleId":"96","severity":2,"message":"97","line":75,"column":60,"nodeType":"98","messageId":"99","endLine":75,"endColumn":71,"suppressions":"111"},{"ruleId":"101","severity":2,"message":"102","line":78,"column":15,"nodeType":"103","messageId":"104","endLine":78,"endColumn":30,"suppressions":"112"},{"ruleId":"96","severity":2,"message":"97","line":90,"column":61,"nodeType":"98","messageId":"99","endLine":90,"endColumn":72,"suppressions":"113"},{"ruleId":"101","severity":2,"message":"102","line":93,"column":15,"nodeType":"103","messageId":"104","endLine":93,"endColumn":30,"suppressions":"114"},{"ruleId":"101","severity":2,"message":"115","line":152,"column":45,"nodeType":"116","messageId":"104","endLine":152,"endColumn":58,"suppressions":"117"},{"ruleId":"96","severity":2,"message":"118","line":152,"column":46,"nodeType":"119","messageId":"120","endLine":152,"endColumn":57,"suppressions":"121"},{"ruleId":"96","severity":2,"message":"97","line":157,"column":59,"nodeType":"98","messageId":"99","endLine":157,"endColumn":70,"suppressions":"122"},{"ruleId":"101","severity":2,"message":"102","line":160,"column":15,"nodeType":"103","messageId":"104","endLine":160,"endColumn":30,"suppressions":"123"},{"ruleId":"101","severity":2,"message":"102","line":164,"column":45,"nodeType":"81","messageId":"104","endLine":164,"endColumn":53,"suppressions":"124"},{"ruleId":"101","severity":2,"message":"102","line":167,"column":45,"nodeType":"81","messageId":"104","endLine":167,"endColumn":53,"suppressions":"125"},{"ruleId":"101","severity":2,"message":"102","line":170,"column":45,"nodeType":"81","messageId":"104","endLine":170,"endColumn":53,"suppressions":"126"},{"ruleId":"101","severity":2,"message":"102","line":181,"column":45,"nodeType":"81","messageId":"104","endLine":181,"endColumn":53,"suppressions":"127"},{"ruleId":"96","severity":2,"message":"97","line":273,"column":7,"nodeType":"98","messageId":"99","endLine":276,"endColumn":8,"suppressions":"128"},"camelcase","Identifier 'request_id' is not in camel case.","Identifier","notCamelCase",["129"],"Identifier 'binding_name' is not in camel case.",["130"],"no-prototype-builtins","Do not access Object.prototype method 'hasOwnProperty' from target object.","CallExpression","prototypeBuildIn",["131"],["132"],"no-alert","Unexpected alert.","unexpected",["133"],"@typescript-eslint/no-unsafe-assignment","Unsafe assignment of an `any` value.","Property","anyAssignment",["134"],"@typescript-eslint/no-unsafe-return","Unsafe return of a value of type `any`.","ReturnStatement","unsafeReturn",["135"],["136"],["137"],["138"],["139"],["140"],["141"],["142"],["143"],["144"],"Unsafe return of a value of type `any[]`.","ArrayExpression",["145"],"Unsafe spread of an `any` value in an array.","SpreadElement","unsafeArraySpread",["146"],["147"],["148"],["149"],["150"],["151"],["152"],["153"],{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"messageId":"156","data":"157","fix":"158","desc":"159"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},{"kind":"154","justification":"155"},"directive","","callObjectPrototype",{"prop":"160"},{"range":"161","text":"162"},"Call Object.prototype.hasOwnProperty explicitly.","hasOwnProperty",[4763,4783],"Object.prototype.hasOwnProperty.call(data, "] \ No newline at end of file diff --git a/.github/workflows/pr-ci.yml b/.github/workflows/pr-ci.yml new file mode 100644 index 0000000..716a4b8 --- /dev/null +++ b/.github/workflows/pr-ci.yml @@ -0,0 +1,44 @@ +name: Linting + +on: + pull_request: + branches: + - main + +jobs: + lint-and-build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.14.0' + + - name: Enable Corepack and Install Correct Yarn Version + run: | + corepack enable + corepack prepare yarn@$(jq -r .packageManager package.json | cut -d'@' -f2) --activate + yarn --version + + - name: Cache node_modules + uses: actions/cache@v4 + with: + path: | + **/node_modules + .yarn/cache + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install Dependencies + run: yarn install --immutable + + - name: Run Linter + run: yarn lint + + - name: Run generate + run: yarn generate diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..a7411b1 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,35 @@ +node_modules +build +dist +dist2 +dist-* +coverage +.nyc_output + +.output +.nuxt +**/nuxt-modules/**/templates/*.js +/lib/common/generated/**/* + +package-lock.json +yarn.lock +.yarn + +# Profiler output +events.json + +# Prettier doesn't understand the syntax inside the Yaml files, because of the brackets +utils/helm/speckle-server/templates + +# Optional eslint cache +.eslintcache +.venv +venv + +.*.{ts,js,vue,tsx,jsx} +**/generated/**/* +**/generated/graphql.ts + +storybook-static +.tshy +.tshy-build \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..1a1ea1a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "trailingComma": "none", + "tabWidth": 2, + "semi": false, + "endOfLine": "auto", + "bracketSpacing": true, + "vueIndentScriptAndStyle": false, + "htmlWhitespaceSensitivity": "ignore", + "printWidth": 88, + "singleQuote": true +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0582491..46d9c50 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,18 +1,18 @@ { - // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - // List of extensions which should be recommended for users of this workspace. - "recommendations": [ - "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode", - "Vue.volar", - "bradlc.vscode-tailwindcss", - "stylelint.vscode-stylelint", - "cpylua.language-postcss", - "graphql.vscode-graphql", - "graphql.vscode-graphql-syntax" - ], - // List of extensions recommended by VS Code that should not be recommended for users of this workspace. - "unwantedRecommendations": ["octref.vetur"] -} \ No newline at end of file + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "Vue.volar", + "bradlc.vscode-tailwindcss", + "stylelint.vscode-stylelint", + "cpylua.language-postcss", + "graphql.vscode-graphql", + "graphql.vscode-graphql-syntax" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": ["octref.vetur"] +} diff --git a/.yarnrc.yml b/.yarnrc.yml index 8b757b2..3186f3f 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1 @@ -nodeLinker: node-modules \ No newline at end of file +nodeLinker: node-modules diff --git a/app.vue b/app.vue index 54723b2..b701b25 100644 --- a/app.vue +++ b/app.vue @@ -52,4 +52,3 @@ onMounted(() => { }) }) - diff --git a/assets/css/tailwind.css b/assets/css/tailwind.css index 98adc61..4930a31 100644 --- a/assets/css/tailwind.css +++ b/assets/css/tailwind.css @@ -1,5 +1,6 @@ /* stylelint-disable selector-id-pattern */ -@import '@speckle/ui-components/style.css'; +@import url('@speckle/ui-components/style.css'); + @tailwind base; @tailwind components; @tailwind utilities; diff --git a/components/accounts/Item.vue b/components/accounts/Item.vue index 1a6754d..5929b07 100644 --- a/components/accounts/Item.vue +++ b/components/accounts/Item.vue @@ -60,7 +60,7 @@