diff --git a/.eslintrc.json b/.eslintrc.json index 24ccb6c..6285e55 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,6 +15,17 @@ "plugin:@typescript-eslint/recommended", "prettier" ], + "ignorePatterns": [ + "**/node_modules/**", + "/built/**", + "/tests/**", + "/lib/**", + "/src/lib/*.generated.d.ts", + "/scripts/**/*.js", + "/scripts/**/*.d.*", + "/internal/**", + "/coverage/**" + ], "rules": { "prettier/prettier": "error", "@typescript-eslint/no-use-before-define": [ @@ -24,7 +35,18 @@ "classes": false } ], - "@typescript-eslint/no-unused-vars": ["warn"], + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "args": "all", + "argsIgnorePattern": "^_", + "caughtErrors": "all", + "caughtErrorsIgnorePattern": "^_", + "destructuredArrayIgnorePattern": "^_", + "varsIgnorePattern": "^_", + "ignoreRestSiblings": true + } + ], "@typescript-eslint/explicit-function-return-type": [ 1, { @@ -45,6 +67,5 @@ } ], "keyword-spacing": ["error"] - }, - "ignorePatterns": ["**/*.d.ts"] + } } diff --git a/server/gx-workflow-ls-format2/src/schema/versions.ts b/server/gx-workflow-ls-format2/src/schema/versions.ts index 06736f2..38f6385 100644 --- a/server/gx-workflow-ls-format2/src/schema/versions.ts +++ b/server/gx-workflow-ls-format2/src/schema/versions.ts @@ -1,7 +1,7 @@ -import schema_v19_09_workflows from "@schemas/gxformat2/v19_09/workflows.yaml"; +import schema_common from "@schemas/gxformat2/common/common.yaml"; import schema_common_metaschema_base from "@schemas/gxformat2/common/metaschema/metaschema_base.yaml"; import schema_v19_09_process from "@schemas/gxformat2/v19_09/process.yaml"; -import schema_common from "@schemas/gxformat2/common/common.yaml"; +import schema_v19_09_workflows from "@schemas/gxformat2/v19_09/workflows.yaml"; import { SchemaDocument } from "./definitions"; /** @@ -9,9 +9,11 @@ import { SchemaDocument } from "./definitions"; * * These documents are raw yaml documents loaded by webpack. * */ -export const SCHEMA_DOCS_v19_09_MAP = new Map([ - [schema_common_metaschema_base.$base, schema_common_metaschema_base], - [schema_v19_09_process.$base, schema_v19_09_process], - [schema_common.$base, schema_common], - [schema_v19_09_workflows.$base, schema_v19_09_workflows], -]); +export const SCHEMA_DOCS_v19_09_MAP = new Map( + [ + schema_common_metaschema_base as SchemaDocument, + schema_v19_09_process as SchemaDocument, + schema_common as SchemaDocument, + schema_v19_09_workflows as SchemaDocument, + ].map((schemaDoc) => [schemaDoc.$base, schemaDoc]) +); diff --git a/server/gx-workflow-ls-format2/src/types.d.ts b/server/gx-workflow-ls-format2/src/types.d.ts index 6383136..15ef5f3 100644 --- a/server/gx-workflow-ls-format2/src/types.d.ts +++ b/server/gx-workflow-ls-format2/src/types.d.ts @@ -1,4 +1,4 @@ declare module "*.yaml" { - const data: any; + const data: unknown; export default data; } diff --git a/server/packages/workflow-tests-language-service/src/schema/adapter.ts b/server/packages/workflow-tests-language-service/src/schema/adapter.ts index 9a512c7..9ca59f7 100644 --- a/server/packages/workflow-tests-language-service/src/schema/adapter.ts +++ b/server/packages/workflow-tests-language-service/src/schema/adapter.ts @@ -1342,7 +1342,7 @@ export function safeCreateUnicodeRegExp(pattern: string): RegExp { // fall back to regular regexp if we cannot create Unicode one try { return new RegExp(pattern, "u"); - } catch (ignore) { + } catch (_ignore) { return new RegExp(pattern); } } diff --git a/server/packages/workflow-tests-language-service/src/services/completion/helper.ts b/server/packages/workflow-tests-language-service/src/services/completion/helper.ts index c0ec3b6..2e6c922 100644 --- a/server/packages/workflow-tests-language-service/src/services/completion/helper.ts +++ b/server/packages/workflow-tests-language-service/src/services/completion/helper.ts @@ -920,8 +920,8 @@ ${this.indentation}${this.indentation}$0 .map((m) => +m.replace(/\${([0-9]+)[:|]/g, "$1").replace("$", "")) // get numbers form $1 or ${1:...} .reduce((p, n) => (n > p ? n : p), 0); // find the max one const reindexedStr = text - .replace(/\$([0-9]+)/g, (s, args) => "$" + (+args + max$index)) // increment each by max$index - .replace(/\${([0-9]+)[:|]/g, (s, args) => "${" + (+args + max$index) + ":"); // increment each by max$index + .replace(/\$([0-9]+)/g, (_s, args) => "$" + (+args + max$index)) // increment each by max$index + .replace(/\${([0-9]+)[:|]/g, (_s, args) => "${" + (+args + max$index) + ":"); // increment each by max$index max$index += max$indexLocal; return reindexedStr; }); @@ -950,7 +950,7 @@ ${this.indentation}${this.indentation}$0 completionItem.textEdit.newText = insertText; } // remove $x or use {$x:value} in documentation - const mdText = insertText.replace(/\${[0-9]+[:|](.*)}/g, (s, arg) => arg).replace(/\$([0-9]+)/g, ""); + const mdText = insertText.replace(/\${[0-9]+[:|](.*)}/g, (_s, arg) => arg).replace(/\$([0-9]+)/g, ""); const originalDocumentation = completionItem.documentation ? [completionItem.documentation, "", "----", ""] @@ -1330,7 +1330,7 @@ ${this.indentation}${this.indentation}$0 let res: string | MarkupContent = documentation; if (this.doesSupportMarkdown()) { insertText = insertText - .replace(/\${[0-9]+[:|](.*)}/g, (s, arg) => { + .replace(/\${[0-9]+[:|](.*)}/g, (_s, arg) => { return arg; }) .replace(/\$([0-9]+)/g, ""); diff --git a/server/packages/yaml-language-service/src/parser/yamlDocument.ts b/server/packages/yaml-language-service/src/parser/yamlDocument.ts index 14deeac..d12c164 100644 --- a/server/packages/yaml-language-service/src/parser/yamlDocument.ts +++ b/server/packages/yaml-language-service/src/parser/yamlDocument.ts @@ -267,7 +267,7 @@ export class YAMLSubDocument { let offsetDiff = this.parsedDocument.range?.[2] ?? 0; let maxOffset = this.parsedDocument.range?.[0] ?? 0; let closestNode: YamlNode | undefined = undefined; - visit(this.parsedDocument, (key, node) => { + visit(this.parsedDocument, (_key, node) => { if (!node) { return; } diff --git a/server/packages/yaml-language-service/src/services/yamlFormatter.ts b/server/packages/yaml-language-service/src/services/yamlFormatter.ts index af28c09..d7291c3 100644 --- a/server/packages/yaml-language-service/src/services/yamlFormatter.ts +++ b/server/packages/yaml-language-service/src/services/yamlFormatter.ts @@ -1,7 +1,7 @@ -import { Range, Position, TextEdit, FormattingOptions } from "vscode-languageserver-types"; -import { CustomFormatterOptions, LanguageSettings } from "../yamlLanguageService"; import { TextDocument } from "vscode-languageserver-textdocument"; -import { parse, stringify, ToStringOptions } from "yaml"; +import { FormattingOptions, Position, Range, TextEdit } from "vscode-languageserver-types"; +import { ToStringOptions, parse, stringify } from "yaml"; +import { CustomFormatterOptions, LanguageSettings } from "../yamlLanguageService"; export class YAMLFormatter { private formatterEnabled? = true; @@ -29,6 +29,7 @@ export class YAMLFormatter { return [TextEdit.replace(Range.create(Position.create(0, 0), document.positionAt(text.length)), formatted)]; } catch (error) { + console.debug("Error formatting YAML document", error); return []; } }