eslint-plugin-import-structure 0.10.2 → 0.10.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/dist/index.js +11 -11
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -32,9 +32,9 @@ function groupName(group) {
32
32
  * Orders specifiers by code point rather than locale, so the result does not
33
33
  * depend on collation rules that quietly ignore punctuation.
34
34
  */
35
- function compareSpecifiers(a, b) {
36
- if (a < b) return -1;
37
- return a > b ? 1 : 0;
35
+ function compareSpecifiers(left, right) {
36
+ if (left < right) return -1;
37
+ return left > right ? 1 : 0;
38
38
  }
39
39
  /**
40
40
  * Whether an import only runs a module for its side effects, as in
@@ -45,8 +45,8 @@ function isSideEffect(node) {
45
45
  return node.specifiers.length === 0;
46
46
  }
47
47
  /** Sorts imports by group, then by specifier. */
48
- function compareEntries(a, b) {
49
- return a.group - b.group || compareSpecifiers(a.specifier, b.specifier);
48
+ function compareEntries(left, right) {
49
+ return left.group - right.group || compareSpecifiers(left.specifier, right.specifier);
50
50
  }
51
51
  /**
52
52
  * The imports in their fixed order: side-effect imports keep their places,
@@ -297,7 +297,7 @@ function readConfig(configPath, configDir) {
297
297
  if (!byTarget.has(entry.target)) byTarget.set(entry.target, entry);
298
298
  }
299
299
  if (entries.length === 0 && patterns.length === 0) return null;
300
- patterns.sort((a, b) => b.prefix.length - a.prefix.length);
300
+ patterns.sort((left, right) => right.prefix.length - left.prefix.length);
301
301
  return {
302
302
  configDir,
303
303
  entries,
@@ -476,9 +476,9 @@ const NEWLINE_PATTERN = /\n/gu;
476
476
  * `SCREAMING_CASE` constants. Sorting those by code point would clump them by
477
477
  * case, which hides the alphabetical order a reader is scanning for.
478
478
  */
479
- function compareMembers(a, b) {
480
- const lowered = compareSpecifiers(a.toLowerCase(), b.toLowerCase());
481
- return lowered === 0 ? compareSpecifiers(a, b) : lowered;
479
+ function compareMembers(left, right) {
480
+ const lowered = compareSpecifiers(left.toLowerCase(), right.toLowerCase());
481
+ return lowered === 0 ? compareSpecifiers(left, right) : lowered;
482
482
  }
483
483
  /**
484
484
  * The names inside the braces of an import, in source order. Default and
@@ -511,7 +511,7 @@ function fixMemberOrder(source, node, members) {
511
511
  const end = last.range[1];
512
512
  if (hasCommentWithin(source, node.range[0], node.range[1])) return null;
513
513
  const text = source.text;
514
- const sorted = members.toSorted((a, b) => compareMembers(memberName(a), memberName(b)));
514
+ const sorted = members.toSorted((left, right) => compareMembers(memberName(left), memberName(right)));
515
515
  const multiline = text.slice(start, end).includes("\n");
516
516
  const lead = text.slice(text.lastIndexOf("\n", start) + 1, start);
517
517
  if (multiline && lead.trim() !== "") return null;
@@ -1138,7 +1138,7 @@ const MODULES = [
1138
1138
  const basePlugin = {
1139
1139
  meta: {
1140
1140
  name: "eslint-plugin-import-structure",
1141
- version: "0.10.2",
1141
+ version: "0.10.3",
1142
1142
  namespace: NAMESPACE
1143
1143
  },
1144
1144
  rules: Object.fromEntries(rules)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-import-structure",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "ESLint and Oxlint rules that keep a module graph layered and free of cycles, with package.json \"#\" imports as the layer order.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -45,6 +45,7 @@
45
45
  "@typescript-eslint/types": "^8.71.1",
46
46
  "eslint": "^9.39.5",
47
47
  "eslint-doc-generator": "^3.7.1",
48
+ "eslint-plugin-explicit-types": "^0.7.0",
48
49
  "vite-plus": "^1.1.0"
49
50
  },
50
51
  "engines": {