-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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-newline - TypeError: Cannot read properties of undefined (reading 'loc') #3633
Closed
2 tasks done
Labels
Comments
This is great! I just bumped into this issues too. Is there a plan to create a new release with the last changes? |
This was referenced May 24, 2024
This was referenced Jun 18, 2024
This was referenced Oct 3, 2024
This was referenced Oct 4, 2024
This was referenced Oct 4, 2024
This was referenced Oct 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
Description Overview
The jsx-newline rule is broken with this options on the given source code.
Oops! Something went wrong! :(
ESLint: 8.49.0
TypeError: Cannot read properties of undefined (reading 'loc')
Occurred while linting .../Foo.tsx:1
Rule: "react/jsx-newline"
at isMultilined (\node_modules\eslint-plugin-react\lib\rules\jsx-newline.js:23:15)
at \node_modules\eslint-plugin-react\lib\rules\jsx-newline.js:111:22
at Array.forEach ()
at \node_modules\eslint-plugin-react\lib\rules\jsx-newline.js:87:27
at Set.forEach ()
at Program:exit (\node_modules\eslint-plugin-react\lib\rules\jsx-newline.js:86:27)
at ruleErrorHandler (\node_modules\eslint\lib\linter\linter.js:1051:28)
at \node_modules\eslint\lib\linter\safe-emitter.js:45:58
at Array.forEach ()
at Object.emit (\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
I tried to take out parts from the code line by line and when the { ...Array.from(this.children) } part is missing then it works well.
(a few minutes later)
Ok, the rule is broken when you wanna use spread something in the JSX.
Expected Behavior
The rule autofixes the code to this:
eslint-plugin-react version
v7.33.2
eslint version
v8.49.0
node version
v20.3.1
The text was updated successfully, but these errors were encountered: