From 2cbdc61cd457c83567612246071e0aa471f1d572 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Mon, 1 Jul 2024 23:18:20 +0800 Subject: [PATCH] feat: add `webpackFetchPriority` support --- .changeset/grumpy-games-shake.md | 5 +++++ src/rules/dynamic-import-chunkname.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/grumpy-games-shake.md diff --git a/.changeset/grumpy-games-shake.md b/.changeset/grumpy-games-shake.md new file mode 100644 index 000000000..e87ea98d7 --- /dev/null +++ b/.changeset/grumpy-games-shake.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-import-x": patch +--- + +feat: webpack comment regex support `webpackFetchPriority` diff --git a/src/rules/dynamic-import-chunkname.ts b/src/rules/dynamic-import-chunkname.ts index 0e81f1f9b..bbdedb9b9 100644 --- a/src/rules/dynamic-import-chunkname.ts +++ b/src/rules/dynamic-import-chunkname.ts @@ -78,7 +78,7 @@ export = createRule<[Options?], MessageId>({ const paddedCommentRegex = /^ (\S[\S\s]+\S) $/ const commentStyleRegex = - /^( ((webpackChunkName: .+)|((webpackPrefetch|webpackPreload): (true|false|-?\d+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.*\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (["']\w+["']|\[(["']\w+["'], *)+(["']\w+["']*)]))),?)+ $/ + /^( (((webpackChunkName|webpackFetchPriority): .+)|((webpackPrefetch|webpackPreload): (true|false|-?\d+))|(webpackIgnore: (true|false))|((webpackInclude|webpackExclude): \/.+\/)|(webpackMode: ["'](lazy|lazy-once|eager|weak)["'])|(webpackExports: (["']\w+["']|\[(["']\w+["'], *)+(["']\w+["']*)]))),?)+ $/ const chunkSubstrFormat = `webpackChunkName: ["']${webpackChunknameFormat}["'],?` const chunkSubstrRegex = new RegExp(chunkSubstrFormat)