Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disallow import chunkname w/ webpack eager mode #100

Merged
merged 6 commits into from
Jul 2, 2024

Conversation

SukkaW
Copy link
Collaborator

@SukkaW SukkaW commented Jul 1, 2024

Backport import-js#3004

Copy link

changeset-bot bot commented Jul 1, 2024

🦋 Changeset detected

Latest commit: 2cbdc61

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
eslint-plugin-import-x Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Jul 1, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 85.29412% with 5 lines in your changes missing coverage. Please review.

Project coverage is 96.14%. Comparing base (8b53954) to head (dd2929b).
Report is 8 commits behind head on master.

Current head dd2929b differs from pull request most recent head 2cbdc61

Please upload reports for the commit 2cbdc61 to get more accurate results.

Files Patch % Lines
src/rules/dynamic-import-chunkname.ts 85.29% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   96.22%   96.14%   -0.09%     
==========================================
  Files          91       91              
  Lines        4399     4432      +33     
  Branches     1497     1510      +13     
==========================================
+ Hits         4233     4261      +28     
- Misses        160      165       +5     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
src/rules/dynamic-import-chunkname.ts Fixed Show fixed Hide fixed
@@ -69,9 +78,12 @@

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+["']*)]))),?)+ $/
const chunkSubstrFormat = ` webpackChunkName: ["']${webpackChunknameFormat}["'],? `
/^( (((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: '.
@@ -69,9 +78,12 @@

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+["']*)]))),?)+ $/
const chunkSubstrFormat = ` webpackChunkName: ["']${webpackChunknameFormat}["'],? `
/^( (((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 ' webpackInclude: /' and containing many repetitions of 'a/ webpackExclude: /'.
@SukkaW SukkaW merged commit 293fcf4 into un-ts:master Jul 2, 2024
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant