Skip to content

[Question]: jsx-curly-spacing not working for string literals in jsx #3503

@gizembg

Description

@gizembg

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

I have jsx-curly-spacing rule in my eslintlc.js file and it is working just except one condition.
Is there any missing rule definition I had to add or is that a bug?

Eslint rule:

 'react/jsx-curly-spacing': [ 1, { 'when': 'always', 'spacing': { 'objectLiterals': 'never' } } ] 

It is working formatted code example. There are spaces between curly braces.

 <input className = { `text-container-input ${preText ? 'pre-text' : ''}` } disabled = { isDisabled } maxLength = { 50 } type = { type } value = { text } /> 

However in that case there is no space is added after formatting:

<label> {`${title}` } </label> 

Summary: I want to have space between curly braces and backtick(`) as I show on EXPECTED part.
What I am missing here?

Expected Behavior

EXPECTED:

<label> { `${title}` } </label> 

eslint-plugin-react version

v7.26.1

eslint version

v8.1.0

node version

v16.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions