From 79dae70481b4da2728299f8a124eecc554160f53 Mon Sep 17 00:00:00 2001 From: KazariEX <1364035137@qq.com> Date: Sun, 15 Dec 2024 17:50:13 +0800 Subject: [PATCH] refactor: prefer `includes` to determine if substrings exist --- packages/language-core/lib/codegen/script/template.ts | 2 +- packages/language-core/lib/plugins/file-html.ts | 4 ++-- packages/language-service/lib/ideFeatures/nameCasing.ts | 2 +- .../language-service/lib/plugins/vue-autoinsert-dotvalue.ts | 2 +- packages/language-service/lib/plugins/vue-template.ts | 4 ++-- packages/typescript-plugin/lib/common.ts | 6 +++--- packages/typescript-plugin/lib/requests/componentInfos.ts | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/language-core/lib/codegen/script/template.ts b/packages/language-core/lib/codegen/script/template.ts index b9524dbd66..b971cb9d63 100644 --- a/packages/language-core/lib/codegen/script/template.ts +++ b/packages/language-core/lib/codegen/script/template.ts @@ -247,7 +247,7 @@ export function getTemplateUsageVars(options: ScriptCodegenOptions, ctx: ScriptC } } for (const component of components) { - if (component.indexOf('.') >= 0) { + if (component.includes('.')) { usageVars.add(component.split('.')[0]); } } diff --git a/packages/language-core/lib/plugins/file-html.ts b/packages/language-core/lib/plugins/file-html.ts index 2bb52b7d9e..4c548dcf40 100644 --- a/packages/language-core/lib/plugins/file-html.ts +++ b/packages/language-core/lib/plugins/file-html.ts @@ -66,8 +66,8 @@ const plugin: VueLanguagePlugin = ({ vueCompilerOptions }) => { }); } // ignore `