diff --git a/.yarnrc.yml b/.yarnrc.yml index dc79fc379c..aa654b4428 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -20,7 +20,7 @@ packageExtensions: "@swc/types": "*" "@typescript-eslint/rule-tester@*": dependencies: - "@typescript-eslint/parser": ~8.17.0 + "@typescript-eslint/parser": ~8.18.0 "@angular-eslint/eslint-plugin-template@*": dependencies: "@typescript-eslint/types": "^8.0.0" diff --git a/apps/vscode-extension/package.json b/apps/vscode-extension/package.json index f690e78301..2d17ceeb01 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.18.0", + "@typescript-eslint/utils": "~8.18.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..1fa1d85e1f 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