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

[Bug]: jsx-curly-newline and comments #3584

Open
2 tasks done
josemigallas opened this issue Jun 7, 2023 · 6 comments
Open
2 tasks done

[Bug]: jsx-curly-newline and comments #3584

josemigallas opened this issue Jun 7, 2023 · 6 comments

Comments

@josemigallas
Copy link

josemigallas commented Jun 7, 2023

Is there an existing issue for this?

  • I have searched the existing issues and my issue is unique
  • My issue appears in the command-line and not only in the text editor

Description Overview

jsx-curly-newline reports an error when using multiline comments in JSX.

      {/* <FormGroup
        helperTextInvalid={helperText}
        inputProps={inputProps}
        type="password"
      /> */}
  134:7   error  Unexpected newline after '{'                             react/jsx-curly-newline
  138:12  error  Unexpected newline before '}'                            react/jsx-curly-newline

$ eslint --ext .js,.jsx,.ts,.tsx .

Expected Behavior

I would expect no error.

Rule options

"react/jsx-curly-newline": ["error", { "multiline": "forbid", "singleline": "forbid" }],

eslint-plugin-react version

7.32.2

eslint version

7.32.0

node version

14.21.3

@ljharb
Copy link
Member

ljharb commented Jun 7, 2023

if you removed the comment delimiters, what would happen?

@ROSSROSALES
Copy link
Contributor

I am unable to recreate this error with your example. @josemigallas, were you able to resolve this issue?

@ljharb
Copy link
Member

ljharb commented Mar 26, 2024

Closing, but will reopen if it can be reproduced.

@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
@josemigallas
Copy link
Author

Apologies, I lost track of this issue but I have not been able to fix it yet.

if you removed the comment delimiters, what would happen?

Like this?

      { <FormGroup
        helperTextInvalid={helperText}
        inputProps={inputProps}
        type="password"
      /> }

The error doesn't show up, but others do:

  57:7   error  Curly braces are unnecessary here                                             react/jsx-curly-brace-presence
  57:10  error  'FormGroup' is not defined                                                    react/jsx-no-undef
  58:28  error  Unsafe assignment of an `any` value                                           @typescript-eslint/no-unsafe-assignment
  59:21  error  Unsafe assignment of an `any` value                                           @typescript-eslint/no-unsafe-assignment
  61:7   error  The closing bracket must be aligned with the opening tag (expected column 9)  react/jsx-closing-bracket-location

It also doesn't show with one line comments like:

{/* <FormGroup ... */}

@ljharb ljharb reopened this Mar 26, 2024
@ROSSROSALES
Copy link
Contributor

@josemigallas thanks for responding!
Just to make sure, is it possible to see your jsx-curly-newline rule options?

@josemigallas
Copy link
Author

josemigallas commented Apr 2, 2024

@josemigallas thanks for responding! Just to make sure, is it possible to see your jsx-curly-newline rule options?

"react/jsx-curly-newline": ["error", { "multiline": "forbid", "singleline": "forbid" }],

I also added it to the issue's description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants