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 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

@rafbgarcia
Copy link
Contributor Author

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

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.

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 fix/jsx-curly-brace-presence-tag-line-break branch from e83d806 to 0f8d790 Compare December 13, 2019 00:01
@ljharb ljharb merged commit 0f8d790 into jsx-eslint:master Dec 13, 2019
@rafbgarcia rafbgarcia deleted the fix/jsx-curly-brace-presence-tag-line-break branch December 13, 2019 00:08
@rafbgarcia
Copy link
Contributor Author

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

@ljharb
Copy link
Member

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

I found other edge cases and am working on fixes.

@ljharb
Copy link
Member

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
Labels
Development

Successfully merging this pull request may close these issues.

react/jsx-curly-brace-presence "children" "always" complains about whitespace
2 participants