canicode 0.11.1 → 0.11.2

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.
@@ -1863,7 +1863,7 @@ function computeApplyContext(violation, instanceContext) {
1863
1863
  }
1864
1864
 
1865
1865
  // package.json
1866
- var version = "0.11.1";
1866
+ var version = "0.11.2";
1867
1867
 
1868
1868
  // src/core/engine/scoring.ts
1869
1869
  function computeTotalScorePerCategory(configs) {
@@ -2233,7 +2233,13 @@ var BATCHABLE_RULE_IDS = [
2233
2233
  "no-auto-layout",
2234
2234
  "fixed-size-in-auto-layout"
2235
2235
  ];
2236
+ var OPT_IN_BATCHABLE_RULE_IDS = [
2237
+ "missing-prototype"
2238
+ ];
2236
2239
  var BATCHABLE_SET = new Set(BATCHABLE_RULE_IDS);
2240
+ var OPT_IN_BATCHABLE_SET = new Set(
2241
+ OPT_IN_BATCHABLE_RULE_IDS
2242
+ );
2237
2243
  var NO_SOURCE_SENTINEL = "_no-source";
2238
2244
  function groupAndBatchSurveyQuestions(questions) {
2239
2245
  if (questions.length === 0) {
@@ -2274,20 +2280,25 @@ function sourceComponentKey(question) {
2274
2280
  }
2275
2281
  function pushIntoBatch(group, question) {
2276
2282
  const sceneWeight = Math.max(question.replicas ?? 1, 1);
2277
- const isBatchable = BATCHABLE_SET.has(question.ruleId);
2283
+ const batchMode = resolveBatchMode(question.ruleId);
2278
2284
  const last = group.batches.at(-1);
2279
- if (last !== void 0 && last.ruleId === question.ruleId && isBatchable && last.batchable) {
2285
+ if (last !== void 0 && last.ruleId === question.ruleId && batchMode !== "none" && last.batchMode === batchMode) {
2280
2286
  last.questions.push(question);
2281
2287
  last.totalScenes += sceneWeight;
2282
2288
  return;
2283
2289
  }
2284
2290
  group.batches.push({
2285
2291
  ruleId: question.ruleId,
2286
- batchable: isBatchable,
2292
+ batchMode,
2287
2293
  questions: [question],
2288
2294
  totalScenes: sceneWeight
2289
2295
  });
2290
2296
  }
2297
+ function resolveBatchMode(ruleId) {
2298
+ if (BATCHABLE_SET.has(ruleId)) return "safe";
2299
+ if (OPT_IN_BATCHABLE_SET.has(ruleId)) return "opt-in";
2300
+ return "none";
2301
+ }
2291
2302
 
2292
2303
  // src/core/gotcha/survey-generator.ts
2293
2304
  var NODE_PATH_SEPARATOR = " > ";
@@ -2306,12 +2317,18 @@ function generateGotchaSurvey(result, scores, options = {}) {
2306
2317
  const mapped = sorted.map((issue) => mapToQuestion(issue, result.file)).filter((q) => q !== null);
2307
2318
  const questions = deduplicateBySourceComponent(mapped);
2308
2319
  const groupedQuestions = groupAndBatchSurveyQuestions(questions);
2320
+ const PROPAGATION_CANDIDATE_THRESHOLD = 3;
2321
+ const propagationCandidates = questions.filter(
2322
+ (q) => q.isInstanceChild
2323
+ ).length;
2324
+ const suggestedDefaultApply = propagationCandidates >= PROPAGATION_CANDIDATE_THRESHOLD;
2309
2325
  return {
2310
2326
  designGrade: grade,
2311
2327
  isReadyForCodeGen: isReadyForCodeGen(grade),
2312
2328
  questions,
2313
2329
  groupedQuestions,
2314
- designKey: options.designKey ?? ""
2330
+ designKey: options.designKey ?? "",
2331
+ suggestedDefaultApply
2315
2332
  };
2316
2333
  }
2317
2334
  function deduplicateSiblingIssues(issues) {