slopbrick 0.17.3 → 0.18.1
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/engine/worker.cjs +16 -9
- package/dist/engine/worker.js +14 -7
- package/dist/index.cjs +418 -358
- package/dist/index.js +371 -311
- package/package.json +1 -1
package/dist/engine/worker.cjs
CHANGED
|
@@ -4084,6 +4084,9 @@ var VERDICTS = [
|
|
|
4084
4084
|
"HYGIENE",
|
|
4085
4085
|
"DORMANT"
|
|
4086
4086
|
];
|
|
4087
|
+
function isDefaultOff(verdict) {
|
|
4088
|
+
return verdict === "NOISY" || verdict === "INVERTED" || verdict === "DORMANT";
|
|
4089
|
+
}
|
|
4087
4090
|
var signalStrengthSchema = external_exports.record(
|
|
4088
4091
|
external_exports.string(),
|
|
4089
4092
|
// ruleId
|
|
@@ -4364,7 +4367,11 @@ var FPR_FLOOR = 1e-6;
|
|
|
4364
4367
|
var RECALL_FLOOR = 1e-6;
|
|
4365
4368
|
var LLR_CAP = 13.8;
|
|
4366
4369
|
var DEFAULT_PRIOR_PREVALENCE = 0.3;
|
|
4367
|
-
var ELIGIBLE_VERDICTS =
|
|
4370
|
+
var ELIGIBLE_VERDICTS = new Set(
|
|
4371
|
+
["USEFUL", "OK", "NOISY", "INVERTED", "HYGIENE", "DORMANT"].filter(
|
|
4372
|
+
(v) => v !== "HYGIENE" && !isDefaultOff(v)
|
|
4373
|
+
)
|
|
4374
|
+
);
|
|
4368
4375
|
function loadSignals(signalData) {
|
|
4369
4376
|
const map = /* @__PURE__ */ new Map();
|
|
4370
4377
|
for (const [ruleId, entry] of Object.entries(signalData)) {
|
|
@@ -34909,7 +34916,7 @@ var mathElementUniformityRule = createRule({
|
|
|
34909
34916
|
if (!anchor) anchor = { line: el.line, column: el.column };
|
|
34910
34917
|
}
|
|
34911
34918
|
}
|
|
34912
|
-
const values = [counts.button, counts.input, counts.select].filter((v) => v > 0);
|
|
34919
|
+
const values = [counts.button, counts.input, counts.select].filter((v) => typeof v === "number" && v > 0);
|
|
34913
34920
|
if (values.length < 2) return issues;
|
|
34914
34921
|
const max = Math.max(...values);
|
|
34915
34922
|
const min = Math.min(...values);
|
|
@@ -34958,7 +34965,7 @@ var mathGridUniformityRule = createRule({
|
|
|
34958
34965
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
34959
34966
|
if (total < 4) return issues;
|
|
34960
34967
|
if (h > 1) return issues;
|
|
34961
|
-
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] : { line: 1, column: 1 };
|
|
34968
|
+
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 } : { line: 1, column: 1 };
|
|
34962
34969
|
issues.push({
|
|
34963
34970
|
ruleId: "layout/math-grid-uniformity",
|
|
34964
34971
|
category: "layout",
|
|
@@ -35841,7 +35848,7 @@ var mathGiniClassUsageRule = createRule({
|
|
|
35841
35848
|
if (g < 0.5) return issues;
|
|
35842
35849
|
const sorted = [...counts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 3);
|
|
35843
35850
|
const topStr = sorted.map(([k, v]) => `${k}\xD7${v}`).join(", ");
|
|
35844
|
-
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] : { line: 1, column: 1 };
|
|
35851
|
+
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 } : { line: 1, column: 1 };
|
|
35845
35852
|
issues.push({
|
|
35846
35853
|
ruleId: "logic/math-gini-class-usage",
|
|
35847
35854
|
category: "logic",
|
|
@@ -37660,7 +37667,7 @@ function looksRealistic(value) {
|
|
|
37660
37667
|
}
|
|
37661
37668
|
|
|
37662
37669
|
// src/rules/test/missing-edge-case.ts
|
|
37663
|
-
var
|
|
37670
|
+
var import_core4 = require("@swc/core");
|
|
37664
37671
|
var import_node_fs11 = require("fs");
|
|
37665
37672
|
var MAX_PER_FILE = 20;
|
|
37666
37673
|
var missingEdgeCaseRule = createRule({
|
|
@@ -37704,7 +37711,7 @@ var missingEdgeCaseRule = createRule({
|
|
|
37704
37711
|
if (!source) return issues;
|
|
37705
37712
|
let ast;
|
|
37706
37713
|
try {
|
|
37707
|
-
ast = (0,
|
|
37714
|
+
ast = (0, import_core4.parseSync)(source, {
|
|
37708
37715
|
syntax: "typescript",
|
|
37709
37716
|
tsx: filePath.endsWith("tsx") || filePath.endsWith("jsx"),
|
|
37710
37717
|
target: "es2022"
|
|
@@ -38821,7 +38828,7 @@ var mathFontEntropyRule = createRule({
|
|
|
38821
38828
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
38822
38829
|
if (total < 6) return issues;
|
|
38823
38830
|
if (h > 1.4) return issues;
|
|
38824
|
-
const anchor = flatClassNames(facts.v2)[0];
|
|
38831
|
+
const anchor = flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 };
|
|
38825
38832
|
issues.push({
|
|
38826
38833
|
ruleId: "visual/math-font-entropy",
|
|
38827
38834
|
category: "visual",
|
|
@@ -38943,7 +38950,7 @@ var mathRoundedEntropyRule = createRule({
|
|
|
38943
38950
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
38944
38951
|
if (total < 6) return issues;
|
|
38945
38952
|
if (h > 1.8) return issues;
|
|
38946
|
-
const anchor = flatClassNames(facts.v2)[0];
|
|
38953
|
+
const anchor = flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 };
|
|
38947
38954
|
issues.push({
|
|
38948
38955
|
ruleId: "visual/math-rounded-entropy",
|
|
38949
38956
|
category: "visual",
|
|
@@ -38982,7 +38989,7 @@ var mathSpacingEntropyRule = createRule({
|
|
|
38982
38989
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
38983
38990
|
if (total < 10) return issues;
|
|
38984
38991
|
if (h > 1.5) return issues;
|
|
38985
|
-
const anchor = flatClassNames(facts.v2)[0];
|
|
38992
|
+
const anchor = flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 };
|
|
38986
38993
|
issues.push({
|
|
38987
38994
|
ruleId: "visual/math-spacing-entropy",
|
|
38988
38995
|
category: "visual",
|
package/dist/engine/worker.js
CHANGED
|
@@ -4065,6 +4065,9 @@ var VERDICTS = [
|
|
|
4065
4065
|
"HYGIENE",
|
|
4066
4066
|
"DORMANT"
|
|
4067
4067
|
];
|
|
4068
|
+
function isDefaultOff(verdict) {
|
|
4069
|
+
return verdict === "NOISY" || verdict === "INVERTED" || verdict === "DORMANT";
|
|
4070
|
+
}
|
|
4068
4071
|
var signalStrengthSchema = external_exports.record(
|
|
4069
4072
|
external_exports.string(),
|
|
4070
4073
|
// ruleId
|
|
@@ -4345,7 +4348,11 @@ var FPR_FLOOR = 1e-6;
|
|
|
4345
4348
|
var RECALL_FLOOR = 1e-6;
|
|
4346
4349
|
var LLR_CAP = 13.8;
|
|
4347
4350
|
var DEFAULT_PRIOR_PREVALENCE = 0.3;
|
|
4348
|
-
var ELIGIBLE_VERDICTS =
|
|
4351
|
+
var ELIGIBLE_VERDICTS = new Set(
|
|
4352
|
+
["USEFUL", "OK", "NOISY", "INVERTED", "HYGIENE", "DORMANT"].filter(
|
|
4353
|
+
(v) => v !== "HYGIENE" && !isDefaultOff(v)
|
|
4354
|
+
)
|
|
4355
|
+
);
|
|
4349
4356
|
function loadSignals(signalData) {
|
|
4350
4357
|
const map = /* @__PURE__ */ new Map();
|
|
4351
4358
|
for (const [ruleId, entry] of Object.entries(signalData)) {
|
|
@@ -34890,7 +34897,7 @@ var mathElementUniformityRule = createRule({
|
|
|
34890
34897
|
if (!anchor) anchor = { line: el.line, column: el.column };
|
|
34891
34898
|
}
|
|
34892
34899
|
}
|
|
34893
|
-
const values = [counts.button, counts.input, counts.select].filter((v) => v > 0);
|
|
34900
|
+
const values = [counts.button, counts.input, counts.select].filter((v) => typeof v === "number" && v > 0);
|
|
34894
34901
|
if (values.length < 2) return issues;
|
|
34895
34902
|
const max = Math.max(...values);
|
|
34896
34903
|
const min = Math.min(...values);
|
|
@@ -34939,7 +34946,7 @@ var mathGridUniformityRule = createRule({
|
|
|
34939
34946
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
34940
34947
|
if (total < 4) return issues;
|
|
34941
34948
|
if (h > 1) return issues;
|
|
34942
|
-
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] : { line: 1, column: 1 };
|
|
34949
|
+
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 } : { line: 1, column: 1 };
|
|
34943
34950
|
issues.push({
|
|
34944
34951
|
ruleId: "layout/math-grid-uniformity",
|
|
34945
34952
|
category: "layout",
|
|
@@ -35822,7 +35829,7 @@ var mathGiniClassUsageRule = createRule({
|
|
|
35822
35829
|
if (g < 0.5) return issues;
|
|
35823
35830
|
const sorted = [...counts.entries()].sort((a, b) => b[1] - a[1]).slice(0, 3);
|
|
35824
35831
|
const topStr = sorted.map(([k, v]) => `${k}\xD7${v}`).join(", ");
|
|
35825
|
-
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] : { line: 1, column: 1 };
|
|
35832
|
+
const anchor = facts.v2 ? flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 } : { line: 1, column: 1 };
|
|
35826
35833
|
issues.push({
|
|
35827
35834
|
ruleId: "logic/math-gini-class-usage",
|
|
35828
35835
|
category: "logic",
|
|
@@ -38802,7 +38809,7 @@ var mathFontEntropyRule = createRule({
|
|
|
38802
38809
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
38803
38810
|
if (total < 6) return issues;
|
|
38804
38811
|
if (h > 1.4) return issues;
|
|
38805
|
-
const anchor = flatClassNames(facts.v2)[0];
|
|
38812
|
+
const anchor = flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 };
|
|
38806
38813
|
issues.push({
|
|
38807
38814
|
ruleId: "visual/math-font-entropy",
|
|
38808
38815
|
category: "visual",
|
|
@@ -38924,7 +38931,7 @@ var mathRoundedEntropyRule = createRule({
|
|
|
38924
38931
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
38925
38932
|
if (total < 6) return issues;
|
|
38926
38933
|
if (h > 1.8) return issues;
|
|
38927
|
-
const anchor = flatClassNames(facts.v2)[0];
|
|
38934
|
+
const anchor = flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 };
|
|
38928
38935
|
issues.push({
|
|
38929
38936
|
ruleId: "visual/math-rounded-entropy",
|
|
38930
38937
|
category: "visual",
|
|
@@ -38963,7 +38970,7 @@ var mathSpacingEntropyRule = createRule({
|
|
|
38963
38970
|
const { h, vocab, total } = shannonEntropy(counts);
|
|
38964
38971
|
if (total < 10) return issues;
|
|
38965
38972
|
if (h > 1.5) return issues;
|
|
38966
|
-
const anchor = flatClassNames(facts.v2)[0];
|
|
38973
|
+
const anchor = flatClassNames(facts.v2)[0] ?? { line: 1, column: 1 };
|
|
38967
38974
|
issues.push({
|
|
38968
38975
|
ruleId: "visual/math-spacing-entropy",
|
|
38969
38976
|
category: "visual",
|