From 8b359cd374ff6aea987c91cc228dfdb24f67c281 Mon Sep 17 00:00:00 2001 From: Kilian Panot Date: Mon, 23 Dec 2024 12:26:46 +0900 Subject: [PATCH 1/3] fix(vscode): unlock vscode extension --- apps/vscode-extension/src/extension.ts | 6 ++++-- .../src/intellisense/configuration.ts | 16 +++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/vscode-extension/src/extension.ts b/apps/vscode-extension/src/extension.ts index 9189dc475f..fb2b094440 100644 --- a/apps/vscode-extension/src/extension.ts +++ b/apps/vscode-extension/src/extension.ts @@ -1,6 +1,7 @@ import { commands, - ExtensionContext, languages } from 'vscode'; + ExtensionContext, languages, + window } from 'vscode'; import { extractAllToVariable } from './commands/extract/styling/extract-all-to-variable.command'; import { extractToVariable } from './commands/extract/styling/extract-to-variable.command'; import { generateComponentGenerateCommand } from './commands/generate/component.command'; @@ -33,10 +34,11 @@ import { designTokenCompletionItemAndHoverProviders } from './intellisense/desig * @param context */ export function activate(context: ExtensionContext) { + const channel = window.createOutputChannel('Otter'); const designTokenProviders = designTokenCompletionItemAndHoverProviders(); context.subscriptions.push( - languages.registerCompletionItemProvider(['javascript','typescript'], configurationCompletionItemProvider(), configurationCompletionTriggerChar), + languages.registerCompletionItemProvider(['javascript','typescript'], configurationCompletionItemProvider({ channel }), configurationCompletionTriggerChar), languages.registerCompletionItemProvider(['scss'], stylingCompletionItemProvider(), stylingCompletionTriggerChar), languages.registerCompletionItemProvider(['scss', 'css'], designTokenProviders), languages.registerHoverProvider(['scss', 'css'], designTokenProviders), diff --git a/apps/vscode-extension/src/intellisense/configuration.ts b/apps/vscode-extension/src/intellisense/configuration.ts index c1a8c85778..0ce8ee1476 100644 --- a/apps/vscode-extension/src/intellisense/configuration.ts +++ b/apps/vscode-extension/src/intellisense/configuration.ts @@ -1,5 +1,4 @@ -import { CompletionItem, CompletionItemKind, CompletionItemProvider, SnippetString } from 'vscode'; -import { ESLint } from 'eslint'; +import { CompletionItem, CompletionItemKind, CompletionItemProvider, type OutputChannel, SnippetString } from 'vscode'; interface ConfigurationTags { /** @see CompletionItem.documentation */ @@ -97,8 +96,15 @@ const getConfigurationTagsFromEslintConfig = (eslintConfig: any, comment: string }; }; -export const configurationCompletionItemProvider = () : CompletionItemProvider => { - const eslint = new ESLint(); +export const configurationCompletionItemProvider = (options: { channel: OutputChannel }): CompletionItemProvider => { + const eslint = import('eslint') + // eslint-disable-next-line @typescript-eslint/naming-convention -- External package defined name + .then(({ ESLint }) => new ESLint()) + .catch((err) => { + options.channel.appendLine('Error during ESLint loading:'); + options.channel.appendLine(JSON.stringify(err)); + return undefined; + }); return { provideCompletionItems: async (doc, pos) => { @@ -132,7 +138,7 @@ export const configurationCompletionItemProvider = () : CompletionItemProvider Date: Mon, 23 Dec 2024 12:21:05 +0900 Subject: [PATCH 2/3] fix(vscode): allow VsCode extension without espree detection --- apps/vscode-extension/package.json | 1 + apps/vscode-extension/src/extension.ts | 4 +++- .../src/intellisense/configuration.ts | 17 +++++++++++------ yarn.lock | 1 + 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/vscode-extension/package.json b/apps/vscode-extension/package.json index 0a3c074d57..cbb1087a23 100644 --- a/apps/vscode-extension/package.json +++ b/apps/vscode-extension/package.json @@ -372,6 +372,7 @@ "@types/node": "^20.0.0", "@types/vscode": "^1.67.0", "@typescript-eslint/parser": "~8.19.0", + "@typescript-eslint/utils": "~8.19.0", "@vscode/vsce": "^2.16.0", "angular-eslint": "~18.4.0", "cpy-cli": "^5.0.0", diff --git a/apps/vscode-extension/src/extension.ts b/apps/vscode-extension/src/extension.ts index ea363dee0e..85f643ca9d 100644 --- a/apps/vscode-extension/src/extension.ts +++ b/apps/vscode-extension/src/extension.ts @@ -2,6 +2,7 @@ import { commands, ExtensionContext, languages, + window, } from 'vscode'; import { extractAllToVariable, @@ -60,10 +61,11 @@ import { * @param context */ export function activate(context: ExtensionContext) { + const channel = window.createOutputChannel('Otter'); const designTokenProviders = designTokenCompletionItemAndHoverProviders(); context.subscriptions.push( - languages.registerCompletionItemProvider(['javascript', 'typescript'], configurationCompletionItemProvider(), configurationCompletionTriggerChar), + languages.registerCompletionItemProvider(['javascript', 'typescript'], configurationCompletionItemProvider({ channel }), configurationCompletionTriggerChar), languages.registerCompletionItemProvider(['scss'], stylingCompletionItemProvider(), stylingCompletionTriggerChar), languages.registerCompletionItemProvider(['scss', 'css'], designTokenProviders), languages.registerHoverProvider(['scss', 'css'], designTokenProviders), diff --git a/apps/vscode-extension/src/intellisense/configuration.ts b/apps/vscode-extension/src/intellisense/configuration.ts index 568206c2f8..af39e7b59e 100644 --- a/apps/vscode-extension/src/intellisense/configuration.ts +++ b/apps/vscode-extension/src/intellisense/configuration.ts @@ -2,6 +2,7 @@ import { CompletionItem, CompletionItemKind, CompletionItemProvider, + type OutputChannel, SnippetString, } from 'vscode'; import type { @@ -11,9 +12,6 @@ import type { import type { TSESLint, } from '@typescript-eslint/utils'; -import { - ESLint, -} from 'eslint'; interface ConfigurationTags { /** @see CompletionItem.documentation */ @@ -115,8 +113,15 @@ const getConfigurationTagsFromEslintConfig = (eslintConfig: TSESLint.FlatConfig. }; }; -export const configurationCompletionItemProvider = (): CompletionItemProvider => { - const eslint = new ESLint(); +export const configurationCompletionItemProvider = (options: { channel: OutputChannel }): CompletionItemProvider => { + const eslint = import('eslint') + // eslint-disable-next-line @typescript-eslint/naming-convention -- External package defined name + .then(({ ESLint }) => new ESLint()) + .catch((err) => { + options.channel.appendLine('Error during ESLint loading:'); + options.channel.appendLine(JSON.stringify(err)); + return undefined; + }); return { provideCompletionItems: async (doc, pos) => { @@ -150,7 +155,7 @@ export const configurationCompletionItemProvider = (): CompletionItemProvider Date: Tue, 7 Jan 2025 17:06:58 +0100 Subject: [PATCH 3/3] fix(ama-sdk): fallback open api generator version to 7.9.0 --- .renovaterc.json5 | 4 +++- packages/@ama-sdk/schematics/package.json | 2 +- .../typescript/core/openapi-codegen-typescript/pom.xml | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.renovaterc.json5 b/.renovaterc.json5 index 0040e8401d..1d85b1d8b3 100644 --- a/.renovaterc.json5 +++ b/.renovaterc.json5 @@ -104,7 +104,9 @@ "org.openapitools:openapi-generator" ], "groupName": "Open API updates", - "groupSlug": "openapi" + "groupSlug": "openapi", + // TODO wait for https://github.com/OpenAPITools/openapi-generator/issues/20135 to be fixed before upgrading to 7.10.0 + "enabled": false }, { // We don't want to update this dep as we are still targeting a fork diff --git a/packages/@ama-sdk/schematics/package.json b/packages/@ama-sdk/schematics/package.json index 32c7b35cec..c0544a1549 100644 --- a/packages/@ama-sdk/schematics/package.json +++ b/packages/@ama-sdk/schematics/package.json @@ -153,7 +153,7 @@ "tsc-watch": "^6.0.4", "yaml-eslint-parser": "^1.2.2" }, - "openApiSupportedVersion": "~7.10.0", + "openApiSupportedVersion": "~7.9.0", "engines": { "node": "^18.19.1 || ^20.11.1 || >=22.0.0" } diff --git a/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/pom.xml b/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/pom.xml index 0c0cc4c74e..6ef8006faa 100644 --- a/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/pom.xml +++ b/packages/@ama-sdk/schematics/schematics/typescript/core/openapi-codegen-typescript/pom.xml @@ -95,7 +95,9 @@ org.openapitools openapi-generator - 7.10.0 + + + 7.9.0 provided