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): [eqeqeq] Calculate offset to find true absolute source span #1709

Merged
merged 3 commits into from Mar 15, 2024

Conversation

estevezluis
Copy link
Contributor

@estevezluis estevezluis commented Jan 22, 2024

Fixes #1666

Problem:
In angular's parser, leading whitespace or newline is ignored when calculating AbsoluteSourceSpan. 12

Solution:
This PR finds the true AbsoluteSourceSpan by calculating the leading trivia characters offset.

Assistance requested:
Not sure how to add a leading newline (e.g. code snippet in #1666) in annotatedSource without causing issues in annotatedOutput.

Reference

Footnotes

  1. https://github.com/angular/angular/blob/main/packages/compiler/src/ml_parser/lexer.ts#L87

  2. https://hackmd.io/@X3ECPVy-RCuVfba-pnvIpw/BkDUxaW84/%2FMA1oxh6jRXqSmZBcLfYdyw?type=book)%5C#Parser

Copy link

nx-cloud bot commented Jan 22, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 96dc5f9. 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 8 targets

Sent with 💌 from NxCloud.

Copy link

codecov bot commented Jan 22, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 89.61%. Comparing base (8294112) to head (96dc5f9).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1709      +/-   ##
==========================================
+ Coverage   89.56%   89.61%   +0.04%     
==========================================
  Files         171      172       +1     
  Lines        3202     3217      +15     
  Branches      544      545       +1     
==========================================
+ Hits         2868     2883      +15     
- Misses        198      199       +1     
+ Partials      136      135       -1     
Flag Coverage Δ
unittest 89.61% <80.00%> (+0.04%) ⬆️

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

Files Coverage Δ
...eslint-plugin-template/tests/rules/eqeqeq/cases.ts 100.00% <ø> (ø)
...ackages/eslint-plugin-template/src/rules/eqeqeq.ts 92.68% <80.00%> (+2.05%) ⬆️

node,
left,
right,
start,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how to test the code format change 😄

@JamesHenry
Copy link
Member

Thanks a lot for this @estevezluis!

@JamesHenry JamesHenry merged commit 1d3ed7e into angular-eslint:main Mar 15, 2024
6 of 7 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.

[eqeqeq] Incorrectly updates the template when run with '--fix' option
2 participants