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

fix(eslint-plugin-template): [prefer-ngsrc] Do not prefer ngsrc for base64-encoded strings #1628

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

estevezluis
Copy link
Contributor

@estevezluis estevezluis commented Nov 20, 2023

Closes #1543

Rule prefer-ngsrc should not error if image src is a base64-encoded string because NgOptimizedImage does not support Base64-encoded strings.

Expected Behavior:
<img src="data:image/png;base64" /> ✅ should not throw an error

<img [src]="'data:image/png;base64'" /> ❌ should throw an error because [src] is a BoundAttribute

<img src="data:image/png;base64" [ngSrc]="'data:image/png;base64'" /> ❌ should throw an error because there is two sources.

Copy link

nx-cloud bot commented Nov 20, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5d55aca. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 4 targets

Sent with 💌 from NxCloud.

abaran30
abaran30 previously approved these changes Nov 20, 2023
@abaran30
Copy link
Contributor

@estevezluis I'm unsure why codecov isn't running (maybe CI flake). Would you be able to make one more commit to refresh the CI run? Maybe add a comment to the isSrcBase64Image function explaining that the logic is based on Angular's assertion (with a link?) for future reference.

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

Merging #1628 (5d55aca) into main (b489924) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1628      +/-   ##
==========================================
+ Coverage   89.38%   89.39%   +0.01%     
==========================================
  Files         169      169              
  Lines        3174     3178       +4     
  Branches      540      541       +1     
==========================================
+ Hits         2837     2841       +4     
  Misses        199      199              
  Partials      138      138              
Flag Coverage Δ
unittest 89.39% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...s/eslint-plugin-template/src/rules/prefer-ngsrc.ts 100.00% <100.00%> (ø)
...-plugin-template/tests/rules/prefer-ngsrc/cases.ts 100.00% <ø> (ø)

@abaran30 abaran30 merged commit 1e345ab into angular-eslint:main Nov 21, 2023
14 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.

[prefer-ngsrc] Disable the rule if the src is a Base64-encoded string
2 participants