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(utils): support passing data and suggestions individually for each error #491

Conversation

rafaelss95
Copy link
Member

@rafaelss95 rafaelss95 commented May 20, 2021

With this PR we can now test data and suggestions individually for each error. Now, the test fail if we try to test something that uses data properties without passing data.

In addition, it improves the types, making it mandatory and mutually exclusive to pass one of the two properties: messageId or messages, so there is no longer a need to throw a compile-time error.

@rafaelss95 rafaelss95 changed the title fix(utils): support passing data and suggestions individually for each error fix(utils): support passing data and suggestions individually for each error May 20, 2021
@rafaelss95 rafaelss95 force-pushed the fix/utils-convertAnnotatedSourceToFailureCase branch from 02ba534 to 7cbecb4 Compare May 20, 2021 00:09
@nx-cloud
Copy link

nx-cloud bot commented May 20, 2021

Nx Cloud Report

CI ran the following commands for commit e6aa98e. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=build --all --parallel
#000000 nx run-many --target=check-configs --all --parallel
#000000 nx run-many --target=test --all --parallel
#000000 nx run-many --target=typecheck --all --parallel

Sent with 💌 from NxCloud.

@rafaelss95 rafaelss95 force-pushed the fix/utils-convertAnnotatedSourceToFailureCase branch 8 times, most recently from 82308a6 to 53e4915 Compare May 20, 2021 03:55
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.

@rafaelss95 Thanks for working on this, but you have mixed in a number of subjective and unrelated changes (particularly to rule messages) to the core purpose of the PR.

Please revert them, and if you feel strongly about them, apply them in other PRs because it is impractical to review this in its current form

@rafaelss95
Copy link
Member Author

@JamesHenry Ok, let me try to explain why there are so many changes in this PR...

When I changed the implementation of convertAnnotatedSourceToFailureCase to support data (useful atm for no-duplicate-attributes and cyclomatic-complexity - changes in this PR -) and suggestions (useful for #486 and #489 (now that you mentioned there)) individually, the data and suggestions have become mandatory, so in any case this PR will have to touch at least the rules test files.

So when I started to fill the data property in tests, I realized that in addition to having some unnecessary information present in the messages that are really exhausting to fill like {{className}} for each report (previously discussed in mgechev/codelyzer#778 (comment)), there was a lot that could be improved in rules that deals with prefix/suffix using toHumanReadableText for example.

I tried to separate the changes to the maximum in each rule by the commits to facilitate the review proccess, but it seems that it isn't easy yet 😞 .

I confess that thought about not messing with the non .test.ts files, but then I thought it would be redundant to just add data and suggestions to this PR and then send pull requests in sequence changing everything again 🤷‍♂️ .


That being said, do you still think that we should revert all changes in non .test.ts files and create PRs changing the rules' messages and tests?

@JamesHenry
Copy link
Member

@rafaelss95 I definitely think it's a good change overall, but it does mean we have to discuss a few changes to those messages before this can be merged. Based on what you have said I will do that here

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.

Many thanks!

packages/eslint-plugin/src/rules/component-class-suffix.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/component-selector.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/contextual-lifecycle.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/directive-selector.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/directive-class-suffix.ts Outdated Show resolved Hide resolved
packages/eslint-plugin/src/rules/no-input-rename.ts Outdated Show resolved Hide resolved
@rafaelss95 rafaelss95 force-pushed the fix/utils-convertAnnotatedSourceToFailureCase branch from a701819 to 13413ad Compare May 22, 2021 15:55
@rafaelss95 rafaelss95 force-pushed the fix/utils-convertAnnotatedSourceToFailureCase branch from 13413ad to 94a64fd Compare May 22, 2021 15:57
@JamesHenry
Copy link
Member

Completed another full pass and left effectively the same comment twice

@JamesHenry
Copy link
Member

LGTM, anything more to be done on this branch @rafaelss95?

@rafaelss95
Copy link
Member Author

LGTM, anything more to be done on this branch @rafaelss95?

I think we're done here 🚀.

@JamesHenry JamesHenry merged commit 70b01bd into angular-eslint:master May 22, 2021
@JamesHenry
Copy link
Member

Great, thanks!

@rafaelss95 rafaelss95 deleted the fix/utils-convertAnnotatedSourceToFailureCase branch May 22, 2021 18:00
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