import-js / import-js/eslint-plugin-import

Rule proposal: sort export

Open
#659 5 comments 7 reactions 0 assignees View on GitHub
evaluating import/export ordering rule proposal
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

I'd like to be able to sort exports in a file when file only contains exports, e.g.

```js
// @flow

export type ScraperSourceType = {
country: string,
nid: string,
name: string,
url: string
};

export type ScraperFeaturesType = {
hasTimeAttributes: Array,
hasTimeUrls: boolean
};

export type ScraperType = {
source: ScraperSourceType,
features: ScraperFeaturesType,
scrapeVenues: Function,
scrapeMovies: Function,
scrapeShowtimes: Function
};
```

This file only contains exports. I'd like the latter to become into:

```js
// @flow

export type ScraperFeaturesType = {
hasTimeAttributes: Array,
hasTimeUrls: boolean
};

export type ScraperSourceType = {
country: string,
nid: string,
name: string,
url: string
};

export type ScraperType = {
source: ScraperSourceType,
features: ScraperFeaturesType,
scrapeVenues: Function,
scrapeMovies: Function,
scrapeShowtimes: Function
};
```

Contributor guide

Open the contributing guide

Research direction

The issue does not name implementation files or tests. Start by locating the plugin's existing sorting or export-related rules and their test fixtures, then determine how a rule should recognize files containing only exports. Done means the requested export ordering is enforced without changing files that contain other statements.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.