gajus / gajus/eslint-plugin-flowtype

Rule sortKeys breaks type format when declared before an object

Open
#452 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.1k
Forks
151
PR merge metrics
No merged PRs in 30d

Description

When `eslint-plugin-flowtype` try to format the following code:

```js
type FooType = {|
c: number,
b: number,
a: number
|}

const Dummy = {
a: true
}
```

It generates the following result:

```js
type FooType = {|
a: number
|}

const Dummy,
b: number,
a: number
|}

const Dummy = {
a: true
}
```

I created [a branch](https://github.com/gajus/eslint-plugin-flowtype/compare/master...luisfmsouza:chore/sort-keys) with this broken scenario.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the Flow type and object shown in the report, then inspect the sortKeys rule and the comparison branch linked in the issue. Done means the rule sorts the properties without moving type members into the following const declaration, while preserving valid Flow and JavaScript syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.