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

[Tests] jsx-indent, jsx-one-expression-per-line: add passing test cases #3314

Merged
merged 1 commit into from Jul 6, 2022

Conversation

ROSSROSALES
Copy link
Contributor

@ROSSROSALES ROSSROSALES commented Jun 29, 2022

Increased test coverage for jsx-one-expression-per-line.js

Fixes #2318

@ROSSROSALES
Copy link
Contributor Author

Passing test cases for issue #2318

@ROSSROSALES ROSSROSALES deleted the pr-2318 branch June 29, 2022 07:15
@ljharb
Copy link
Member

ljharb commented Jun 29, 2022

What happened here? Can you please restore the branch and reopen the PR?

@ROSSROSALES ROSSROSALES restored the pr-2318 branch June 29, 2022 17:02
@ROSSROSALES
Copy link
Contributor Author

I apologize, I think I pushed to master branch before my forked repo. I noticed more failing testing cases that is also why I deleted the branch but I will restore the branch and reopen the PR.
I hope to learn from this and ask for guidance moving forward!

@ROSSROSALES ROSSROSALES reopened this Jun 29, 2022
@ljharb
Copy link
Member

ljharb commented Jun 29, 2022

I think we should add the exact test code from the issue:

  <Layout>
    <SEO title="Home" />
    <h1>{"Hi people"}<button/></h1>
    <p>Welcome to your new Gatsby site.</p>
    <p>Now go build something great.</p>
    <h1>Hi people<button/></h1>
    <div style={{ maxWidth: `300px`, marginBottom: `1.45rem` }}>
      <Image />
    </div><Link to="/page-2/">Go to page 2</Link>
  </Layout>

@ROSSROSALES
Copy link
Contributor Author

I think we should add the exact test code from the issue:

  <Layout>
    <SEO title="Home" />
    <h1>{"Hi people"}<button/></h1>
    <p>Welcome to your new Gatsby site.</p>
    <p>Now go build something great.</p>
    <h1>Hi people<button/></h1>
    <div style={{ maxWidth: `300px`, marginBottom: `1.45rem` }}>
      <Image />
    </div><Link to="/page-2/">Go to page 2</Link>
  </Layout>

Sorry if I ask a lot of questions, but just to clarify:

  • under tests/rules/jsx-one-expression-per-line.js, I would be adding above code to the invalid: parsers.all, then provide the appropriate output?
    if so,
  • since the issue is using two rules (one-expression-per-line and indent), would it be appropriate to take the suggested output of jsx-one-expression-per-line.js, and also add it to in tests/rules/jsx-indent.js invalid: parsers.all ?

Thank you for the guidance!
Please let me know if my thinking/approach is appropriate, or if I am deviating away from the solution.

@ljharb
Copy link
Member

ljharb commented Jun 29, 2022

Yep, exactly! I'd expect the same test input to be added to both rules' test files, each covering the autofix output of the relevant rule.

@codecov
Copy link

codecov bot commented Jul 4, 2022

Codecov Report

Merging #3314 (86bc0db) into master (1948765) will not change coverage.
The diff coverage is n/a.

❗ Current head 86bc0db differs from pull request most recent head 151a6ed. Consider uploading reports for the commit 151a6ed to get more accurate results

@@           Coverage Diff           @@
##           master    #3314   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files         123      123           
  Lines        8777     8777           
  Branches     3184     3184           
=======================================
  Hits         8576     8576           
  Misses        201      201           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1948765...151a6ed. Read the comment docs.

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.

Looks great!

tests/lib/rules/jsx-one-expression-per-line.js Outdated Show resolved Hide resolved
tests/lib/rules/jsx-one-expression-per-line.js Outdated Show resolved Hide resolved
tests/lib/rules/jsx-one-expression-per-line.js Outdated Show resolved Hide resolved
tests/lib/rules/jsx-one-expression-per-line.js Outdated Show resolved Hide resolved
@ljharb ljharb force-pushed the pr-2318 branch 2 times, most recently from 414159e to 437fe3c Compare July 5, 2022 22:00
@ljharb ljharb changed the title added test cases, issue #2318 [Tests] jsx-indent, jsx-one-expression-per-line: add passing test cases Jul 5, 2022
@ljharb ljharb merged commit 151a6ed into jsx-eslint:master Jul 6, 2022
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.

[react/jsx-one-expression-per-line] moves text to the beginning of line
2 participants