Skip to content

Commit 3b9d93c

Browse files
authored
Fix eslint warnings and update eslint (#4183)
* ESLINT: fix vue/singleline-html-element-content-newline * ESLINT: fix vue/attributes-order * ESLINT: fix vue/html-self-closing * fix: vue/attribute-hyphenation * ESLINT: ignore multi-word-component for old components * eslint: vue/no-template-shadow * eslint: update rules * eslint: apply vue/multiline-html-element-content-newline * eslint fix no-unused-vars * eslint fix no-unused-vars * eslint fix no-unused-vars * eslint fix vue/component-definition-name-casing * eslint fix vue/html-closing-bracket-newline * eslint: apply simple sort import * apply eslint fix * apply eslint fix unused var * apply eslint fix * chore: reorganize eslint rules into off/warn/error categories and update severity levels * eslint ignore prefer-spread * fix: correct casing in SelectedNode property references to selectedNode * chore: clean up eslint rules and add ngx global declaration * refactor: rename props to slotProps in template activator slots and reorder v-model attribute * merge development
1 parent 53b59af commit 3b9d93c

272 files changed

Lines changed: 2235 additions & 1877 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eslint.config.js

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,29 @@ import { defineConfigWithVueTs, vueTsConfigs } from "@vue/eslint-config-typescri
99
// This returns an ARRAY of config objects optimized for Vue+TS
1010
const vueTsGeneratedConfigs = defineConfigWithVueTs(pluginVue.configs["flat/recommended"], vueTsConfigs.recommended, {
1111
rules: {
12-
"@typescript-eslint/no-explicit-any": "warn",
13-
"vue/multi-word-component-names": "warn",
12+
// --- OFF rules ---
13+
// TODO: enable this rule after https://github.com/threefoldtech/tfgrid-sdk-ts/issues/4075
14+
"@typescript-eslint/no-explicit-any": "off",
1415
"vue/no-v-text-v-html-on-component": "off",
15-
"@typescript-eslint/no-unused-expressions": "warn",
16-
"@typescript-eslint/no-unused-vars": `warn`,
16+
"vue/max-attributes-per-line": "off",
17+
"vue/no-v-html": "off",
18+
"vue/singleline-html-element-content-newline": "off",
19+
"vue/html-self-closing": "off",
20+
"vue/html-indent": "off",
21+
"vue/require-explicit-emits": "off",
22+
"vue/require-default-prop": "off",
23+
"@typescript-eslint/no-unused-expressions": "off",
24+
25+
// --- WARN rules ---
1726
"@typescript-eslint/no-duplicate-enum-values": "warn",
18-
"vue/no-dupe-keys": "warn",
27+
28+
// --- ERROR rules ---
29+
"vue/multi-word-component-names": "error",
30+
"@typescript-eslint/no-unused-vars": "error",
31+
"vue/no-template-shadow": "error",
32+
"vue/multiline-html-element-content-newline": "error",
33+
"vue/component-definition-name-casing": "error",
34+
"vue/no-dupe-keys": "error",
1935
},
2036
});
2137

@@ -62,23 +78,24 @@ export default [
6278
},
6379
rules: {
6480
...tseslint.configs.eslintRecommended.rules,
65-
"@typescript-eslint/no-unused-vars": "warn",
6681

82+
// --- OFF rules ---
6783
"no-console": "off",
68-
"prettier/prettier": "warn",
69-
"simple-import-sort/imports": "warn",
70-
7184
"@typescript-eslint/no-var-requires": "off",
85+
// TODO: enable this rule after https://github.com/threefoldtech/tfgrid-sdk-ts/issues/4075
7286
"@typescript-eslint/no-explicit-any": "off",
7387
"@typescript-eslint/no-empty-function": "off",
7488
"@typescript-eslint/ban-ts-comment": "off",
7589
"@typescript-eslint/no-non-null-assertion": "off",
90+
"@typescript-eslint/no-empty-object-type": "off",
91+
92+
// --- WARN rules ---
93+
"prettier/prettier": "warn",
7694
"prefer-spread": "warn",
7795
"@typescript-eslint/no-restricted-types": [
7896
"warn",
7997
{
8098
types: {
81-
"{}": "Use `unknown` instead.",
8299
"Function": "Use specific function types instead.",
83100
"Object": "Use `Record<string, unknown>` or specific object types instead.",
84101
"String": "Use `string` instead.",
@@ -87,9 +104,12 @@ export default [
87104
},
88105
},
89106
],
90-
"@typescript-eslint/no-empty-object-type": "warn",
91107
"@typescript-eslint/no-unsafe-function-type": "warn",
92108
"@typescript-eslint/no-wrapper-object-types": "warn",
109+
110+
// --- ERROR rules ---
111+
"@typescript-eslint/no-unused-vars": "error",
112+
"simple-import-sort/imports": "error",
93113
},
94114
},
95115
...vueConfig,

packages/graphql_client/src/clients/abstract_client.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,13 @@ export abstract class AbstractClient {
102102

103103
private static normalizeFields<T>(fields: PartialBoolean<T>): string {
104104
return Object.entries(fields)
105-
.reduce((out, [key, value]: any) => {
106-
out.push(value === true ? key : `${key}{${AbstractClient.normalizeFields(value)}}`);
107-
return out;
108-
}, <string[]>[])
105+
.reduce(
106+
(out, [key, value]: any) => {
107+
out.push(value === true ? key : `${key}{${AbstractClient.normalizeFields(value)}}`);
108+
return out;
109+
},
110+
<string[]>[],
111+
)
109112
.join(",");
110113
}
111114
}

packages/graphql_client/src/clients/client.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class TFGridGqlClient extends AbstractClient {
4040
public merge<T extends MergableQuery>(queries: T) {
4141
const options: RequestOptions[] = [];
4242
for (const query in queries) {
43+
// eslint-disable-next-line prefer-spread
4344
options.push(this[`__${query}` as any].apply(this, queries[query]));
4445
}
4546

@@ -68,14 +69,14 @@ type NormalizeMerge<T> = {
6869
? Q[]
6970
: unknown
7071
: K extends keyof ByIdQueries
71-
? ReturnType<ByIdQueries[K]> extends Promise<infer Q>
72-
? Q
73-
: unknown
74-
: K extends keyof ConnectionQueries
75-
? ReturnType<ConnectionQueries[K]> extends Promise<infer Q>
76-
? Q
77-
: unknown
78-
: unknown;
72+
? ReturnType<ByIdQueries[K]> extends Promise<infer Q>
73+
? Q
74+
: unknown
75+
: K extends keyof ConnectionQueries
76+
? ReturnType<ConnectionQueries[K]> extends Promise<infer Q>
77+
? Q
78+
: unknown
79+
: unknown;
7980
};
8081

8182
export interface TFGridGqlClient extends ListQueries, ByIdQueries, ConnectionQueries {}

packages/graphql_client/src/clients/list_queries.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
Account,
44
ArrayWhere,
55
BaseWhere,
6-
BigInt,
76
BoolWhere,
87
BurnTransaction,
98
City,

packages/graphql_client/src/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export type PartialBoolean<T> = {
1212
? PartialBoolean<Q>
1313
: true
1414
: T[K] extends object
15-
? PartialBoolean<T[K]>
16-
: true;
15+
? PartialBoolean<T[K]>
16+
: true;
1717
};
1818

1919
type __BaseWhere<T> = { eq: T; not_eq: T; gt: T; gte: T; lt: T; lte: T; in: T[]; not_in: T[]; }; // prettier-ignore

packages/graphql_client/src/utils/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { ValidationError } from "@threefold/types";
22
type AssertReturn = void | never;
3-
function panic(message: string): never {
4-
throw new Error(message);
5-
}
63

74
/**
85
* @description

packages/grid_client/scripts/applications/algorand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ async function getDeployment(client, vms) {
1717
log("================= Getting deployment information =================");
1818
}
1919

20+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2021
async function cancel(client, vms) {
2122
const resultVM = await client.machines.delete(vms);
2223
log("================= Canceling the deployment =================");

packages/grid_client/scripts/applications/casperlabs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
3434
log("================= Getting deployment information =================");
3535
}
3636

37+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3738
async function cancel(client, vms, gw) {
3839
const resultVM = await client.machines.delete(vms);
3940
const resultGateway = await client.gateway.delete_name(gw);

packages/grid_client/scripts/applications/discourse.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ async function getDeployment(client, vms, gw) {
3737
log("================= Getting deployment information =================");
3838
}
3939

40+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4041
async function cancel(client, vms, gw) {
4142
const resultVM = await client.machines.delete(vms);
4243
const resultGateway = await client.gateway.delete_name(gw);

packages/grid_client/scripts/applications/funkwhale.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async function getDeployment(client, vms, gw) {
3434
log("================= Getting deployment information =================");
3535
}
3636

37+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
3738
async function cancel(client, vms, gw) {
3839
const resultVM = await client.machines.delete(vms);
3940
const resultGateway = await client.gateway.delete_name(gw);

0 commit comments

Comments
 (0)