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

[Test] parsers.all augments suggestion code output #3154

Merged

Conversation

duncanbeevers
Copy link
Contributor

@duncanbeevers duncanbeevers commented Dec 11, 2021

In order to generate suggestions for #2921 I need support for augmenting suggestions in the parsers.all work, to ensure my spec examples get decorated with the extraComment.

🗣 Discussion

parsers.all generates an extraComment which is appended to test case examples and their expected output.
Eslint's suggestions API also allows recommended code changes, and RuleTester compares expected changes against generated changes. However, parsers.all didn't augment these expected outputs with the extraComment.

2021-12-10 at 8 28 PM

📋 Next steps

I intend to include these changes with the hook-use-state PR where the utility will be more obvious, but I wanted to open discussion here in case my approach needs to be refined, and to keep the already long-running hook-use-state PR focused.

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Seems good (i retitled the PR, because [New] is for semver-minor things in the real code, not test things)

tests/helpers/parsers.js Outdated Show resolved Hide resolved
tests/helpers/parsers.js Outdated Show resolved Hide resolved
@ljharb ljharb changed the title [New] parsers.all augments suggestion code output [Test] parsers.all augments suggestion code output Dec 11, 2021
@duncanbeevers
Copy link
Contributor Author

i retitled the PR, because [New] is for semver-minor things

👍 I'll update the commit message when I squash this.

parsers.all generates an extraComment which is appended to test case examples and their expected output.
Eslint's suggestions API also allows recommended code changes, and RuleTester compares expected changes against generated changes. However, parsers.all didn't augment these expected outputs with the extraComment.
tests/helpers/parsers.js Outdated Show resolved Hide resolved
@duncanbeevers duncanbeevers force-pushed the parsers-all-suggestions-extra-comment branch from d159eea to f7943d5 Compare December 11, 2021 07:05
@ljharb ljharb merged commit f7943d5 into jsx-eslint:master Dec 11, 2021
@duncanbeevers duncanbeevers deleted the parsers-all-suggestions-extra-comment branch December 11, 2021 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants