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): [no-empty-lifecycle-method] incorrect suggestions and correct reports #606

Merged
merged 5 commits into from
Aug 31, 2021

Conversation

rafaelss95
Copy link
Member

@rafaelss95 rafaelss95 commented Jul 21, 2021

In addittion to the fix on suggestion, it now reports literal MethodDefinitions and removes interfaces within MemberExpressions.

Fixes #604.

@rafaelss95 rafaelss95 force-pushed the fix/604 branch 3 times, most recently from 67334c1 to 57ef860 Compare July 21, 2021 21:20
@codecov
Copy link

codecov bot commented Jul 21, 2021

Codecov Report

Merging #606 (1399bb9) into master (5552b13) will decrease coverage by 0.01%.
The diff coverage is 91.17%.

@@            Coverage Diff             @@
##           master     #606      +/-   ##
==========================================
- Coverage   85.76%   85.75%   -0.02%     
==========================================
  Files          89       89              
  Lines        2424     2443      +19     
  Branches      421      430       +9     
==========================================
+ Hits         2079     2095      +16     
  Misses        205      205              
- Partials      140      143       +3     
Impacted Files Coverage Δ
packages/eslint-plugin/src/utils/utils.ts 86.53% <86.95%> (-0.60%) ⬇️
...slint-plugin/src/rules/no-conflicting-lifecycle.ts 100.00% <100.00%> (ø)
...lint-plugin/src/rules/no-empty-lifecycle-method.ts 95.23% <100.00%> (+1.90%) ⬆️
packages/eslint-plugin/src/utils/selectors.ts 100.00% <100.00%> (ø)

@rafaelss95 rafaelss95 force-pushed the fix/604 branch 4 times, most recently from 911edf4 to d959f66 Compare July 21, 2021 22:59
@rafaelss95 rafaelss95 changed the title fix(eslint-plugin): [no-empty-lifecycle-method] correct remove node on suggestion fix(eslint-plugin): [no-empty-lifecycle-method] incorrect suggestions and correct reports Jul 21, 2021
@rafaelss95 rafaelss95 force-pushed the fix/604 branch 4 times, most recently from daa28f6 to 328968c Compare July 23, 2021 00:30
Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

Sorry about the conflicts from when the doc generation work went in

@@ -67,12 +63,6 @@ export default createESLintRule<Options, MessageIds>({
interfaceName,
fixer,
),
getImportRemoveFix(
Copy link
Member Author

@rafaelss95 rafaelss95 Aug 28, 2021

Choose a reason for hiding this comment

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

I'm proposing to remove it because we can't guarantee that the import is only being used for this class, in other words it might be being used in another class(es) also in the same file and so we could probably be suggesting a code that does not compile. Does that make sense for you, @JamesHenry?

Copy link
Member

Choose a reason for hiding this comment

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

Can we do a simple string-based check on the file contents for that?

If there is more than one occurrence of the string, we leave it (yes, this could have false positives, e.g. from comments, but still better than never removing it for the common case), if there is only one occurrence (the import) then we remove it?

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed! I've submitted this check, PTAL!

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

See my comment response and there are conflicts from one of your earlier PRs being merged

@JamesHenry JamesHenry enabled auto-merge (squash) August 31, 2021 15:50
@JamesHenry JamesHenry merged commit a446e8f into angular-eslint:master Aug 31, 2021
@rafaelss95 rafaelss95 deleted the fix/604 branch August 31, 2021 16:12
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.

[no-empty-lifecycle-method] also removes everything after extends keyword
2 participants