Skip to content

key-spacing + align: 'value' + jsx objects becomes ugly sometimes #11414

@a-x-

Description

@a-x-

screenshot 2019-02-19 at 18 51 23

image

👀 Look at the repo with minimal reproducible example (dependencies, config, source): https://github.com/a-x-/eslint-align-check






environment

  • ESLint Version: latest (5.13.0)
  • Node Version: latest (11.9.0)
  • npm Version: latest (6.8.0)

parser: Babel-ESLint

minimal configuration: (full config has no sense never : )

{
  "plugins": [
    "react",
  ],
  "rules": {
    "key-spacing": ["warn", {
      "multiLine": {"align": "value"},
    }],
    // some related a bit rules
    "object-curly-newline": ["warn", { "multiline": true, "minProperties": 5 }],
    "object-property-newline": ["warn", {"allowAllPropertiesOnSameLine": true }],
    "object-curly-spacing": ["warn", "always", {
      "arraysInObjects": false,
      "objectsInObjects": false,
    }],
    // ...
  },
}

source and command

source before eslint --fix ran
function Component () {
      return <div>
        <span style={{ display: 'inline-block', marginRight: '10px' }}>
          <Fa
            icon={ d.icon }
            style={{ marginRight: '4px', color: '#0C090A', opacity: '0.6', fontSize: '18px', verticalAlign: 'middle' }}
          />
          <span style={{ verticalAlign: 'bottom' }}>{ d.title }</span>
        </span>
        <span>
          <Fa
            icon="location-arrow"
            style={{ marginRight: '4px', color: '#0C090A', opacity: '0.6', fontSize: '18px', verticalAlign: 'middle' }}
          />
          <span style={{ verticalAlign: 'bottom' }}>{ this.state.info?.device.app_version }</span>
          <br />
          <span style={{ color: '#999999' }} title="Когда последний раз делал что-то в приложении">
            { this.state.info?.device.last_request_at }
          </span>
        </span>
      </div>;
}
eslint --fix file.jsx

Expected: don't re-align objects in jsx curlies.

PR? I'm not sure, maybe I can.

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionautofixThis change is related to ESLint's autofixing capabilitiesbugESLint is working incorrectlyhelp wantedThe team would welcome a contribution from the community for this issueruleRelates to ESLint's core rules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions