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-self-closing-tags] improve code style of fixer result #1520

Conversation

json-derulo
Copy link
Contributor

@json-derulo json-derulo commented Sep 8, 2023

Currently when running the fixer of the prefer-self-closing-tags rule, in some scenarios a result is generated, which is considered as bad code style by common sense and formatters like prettier. More specifically, currently the fixer always adds an additional whitespace before the self closing tag. However when the end of the starting tag is indented or on a new line, this additional whitespace produces misalignment.

For example, take the following code:

<my-component
  someAttribute="someValue"
></my-component>

Currently the fixer would produce the following reusult:

<my-component
  someAttribute="someValue"
 />

With the changes of this PR it would become:

<my-component
  someAttribute="someValue"
/>

@nx-cloud
Copy link

nx-cloud bot commented Sep 8, 2023

☁️ Nx Cloud Report

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

📂 See all runs for this branch


✅ Successfully ran 7 targets

Sent with 💌 from NxCloud.

@json-derulo json-derulo force-pushed the prefer-self-closing-tag-fixer-code-style branch 2 times, most recently from 396b002 to 6101c80 Compare September 8, 2023 12:42
@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Merging #1520 (fef5383) into main (2e4af4d) will increase coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1520      +/-   ##
==========================================
+ Coverage   89.23%   89.24%   +0.01%     
==========================================
  Files         162      162              
  Lines        3056     3059       +3     
  Branches      521      522       +1     
==========================================
+ Hits         2727     2730       +3     
  Misses        201      201              
  Partials      128      128              
Flag Coverage Δ
unittest 89.24% <ø> (+0.01%) ⬆️

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

Files Changed Coverage Δ
...gin-template/src/rules/prefer-self-closing-tags.ts 100.00% <ø> (ø)
...late/tests/rules/prefer-self-closing-tags/cases.ts 100.00% <ø> (ø)
📢 Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=angular-eslint).

@json-derulo json-derulo force-pushed the prefer-self-closing-tag-fixer-code-style branch from 6101c80 to 65d5e60 Compare September 8, 2023 15:32
@json-derulo json-derulo force-pushed the prefer-self-closing-tag-fixer-code-style branch from 65d5e60 to fef5383 Compare September 8, 2023 16:24
@JamesHenry JamesHenry merged commit 6a86f19 into angular-eslint:main Sep 16, 2023
14 checks passed
@JamesHenry
Copy link
Member

Thanks @json-derulo!

strawberry-choco pushed a commit to strawberry-choco/angular-eslint that referenced this pull request Sep 17, 2023
@json-derulo json-derulo deleted the prefer-self-closing-tag-fixer-code-style branch September 18, 2023 15:26
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.

None yet

2 participants