Skip to content

Commit

Permalink
feat: add webpackFetchPriority support
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Jul 1, 2024
1 parent 365cf02 commit 2cbdc61
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/grumpy-games-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"eslint-plugin-import-x": patch
---

feat: webpack comment regex support `webpackFetchPriority`
2 changes: 1 addition & 1 deletion src/rules/dynamic-import-chunkname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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+["']*)]))),?)+ $/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with ' webpackChunkName: ' and containing many repetitions of 'a webpackChunkName: '.

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with ' webpackInclude: /' and containing many repetitions of 'a/ webpackExclude: /'.

const chunkSubstrFormat = `webpackChunkName: ["']${webpackChunknameFormat}["'],?`
const chunkSubstrRegex = new RegExp(chunkSubstrFormat)
Expand Down

0 comments on commit 2cbdc61

Please sign in to comment.