Skip to content

Commit

Permalink
Merge pull request #66 from davelopez/update_eslint_config
Browse files Browse the repository at this point in the history
Update ESLint configuration to ignore additional directories and files
  • Loading branch information
davelopez authored May 31, 2024
2 parents f82b850 + cbba4c9 commit 12fccd9
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 21 deletions.
27 changes: 24 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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,
{
Expand All @@ -45,6 +67,5 @@
}
],
"keyword-spacing": ["error"]
},
"ignorePatterns": ["**/*.d.ts"]
}
}
18 changes: 10 additions & 8 deletions server/gx-workflow-ls-format2/src/schema/versions.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
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";

/**
* All gxformat2 version 19_09 schema documents.
*
* These documents are raw yaml documents loaded by webpack.
* */
export const SCHEMA_DOCS_v19_09_MAP = new Map<string, SchemaDocument>([
[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<string, SchemaDocument>(
[
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])
);
2 changes: 1 addition & 1 deletion server/gx-workflow-ls-format2/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
declare module "*.yaml" {
const data: any;
const data: unknown;
export default data;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down Expand Up @@ -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, "", "----", ""]
Expand Down Expand Up @@ -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, "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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 [];
}
}
Expand Down

0 comments on commit 12fccd9

Please sign in to comment.