@geonosis/lint-parity 2.9.0 → 2.10.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @geonosis/lint-parity
2
2
 
3
+ ## 2.10.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3863c79: `--expect-changed` sees a rule whose findings moved, not only one whose count changed.
8
+
9
+ The corpus claim compared per-rule finding counts, so a rule rewritten to fire twice in new places
10
+ where it used to fire twice in old ones read as unchanged and the claim was reported unproven. It
11
+ now compares where each rule fired — `path:line:col`, without the message, so a reworded finding is
12
+ still the same finding.
13
+
3
14
  ## 2.9.0
4
15
 
5
16
  ## 2.8.0
@@ -148,6 +148,7 @@ ${output.trim()}`);
148
148
  }
149
149
  return findings;
150
150
  };
151
+ var PLACE = /^(.+?:\d+:\d+):/;
151
152
  var UNATTRIBUTED = "(unattributed)";
152
153
  var ruleOf = (line) => RULE_IN_LINE.exec(line)?.[1] ?? UNATTRIBUTED;
153
154
  var asFile = (lines) => lines.length === 0 ? "" : `${lines.join("\n")}
@@ -333,7 +334,7 @@ var corpusOf = ({
333
334
  const root = mkdtempSync(join2(tmpdir(), "geonosis-corpus-"));
334
335
  const here = join2(root, "corpus");
335
336
  const foundIn = (config, side) => {
336
- const counts = /* @__PURE__ */ new Map();
337
+ const places = /* @__PURE__ */ new Map();
337
338
  for (const finding of readRun(
338
339
  lint({
339
340
  config,
@@ -346,9 +347,10 @@ var corpusOf = ({
346
347
  side
347
348
  )) {
348
349
  const rule = ruleIdOf(finding);
349
- counts.set(rule, (counts.get(rule) ?? 0) + 1);
350
+ const place = PLACE.exec(finding)?.[1] ?? finding;
351
+ places.set(rule, [...places.get(rule) ?? [], place]);
350
352
  }
351
- return counts;
353
+ return places;
352
354
  };
353
355
  let inA = /* @__PURE__ */ new Map();
354
356
  let inB = /* @__PURE__ */ new Map();
@@ -362,10 +364,12 @@ var corpusOf = ({
362
364
  const configured = [.../* @__PURE__ */ new Set([...rulesNamedBy(configA), ...rulesNamedBy(configB)])].toSorted();
363
365
  const off = [.../* @__PURE__ */ new Set([...rulesTurnedOffBy(configA), ...rulesTurnedOffBy(configB)])].filter((rule) => !configured.includes(rule)).toSorted();
364
366
  const reach = configured.filter((rule) => exercised.has(rule)).map((rule) => {
365
- const foundInA = inA.get(rule) ?? 0;
366
- const foundInB = inB.get(rule) ?? 0;
367
+ const placesA = (inA.get(rule) ?? []).toSorted();
368
+ const placesB = (inB.get(rule) ?? []).toSorted();
369
+ const foundInA = placesA.length;
370
+ const foundInB = placesB.length;
367
371
  return {
368
- changed: foundInA !== foundInB,
372
+ changed: placesA.join("\n") !== placesB.join("\n"),
369
373
  firedInA: foundInA > 0,
370
374
  firedInB: foundInB > 0,
371
375
  foundInA,
package/dist/index.d.ts CHANGED
@@ -59,8 +59,9 @@ declare const formatSummary: (parity: Parity) => string;
59
59
  type RuleReach = {
60
60
  /**
61
61
  * The corpus saw this rule behave differently under the two configs — it started firing, stopped
62
- * firing, or fired a different number of times. What a release CLAIMS about a rule is checked
63
- * against this, and nothing else.
62
+ * firing, or fired in a different set of places. A PLACE, not a count: #9 rewrote a rule that fired
63
+ * twice on the base build and twice on the new one, on files with nothing in common, and comparing
64
+ * counts read that as untouched. What a release CLAIMS about a rule is checked against this.
64
65
  */
65
66
  changed: boolean;
66
67
  firedInA: boolean;
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  ruleIdOf,
18
18
  rulesNamedBy,
19
19
  rulesTurnedOffBy
20
- } from "./chunk-OQSXP7ZK.js";
20
+ } from "./chunk-DFAXDNDR.js";
21
21
  export {
22
22
  MANIFEST_FILE,
23
23
  ParityError,
@@ -9,7 +9,7 @@ import {
9
9
  parseParityArgs,
10
10
  resolveOxlint,
11
11
  writeEnvelope
12
- } from "./chunk-OQSXP7ZK.js";
12
+ } from "./chunk-DFAXDNDR.js";
13
13
 
14
14
  // src/parity-cli.ts
15
15
  import { mkdirSync, writeFileSync } from "fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geonosis/lint-parity",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "description": "Findings parity and rule reach over any two oxlint configs — the diff a fork is deleted on.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "devDependencies": {
48
- "@geonosis/ratchet": "2.9.0"
48
+ "@geonosis/ratchet": "2.10.0"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup",