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(eslint-plugin): [use-lifecycle-interface] add fixer for the rule #1691

Merged
merged 4 commits into from
May 22, 2024

Conversation

bulldog98
Copy link
Contributor

I got the fixer to work, but could not fix one of the tests, seems to be a white space issue.

@bulldog98 bulldog98 changed the title [request for feedback] feat(eslint-plugin): [use-lifecycle-interface] add fixer for the rule feat(eslint-plugin): [use-lifecycle-interface] add fixer for the rule Jan 11, 2024
@bulldog98 bulldog98 marked this pull request as draft January 11, 2024 21:02
Copy link

nx-cloud bot commented Jan 21, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 87c13f5. 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 6 targets

Sent with 💌 from NxCloud.

@@ -120,6 +138,19 @@ export const invalid = [
},
},
],
annotatedOutput: `
@Injectable()
class Test implements DoBootstrap {
Copy link
Member

Choose a reason for hiding this comment

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

This didn't fix all the issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understood the documentation of eslint correctly the fixes are applied again and again, as long as the lint error is still reported. I'm unsure, how I can use the plugin in a local testing repo to test that out, please advice me on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So yes I found a way to try it out. (run e2e tests and then try your changes in tmp/e2e-fixtures/ in any of the apps there. Maybe that should be documented) Indeed eslint runs again on the output of fixes until there are no changes, so it indeed results in a fix that adds all the implements clauses.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only thing I noticed is that I do not add an import for the Interface, here I would like guidance @JamesHenry

Copy link
Member

Choose a reason for hiding this comment

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

@bulldog98 Sorry for the delay. We have a utility for it used in a few other rules, it's very straightforward: #1829

Copy link
Member

Choose a reason for hiding this comment

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

I want to get things ready for Angular 18, so I went ahead and applied the change

@JamesHenry
Copy link
Member

Thank you @bulldog98! Left some comments

@bulldog98
Copy link
Contributor Author

I'll try to fix the issues, not sure if I have time before the weekend though

Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.46%. Comparing base (4de165d) to head (2b0b762).
Report is 3 commits behind head on main.

Current head 2b0b762 differs from pull request most recent head 87c13f5

Please upload reports for the commit 87c13f5 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1691   +/-   ##
=======================================
  Coverage   90.46%   90.46%           
=======================================
  Files         178      178           
  Lines        3345     3347    +2     
  Branches      536      536           
=======================================
+ Hits         3026     3028    +2     
  Misses        185      185           
  Partials      134      134           
Flag Coverage Δ
unittest 90.46% <100.00%> (+<0.01%) ⬆️

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

Files Coverage Δ
...eslint-plugin/src/rules/use-lifecycle-interface.ts 100.00% <100.00%> (ø)
...lugin/tests/rules/use-lifecycle-interface/cases.ts 100.00% <ø> (ø)

@JamesHenry JamesHenry merged commit 3513d3d into angular-eslint:main May 22, 2024
5 checks passed
@JamesHenry
Copy link
Member

I don't seem to be able to push to the PR, I have added the import fix in a separate commit

@JamesHenry
Copy link
Member

I think it's because you opened the PR from your main branch maybe?

@JamesHenry
Copy link
Member

Thanks again @bulldog98!

@bulldog98
Copy link
Contributor Author

Thanks for adding the import part @JamesHenry, I'll try to keep in mind to open from a separate branch in the future.

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

3 participants