Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.27 KB

export-members.md

File metadata and controls

51 lines (35 loc) · 1.27 KB

Export Member Sorting (sort/export-members)

🔧 The --fix option on the command line can automatically fix the problems reported by this rule.

Sorts export members alphabetically and case insensitive in ascending order.

Rule Details

Examples of incorrect code for this rule:

export { b, c, a } from "a"
export { C, b } from "a"
export { b as a, a as b } from "a"

Examples of correct code for this rule:

export { a, b, c } from "a"
export { b, C } from "a"
export { a as b, b as a } from "a"

Options

This rule has an options object with the following defaults.

{
  "sort/export-members": ["error", { "caseSensitive": false, "natural": true }]
}

caseSensitive

If true, enforce export members to be in case-sensitive order.

natural

If true, enforce export members to be in natural order. Natural order compares strings containing combination of letters and numbers in the way a human being would sort. For example, a-10 would come after a-3 when using natural ordering.

When Not To Use It

This rule is a formatting preference and not following it won't negatively affect the quality of your code. If alphabetizing export members isn't a part of your coding standards, then you can leave this rule off.