Skip to content

Commit fb1d3e2

Browse files
author
Ted Weatherly
committed
docs(order): improve wording and provide examples
1 parent d98121e commit fb1d3e2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

docs/rules/order.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ Valid properties and their values include:
385385

386386
- **`caseInsensitive`**: use `true` to ignore case and `false` to consider case when sorting
387387

388-
- **`orderByFullPathString`**: use `false` to split by paths and sort by each one and `true` to sort by the full un-split path string
388+
- **`orderByFullPathString`**: use `true` to sort by the full un-split path string and `false` to split by paths and sort by each one
389+
- enabling this flag may better align with the sort algorithm used by certain operating systems and IDE's, e.g. the Organize Imports action in JetBrains IDE's
389390

390391
#### Example
391392

@@ -396,7 +397,8 @@ Given the following settings:
396397
"import/order": ["error", {
397398
"alphabetize": {
398399
"order": "asc",
399-
"caseInsensitive": true
400+
"caseInsensitive": true,
401+
"orderByFullPathString": true,
400402
}
401403
}]
402404
}
@@ -410,6 +412,8 @@ import aTypes from 'prop-types';
410412
import { compose, apply } from 'xcompose';
411413
import * as classnames from 'classnames';
412414
import blist from 'BList';
415+
import timeUtils1 from '../utils/time'
416+
import timeUtils2 from '../utils-time'
413417
```
414418

415419
While this will pass:
@@ -420,6 +424,11 @@ import * as classnames from 'classnames';
420424
import aTypes from 'prop-types';
421425
import React, { PureComponent } from 'react';
422426
import { compose, apply } from 'xcompose';
427+
// Below the '../utils-time' and '../utils/time' path are not split before ordering ("orderByFullPathString": true).
428+
// Instead, during comparison the "-" in "../utils-time" occurs lexicographically before the
429+
// second "/" in "../utils/time"
430+
import timeUtils2 from '../utils-time'
431+
import timeUtils1 from '../utils/time'
423432
```
424433

425434
### `named`

0 commit comments

Comments
 (0)