@so1ve/eslint-plugin-sort-imports 0.105.2 → 0.105.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/shared.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin-sort-imports",
3
- "version": "0.105.2",
3
+ "version": "0.105.3",
4
4
  "author": "Simon Lydell",
5
5
  "contributors": [
6
6
  "Ray (https://github.com/so1ve) <i@mk1.io>"
package/src/shared.js CHANGED
@@ -48,12 +48,20 @@ const naturalSort = natsort.default();
48
48
  function compare(path1, path2) {
49
49
  const path1Depth = path1.split("-").filter((p) => p === "__").length;
50
50
  const path2Depth = path2.split("-").filter((p) => p === "__").length;
51
+ const path1IsDot = path1 === "_-,";
52
+ const path2IsDot = path2 === "_-,";
53
+
54
+ if (path1IsDot && !path2IsDot) {
55
+ return 1;
56
+ }
57
+ if (path2IsDot && !path1IsDot) {
58
+ return -1;
59
+ }
51
60
 
52
61
  return path1Depth === path2Depth
53
62
  ? naturalSort(path1, path2)
54
63
  : path2Depth - path1Depth;
55
64
  }
56
-
57
65
  const isIdentifier = (node) => node.type === "Identifier";
58
66
 
59
67
  const isKeyword = (node) => node.type === "Keyword";