eslint-plugin-flawless 0.1.7 → 0.1.8

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/dist/index.mjs +10 -6
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { findVariable } from "@typescript-eslint/utils/ast-utils";
8
8
  import { getStaticTOMLValue } from "toml-eslint-parser";
9
9
  //#region package.json
10
10
  var name = "eslint-plugin-flawless";
11
- var version = "0.1.7";
11
+ var version = "0.1.8";
12
12
  var repository = {
13
13
  "url": "git+https://github.com/christopher-buss/eslint-plugin-flawless.git",
14
14
  "type": "git"
@@ -2474,14 +2474,18 @@ function makeFallback(config) {
2474
2474
  /**
2475
2475
  * Builds a comparator for one table body. Explicit-order entries sort first by
2476
2476
  * their listed position, then unlisted entries fall back to a natural/asc sort
2477
- * (mirroring `yaml/sort-keys`). At the top level, bare key-values are always
2478
- * kept before any `[table]` header, since TOML would otherwise re-scope them.
2477
+ * (mirroring `yaml/sort-keys`). The fallback compares keys as written in
2478
+ * source, so quotes participate in the order and quoted keys (e.g.
2479
+ * `"github:owner/repo"`) group before bare keys. At the top level, bare
2480
+ * key-values are always kept before any `[table]` header, since TOML would
2481
+ * otherwise re-scope them.
2479
2482
  *
2480
2483
  * @param order - The order configuration for this table's path.
2481
2484
  * @param isTopLevel - Whether the body is the top-level table.
2485
+ * @param rawName - Returns an entry's key exactly as written in source.
2482
2486
  * @returns A comparator over two entries.
2483
2487
  */
2484
- function makeComparator(order, isTopLevel) {
2488
+ function makeComparator(order, isTopLevel, rawName) {
2485
2489
  const rank = Array.isArray(order) ? makeRank(order) : void 0;
2486
2490
  const fallback = makeFallback(Array.isArray(order) ? {
2487
2491
  natural: true,
@@ -2502,7 +2506,7 @@ function makeComparator(order, isTopLevel) {
2502
2506
  return aRank - bRank;
2503
2507
  }
2504
2508
  }
2505
- return fallback(nameOf(a), nameOf(b));
2509
+ return fallback(rawName(a), rawName(b));
2506
2510
  };
2507
2511
  }
2508
2512
  function create$1(context) {
@@ -2581,7 +2585,7 @@ function create$1(context) {
2581
2585
  const order = resolveOrder(path);
2582
2586
  if (order === void 0) return;
2583
2587
  const entries = [...body];
2584
- const target = [...entries].sort(makeComparator(order, isTopLevel));
2588
+ const target = [...entries].sort(makeComparator(order, isTopLevel, (entry) => sourceCode.getText(entry.key)));
2585
2589
  let outOfPlace;
2586
2590
  for (const [index, entry] of entries.entries()) if (entry !== target[index]) {
2587
2591
  outOfPlace = entry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-flawless",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Your ESLint plugin description",
5
5
  "keywords": [
6
6
  "eslint",