Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Conflict between object-shorthand-properties-first and object-literal-sort-key #3606

Closed
brunolemos opened this issue Dec 23, 2017 · 2 comments · Fixed by #3607
Closed

Conflict between object-shorthand-properties-first and object-literal-sort-key #3606

brunolemos opened this issue Dec 23, 2017 · 2 comments · Fixed by #3607

Comments

@brunolemos
Copy link
Contributor

brunolemos commented Dec 23, 2017

Bug Report

  • TSLint version: ^5.8.0
  • TypeScript version: ^2.6.2
  • Running TSLint via: VSCode

TypeScript code being linted

const a = 'a'
const c = 'c'
const obj = {
  a,
  b: 'b',
  c,
}

with tslint.json configuration:

{
  "extends": ["tslint:recommended", "tslint-config-airbnb", "tslint-react"]
}

Actual behavior

The rules conflict. There isn't a single field ordering that matches both rules, resulting on a non-fixable warning.

a, b, c

object-shorthand-properties-first

a, c, b

object-literal-sort-keys

Expected behavior

Not conflict.

PS: I see this was mentioned on #2040 by @ajafff

Also I noticed object-shorthand-properties-first is from another repo but the fix makes more sense to be inside object-literal-sort-key

@brunolemos
Copy link
Contributor Author

I was about to make a PR but it seems there is already #2831 that fixes this

brunolemos added a commit to brunolemos/tslint that referenced this issue Dec 23, 2017
Fix palantir#3606 (Conflict between object-shorthand-properties-first and object-literal-sort-key)
brunolemos added a commit to brunolemos/tslint that referenced this issue Dec 23, 2017
Fix palantir#3606 (Conflict between object-shorthand-properties-first and object-literal-sort-key)
@brunolemos
Copy link
Contributor Author

I created a PR anyway (#3607) because the existing one was outdated and included other features

brunolemos added a commit to brunolemos/tslint that referenced this issue Dec 23, 2017
Fix palantir#3606 (Conflict between object-shorthand-properties-first and object-literal-sort-key)
brunolemos added a commit to brunolemos/tslint-config-airbnb that referenced this issue Jan 15, 2018
…-sort-key #

`shorthand-first` is available since tslint v5.9.0.
See: palantir/tslint#3606 and palantir/tslint#3607
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant