Skip to content

jsx-one-expression-per-line fix option inserts blank lines #1835

Closed
@webOS101

Description

@webOS101

eslint-plugin-react 7.9.1

If the content of a tag contains only text, extra blank lines are inserted after the text (and the indentation is not correct). If the interior is a jsx expression, the output is correct.

	<div>
		<MyComponent>a</MyComponent>
		<MyOther>{a}</MyOther>
	</div>

results in:

	<div>
		<MyComponent>
a
		
		
		
		
		</MyComponent>
		<MyOther>
			{a}
		</MyOther>
	</div>

.eslintrc:

{
	"parser": "babel-eslint",
	"plugins": [
		"react",
		"babel"
	],
	"rules": {
		"indent": [1, "tab"],
		"react/jsx-one-expression-per-line": 1
	}
}

Note: If you leave out indent it does not insert the extra spaces following the string content but does not indent any of the fixed code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions