Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2c310aa
ESLINT: fix vue/singleline-html-element-content-newline
0oM4R May 27, 2025
ef0b0a8
ESLINT: fix vue/attributes-order
0oM4R May 27, 2025
a7cfee8
ESLINT: fix vue/html-self-closing
0oM4R May 27, 2025
616c9c1
fix: vue/attribute-hyphenation
0oM4R May 27, 2025
4c7a8c1
ESLINT: ignore multi-word-component for old components
0oM4R May 27, 2025
d373e51
eslint: vue/no-template-shadow
0oM4R May 27, 2025
b874d1d
eslint: update rules
0oM4R May 27, 2025
f4e654e
eslint: apply vue/multiline-html-element-content-newline
0oM4R May 28, 2025
c48b002
eslint fix no-unused-vars
0oM4R May 28, 2025
5c4e20e
eslint fix no-unused-vars
0oM4R May 28, 2025
cd6e924
eslint fix no-unused-vars
0oM4R May 28, 2025
cb10c39
eslint fix vue/component-definition-name-casing
0oM4R May 28, 2025
2628127
eslint fix vue/html-closing-bracket-newline
0oM4R May 28, 2025
d9cf9ca
eslint: apply simple sort import
0oM4R May 28, 2025
6f61993
apply eslint fix
0oM4R May 28, 2025
ea73ee9
apply eslint fix unused var
0oM4R May 28, 2025
94de2f7
apply eslint fix
0oM4R May 28, 2025
c0a9d8e
chore: reorganize eslint rules into off/warn/error categories and upd…
0oM4R May 28, 2025
b16aca2
eslint ignore prefer-spread
0oM4R May 28, 2025
7287f00
merge development
0oM4R May 29, 2025
7c17176
fix: correct casing in SelectedNode property references to selectedNode
0oM4R May 29, 2025
c6dea3a
chore: clean up eslint rules and add ngx global declaration
0oM4R May 29, 2025
6b674de
Merge branch 'development' into development_eslint
0oM4R Jun 1, 2025
85cf78f
merge development
0oM4R Jun 2, 2025
a0afc12
refactor: rename props to slotProps in template activator slots and r…
0oM4R Jun 2, 2025
4a46779
merge development
0oM4R Jun 3, 2025
9d24475
Merge branch 'development' of github.com:threefoldtech/tfgrid-sdk-ts …
0oM4R Jun 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 31 additions & 11 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,29 @@ import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescri
// This returns an ARRAY of config objects optimized for Vue+TS
const vueTsGeneratedConfigs = defineConfigWithVueTs(pluginVue.configs["flat/recommended"], vueTsConfigs.recommended, {
rules: {
"@typescript-eslint/no-explicit-any": "warn",
"vue/multi-word-component-names": "warn",
// --- OFF rules ---
// TODO: enable this rule after https://github.com/threefoldtech/tfgrid-sdk-ts/issues/4075
"@typescript-eslint/no-explicit-any": "off",
"vue/no-v-text-v-html-on-component": "off",
"@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/no-unused-vars": `warn`,
"vue/max-attributes-per-line": "off",
"vue/no-v-html": "off",
"vue/singleline-html-element-content-newline": "off",
"vue/html-self-closing": "off",
"vue/html-indent": "off",
"vue/require-explicit-emits": "off",
"vue/require-default-prop": "off",
"@typescript-eslint/no-unused-expressions": "off",

// --- WARN rules ---
"@typescript-eslint/no-duplicate-enum-values": "warn",
"vue/no-dupe-keys": "warn",

// --- ERROR rules ---
"vue/multi-word-component-names": "error",
"@typescript-eslint/no-unused-vars": "error",
"vue/no-template-shadow": "error",
"vue/multiline-html-element-content-newline": "error",
"vue/component-definition-name-casing": "error",
"vue/no-dupe-keys": "error",
},
});

Expand Down Expand Up @@ -62,23 +78,24 @@ export default [
},
rules: {
...tseslint.configs.eslintRecommended.rules,
"@typescript-eslint/no-unused-vars": "warn",

// --- OFF rules ---
"no-console": "off",
"prettier/prettier": "warn",
"simple-import-sort/imports": "warn",

"@typescript-eslint/no-var-requires": "off",
// TODO: enable this rule after https://github.com/threefoldtech/tfgrid-sdk-ts/issues/4075
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-empty-object-type": "off",

// --- WARN rules ---
"prettier/prettier": "warn",
"prefer-spread": "warn",
"@typescript-eslint/no-restricted-types": [
"warn",
{
types: {
"{}": "Use `unknown` instead.",
"Function": "Use specific function types instead.",
"Object": "Use `Record<string, unknown>` or specific object types instead.",
"String": "Use `string` instead.",
Expand All @@ -87,9 +104,12 @@ export default [
},
},
],
"@typescript-eslint/no-empty-object-type": "warn",
"@typescript-eslint/no-unsafe-function-type": "warn",
"@typescript-eslint/no-wrapper-object-types": "warn",

// --- ERROR rules ---
"@typescript-eslint/no-unused-vars": "error",
"simple-import-sort/imports": "error",
},
},
...vueConfig,
Expand Down
11 changes: 7 additions & 4 deletions packages/graphql_client/src/clients/abstract_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ export abstract class AbstractClient {

private static normalizeFields<T>(fields: PartialBoolean<T>): string {
return Object.entries(fields)
.reduce((out, [key, value]: any) => {
out.push(value === true ? key : `${key}{${AbstractClient.normalizeFields(value)}}`);
return out;
}, <string[]>[])
.reduce(
(out, [key, value]: any) => {
out.push(value === true ? key : `${key}{${AbstractClient.normalizeFields(value)}}`);
return out;
},
<string[]>[],
)
.join(",");
}
}
Expand Down
17 changes: 9 additions & 8 deletions packages/graphql_client/src/clients/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class TFGridGqlClient extends AbstractClient {
public merge<T extends MergableQuery>(queries: T) {
const options: RequestOptions[] = [];
for (const query in queries) {
// eslint-disable-next-line prefer-spread
options.push(this[`__${query}` as any].apply(this, queries[query]));
}

Expand Down Expand Up @@ -68,14 +69,14 @@ type NormalizeMerge<T> = {
? Q[]
: unknown
: K extends keyof ByIdQueries
? ReturnType<ByIdQueries[K]> extends Promise<infer Q>
? Q
: unknown
: K extends keyof ConnectionQueries
? ReturnType<ConnectionQueries[K]> extends Promise<infer Q>
? Q
: unknown
: unknown;
? ReturnType<ByIdQueries[K]> extends Promise<infer Q>
? Q
: unknown
: K extends keyof ConnectionQueries
? ReturnType<ConnectionQueries[K]> extends Promise<infer Q>
? Q
: unknown
: unknown;
};

export interface TFGridGqlClient extends ListQueries, ByIdQueries, ConnectionQueries {}
Expand Down
1 change: 0 additions & 1 deletion packages/graphql_client/src/clients/list_queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
Account,
ArrayWhere,
BaseWhere,
BigInt,
BoolWhere,
BurnTransaction,
City,
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql_client/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export type PartialBoolean<T> = {
? PartialBoolean<Q>
: true
: T[K] extends object
? PartialBoolean<T[K]>
: true;
? PartialBoolean<T[K]>
: true;
};

type __BaseWhere<T> = { eq: T; not_eq: T; gt: T; gte: T; lt: T; lte: T; in: T[]; not_in: T[]; }; // prettier-ignore
Expand Down
3 changes: 0 additions & 3 deletions packages/graphql_client/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { ValidationError } from "@threefold/types";
type AssertReturn = void | never;
function panic(message: string): never {
throw new Error(message);
}

/**
* @description
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/algorand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function getDeployment(client, vms) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms) {
const resultVM = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/casperlabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/discourse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/funkwhale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/gitea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/jenkins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/jitsi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/mattermost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/nextcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/nodepilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function getDeployment(client, vms) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms) {
const resultVM = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/nostr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function getDeployment(client: GridClient, name: string, subdomain: string
log("================= Getting Gateway Deployment =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client: GridClient, name: string, subdomain: string) {
// Cancel VM deployment
const resultVM = await client.machines.delete({ name });
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/peertube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/presearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function getDeployment(client, vms) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms) {
const resultVM = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/subsquid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/taiga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/umbrel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function getDeployment(client, vms) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms) {
const resultVM = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/applications/wordpress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async function getDeployment(client, vms, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms, gw) {
const resultVM = await client.machines.delete(vms);
const resultGateway = await client.gateway.delete_name(gw);
Expand Down
2 changes: 1 addition & 1 deletion packages/grid_client/scripts/compare_locked_balance.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import TFGridGqlClient from "@threefold/graphql_client";
import { ContractState } from "@threefold/gridproxy_client";

import { BalanceGetModel, GridClient } from "../src";
import { GridClient } from "../src";
import { getClient } from "./client_loader";

interface Contract {
Expand Down
22 changes: 14 additions & 8 deletions packages/grid_client/scripts/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ async function newClient(mnemonic: string) {
const gridClient = new GridClient(options);
await gridClient.connect();

setTimeout(async () => {
console.log(`Request the grid to get the twin id.`);
const twinID = await gridClient.twins.get_my_twin_id();
console.log(`Twin id: ${twinID}`);
}, 10 * 60 * 1000);
setTimeout(
async () => {
console.log(`Request the grid to get the twin id.`);
const twinID = await gridClient.twins.get_my_twin_id();
console.log(`Twin id: ${twinID}`);
},
10 * 60 * 1000,
);
} catch (error) {
console.error("Error connecting to Grid:", error);
}
Expand All @@ -45,9 +48,12 @@ async function main() {
await newClient(clientMnemonic2);
console.log(`Please disconnect your internet connection.`);

setTimeout(async () => {
console.log(`Please re-connect your internet connection.`);
}, 9 * 60 * 1000);
setTimeout(
async () => {
console.log(`Please re-connect your internet connection.`);
},
9 * 60 * 1000,
);
}

main();
1 change: 1 addition & 0 deletions packages/grid_client/scripts/dynamic_single_vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function getDeployment(client, vms) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, vms) {
const res = await client.machines.delete(vms);
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/fqdn_gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function getDeployment(client, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, gw) {
const res = await client.gateway.delete_fqdn(gw);
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/mass_deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ async function main() {

const deploymentPromises = batchVMs.map(async (vms, index) => {
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [twinDeployments, _, __] = await grid3.machines._createDeployment(vms);
return { twinDeployments, batchIndex: index };
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion packages/grid_client/scripts/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function main() {
await newDB.get({ key: oldKey });
alreadyMigratedCount++;
console.log(`${oldKey} key is migrated`);
} catch (error) {
} catch {
failedCount++;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/multiple_vms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function getDeployment(client: GridClient, name: string) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client: GridClient, name: string) {
const res = await client.machines.delete({ name });
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/multiple_vms_zos_3_lite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function getDeployment(client: GridClient, name: string) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client: GridClient, name: string) {
const res = await client.machines.delete({ name });
log("================= Canceling the deployment =================");
Expand Down
1 change: 1 addition & 0 deletions packages/grid_client/scripts/name_gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function getDeployment(client, gw) {
log("================= Getting deployment information =================");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function cancel(client, gw) {
const res = await client.gateway.delete_name(gw);
log("================= Canceling the deployment =================");
Expand Down
Loading