uilint-eslint 0.2.122 → 0.2.123

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.
package/dist/index.d.ts CHANGED
@@ -764,6 +764,10 @@ declare const rules: {
764
764
  threshold?: number;
765
765
  indexPath?: string;
766
766
  minLines?: number;
767
+ confidenceLevel?: "high" | "medium" | "low";
768
+ useStructuralBoost?: boolean;
769
+ includeSameFile?: boolean;
770
+ kind?: "component" | "hook" | "function" | "all";
767
771
  }], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
768
772
  name: string;
769
773
  };
@@ -922,6 +926,10 @@ declare const plugin: {
922
926
  threshold?: number;
923
927
  indexPath?: string;
924
928
  minLines?: number;
929
+ confidenceLevel?: "high" | "medium" | "low";
930
+ useStructuralBoost?: boolean;
931
+ includeSameFile?: boolean;
932
+ kind?: "component" | "hook" | "function" | "all";
925
933
  }], unknown, _typescript_eslint_utils_ts_eslint.RuleListener> & {
926
934
  name: string;
927
935
  };
package/dist/index.js CHANGED
@@ -4056,22 +4056,69 @@ var meta13 = defineRuleMeta({
4056
4056
  }
4057
4057
  ],
4058
4058
  postInstallInstructions: "Run 'uilint duplicates index' to build the semantic index before using this rule.",
4059
- defaultOptions: [{ threshold: 0.85, indexPath: ".uilint/.duplicates-index", minLines: 3 }],
4059
+ defaultOptions: [{
4060
+ threshold: 0.75,
4061
+ indexPath: ".uilint/.duplicates-index",
4062
+ minLines: 3,
4063
+ confidenceLevel: "low",
4064
+ useStructuralBoost: true,
4065
+ includeSameFile: false,
4066
+ kind: "all"
4067
+ }],
4060
4068
  optionSchema: {
4061
4069
  fields: [
4062
4070
  {
4063
4071
  key: "threshold",
4064
4072
  label: "Similarity threshold",
4065
4073
  type: "number",
4066
- defaultValue: 0.85,
4067
- description: "Minimum similarity score (0-1) to report as duplicate. Higher = stricter."
4074
+ defaultValue: 0.75,
4075
+ description: "Minimum similarity score (0-1) to report as duplicate. Lower values catch more potential duplicates. Recommended: 0.75 (default), 0.85 (strict), 0.65 (lenient)."
4076
+ },
4077
+ {
4078
+ key: "confidenceLevel",
4079
+ label: "Minimum confidence",
4080
+ type: "select",
4081
+ defaultValue: "low",
4082
+ options: [
4083
+ { value: "high", label: "High (\u226590%) - Likely copy-paste" },
4084
+ { value: "medium", label: "Medium (\u226575%) - Semantically similar" },
4085
+ { value: "low", label: "Low (\u226560%) - Possibly related" }
4086
+ ],
4087
+ description: "Only report duplicates at or above this confidence level. High = fewer but more certain matches."
4088
+ },
4089
+ {
4090
+ key: "useStructuralBoost",
4091
+ label: "Use structural similarity",
4092
+ type: "boolean",
4093
+ defaultValue: true,
4094
+ description: "Boost similarity scores based on structural overlap (props, JSX elements, hooks). Helps catch duplicates with different variable names."
4095
+ },
4096
+ {
4097
+ key: "kind",
4098
+ label: "Code kind filter",
4099
+ type: "select",
4100
+ defaultValue: "all",
4101
+ options: [
4102
+ { value: "all", label: "All code" },
4103
+ { value: "component", label: "Components only" },
4104
+ { value: "hook", label: "Hooks only" },
4105
+ { value: "function", label: "Functions only" }
4106
+ ],
4107
+ description: "Only detect duplicates of a specific code type."
4108
+ },
4109
+ {
4110
+ key: "includeSameFile",
4111
+ label: "Include same-file duplicates",
4112
+ type: "boolean",
4113
+ defaultValue: false,
4114
+ description: "Report duplicates within the same file (e.g., Card and CardAlt in cards.tsx)."
4068
4115
  },
4069
4116
  {
4070
4117
  key: "indexPath",
4071
4118
  label: "Index path",
4072
4119
  type: "text",
4073
4120
  defaultValue: ".uilint/.duplicates-index",
4074
- description: "Path to the semantic duplicates index directory"
4121
+ description: "Path to the semantic duplicates index directory."
4075
4122
  },
4076
4123
  {
4077
4124
  key: "minLines",
@@ -4143,17 +4190,54 @@ export function ProfileCard({ profile }) {
4143
4190
  \`\`\`js
4144
4191
  // eslint.config.js
4145
4192
  "uilint/no-semantic-duplicates": ["warn", {
4146
- threshold: 0.85, // Similarity threshold (0-1)
4147
- indexPath: ".uilint/.duplicates-index",
4148
- minLines: 3 // Minimum lines to report (default: 3)
4193
+ // Core detection settings
4194
+ threshold: 0.75, // Similarity threshold (0-1). Lower = more matches.
4195
+ confidenceLevel: "medium", // "high" (\u226590%), "medium" (\u226575%), "low" (\u226560%)
4196
+
4197
+ // Detection enhancements
4198
+ useStructuralBoost: true, // Boost scores based on props/JSX/hooks overlap
4199
+
4200
+ // Filtering
4201
+ kind: "all", // "all", "component", "hook", "function"
4202
+ includeSameFile: false, // Include duplicates within the same file
4203
+ minLines: 3, // Minimum lines to report
4204
+
4205
+ // Index location
4206
+ indexPath: ".uilint/.duplicates-index"
4149
4207
  }]
4150
4208
  \`\`\`
4151
4209
 
4210
+ ### Preset configurations
4211
+
4212
+ **Strict** - High-confidence duplicates only:
4213
+ \`\`\`js
4214
+ { threshold: 0.85, confidenceLevel: "high" }
4215
+ \`\`\`
4216
+
4217
+ **Normal** (default) - Balanced detection:
4218
+ \`\`\`js
4219
+ { threshold: 0.75, confidenceLevel: "low" }
4220
+ \`\`\`
4221
+
4222
+ **Lenient** - Catch more potential duplicates:
4223
+ \`\`\`js
4224
+ { threshold: 0.65, confidenceLevel: "low" }
4225
+ \`\`\`
4226
+
4227
+ ## Confidence Levels
4228
+
4229
+ The rule assigns confidence levels based on similarity scores:
4230
+
4231
+ - \u{1F534} **High (\u226590%)** - Likely copy-paste or near-identical code. Strongly recommend consolidation.
4232
+ - \u{1F7E1} **Medium (75-89%)** - Semantically similar. Review for potential abstraction.
4233
+ - \u{1F7E2} **Low (60-74%)** - Possibly related patterns. Optional review.
4234
+
4152
4235
  ## Notes
4153
4236
 
4154
4237
  - Run \`uilint duplicates index\` after significant code changes
4155
4238
  - Use \`uilint duplicates find\` to explore all duplicate groups
4156
4239
  - The rule only reports if the file is in the index
4240
+ - Structural boost helps detect duplicates with different variable names (e.g., Badge vs Tag)
4157
4241
  `
4158
4242
  });
4159
4243
  var indexCache = null;
@@ -7983,9 +8067,13 @@ var strictConfig = {
7983
8067
  ]],
7984
8068
  "uilint/no-semantic-duplicates": ["warn", ...[
7985
8069
  {
7986
- "threshold": 0.85,
8070
+ "threshold": 0.75,
7987
8071
  "indexPath": ".uilint/.duplicates-index",
7988
- "minLines": 3
8072
+ "minLines": 3,
8073
+ "confidenceLevel": "low",
8074
+ "useStructuralBoost": true,
8075
+ "includeSameFile": false,
8076
+ "kind": "all"
7989
8077
  }
7990
8078
  ]],
7991
8079
  "uilint/require-test-coverage": ["warn", ...[