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[jsx-curly-brace-presence] Fix error related to tag line breaks #2521

Conversation

@rafbgarcia
Copy link
Contributor

rafbgarcia commented Dec 12, 2019

Fixes #1727

Before:

  4107 passing (7s)
  1 failing

  1) jsx-curly-brace-presence
       valid

        <MyComponent prop="asdasd">
          <div>
            <p>
              <span>
                {"foo"}
              </span>
            </p>
          </div>
        </MyComponent>
      :

      AssertionError [ERR_ASSERTION]: Should have no errors but had 8: [ { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 2,
    column: 36,
    nodeType: 'Literal',
    endLine: 3,
    endColumn: 11 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 3,
    column: 16,
    nodeType: 'Literal',
    endLine: 4,
    endColumn: 13 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 4,
    column: 16,
    nodeType: 'Literal',
    endLine: 5,
    endColumn: 15 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 5,
    column: 21,
    nodeType: 'Literal',
    endLine: 6,
    endColumn: 17 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 6,
    column: 24,
    nodeType: 'Literal',
    endLine: 7,
    endColumn: 15 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 7,
    column: 22,
    nodeType: 'Literal',
    endLine: 8,
    endColumn: 13 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 8,
    column: 17,
    nodeType: 'Literal',
    endLine: 9,
    endColumn: 11 },
  { ruleId: 'jsx-curly-brace-presence',
    severity: 1,
    message: 'Need to wrap this literal in a JSX expression.',
    line: 9,
    column: 17,
    nodeType: 'Literal',
    endLine: 10,
    endColumn: 9 } ]
      + expected - actual

      -8
      +0
Fixes #1727.
@rafbgarcia
Copy link
Contributor Author

rafbgarcia commented Dec 12, 2019

@ljharb can you please take a look as this is currently a blocker to use this lint?

@ljharb
ljharb approved these changes Dec 12, 2019
Copy link
Collaborator

ljharb left a comment

Thanks, appreciate the test case.

lib/rules/jsx-curly-brace-presence.js Outdated Show resolved Hide resolved
lib/rules/jsx-curly-brace-presence.js Show resolved Hide resolved
@ljharb ljharb added the bug label Dec 12, 2019
@ljharb ljharb force-pushed the rafbgarcia:fix/jsx-curly-brace-presence-tag-line-break branch from e83d806 to 0f8d790 Dec 13, 2019
@ljharb ljharb merged commit 0f8d790 into yannickcr:master Dec 13, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.0001%) to 97.531%
Details
@rafbgarcia rafbgarcia deleted the rafbgarcia:fix/jsx-curly-brace-presence-tag-line-break branch Dec 13, 2019
@rafbgarcia
Copy link
Contributor Author

rafbgarcia commented Dec 13, 2019

@ljharb do you plan to release a patch version for this bug or should I use master for now?

@ljharb
Copy link
Collaborator

ljharb commented Dec 13, 2019

I plan to release a version soon, yes (it'll be a minor, i suspect).

@rafbgarcia
Copy link
Contributor Author

rafbgarcia commented Dec 13, 2019

I found other edge cases and am working on fixes.

@ljharb
Copy link
Collaborator

ljharb commented Dec 13, 2019

That's great, I look forward to the PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.