@typeonce/oxlint-plugin-ritmo 0.16.0 → 0.16.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @typeonce/oxlint-plugin-ritmo
2
2
 
3
+ ## 0.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8918c31: `ritmo/handle-runtime-result` no longer reports a `tick`, `tryTick`, `restore`, or `rewind` result passed to a function: that function is a helper that checks it (`expectOk(runtime.tick(update))`, `orCrash(runtime.tick(setup), "Setup")`). It still reports one passed to `JSON.stringify`, `String`, or `console.*`, and any unchecked `snapshot()` or `checksum()` result, which is data on its way to a save or a log. Spirit Call's 180 reports on 0.16.0 were all checking helpers.
8
+
3
9
  ## 0.16.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -241,7 +241,7 @@ if (saved.ok) persist(saved.value)
241
241
  void runtime.tick(render) // ignored on purpose
242
242
  ```
243
243
 
244
- Catches these calls on a receiver named like a runtime (`runtime`, `game.runtime`, `worldRuntime`) used as a statement, or passed on unchecked: as a call argument, inside a template string, an object or array literal, a spread, or an operand, also through `??`, `? :`, and `as`. A variable, a field, a `return`, `.ok`, and `void` keep the `Result` for the code to check. A helper that takes the `Result` itself gets it once it is named: `const checksum = runtime.checksum(); helper(checksum)`. Game wrappers with other names (`town.restore(...)`) are not reported. Option: `{ "runtimePattern": "^(runtime|world)$" }` (a case-insensitive regular expression for the receiver's name; default `runtime$`).
244
+ Catches these calls on a receiver named like a runtime (`runtime`, `game.runtime`, `worldRuntime`) used as a statement, or passed on unchecked: as a call argument, inside a template string, an object or array literal, a spread, or an operand, also through `??`, `? :`, and `as`. A variable, a field, a `return`, `.ok`, and `void` keep the `Result` for the code to check. A `tick`, `tryTick`, `restore`, or `rewind` result passed to a function is left to that function (a test's `expectOk(runtime.tick(update))`), unless it only prints or encodes (`JSON.stringify`, `String`, `console.*`). A `snapshot()` or `checksum()` result is data on its way somewhere, so passing it to any function unchecked is reported; a helper that takes that `Result` itself gets it once it is named: `const checksum = runtime.checksum(); helper(checksum)`. Game wrappers with other names (`town.restore(...)`) are not reported. Option: `{ "runtimePattern": "^(runtime|world)$" }` (a case-insensitive regular expression for the receiver's name; default `runtime$`).
245
245
 
246
246
  ### `ritmo/prefix-descriptor-and-system-names`
247
247
 
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * The `Result` of `runtime.tick(...)`, `tryTick(...)`, `restore(...)`,
3
3
  * `rewind(...)`, `snapshot()`, and `checksum()` is checked: dropping it, or
4
- * passing it on where any value is accepted, hides the failure.
4
+ * passing it on where any value is accepted, hides the failure. A `tick`,
5
+ * `restore`, or `rewind` result passed to a function is left to that
6
+ * function (a test's `expectOk`), unless it only prints or encodes.
5
7
  */
6
8
  declare const _default: import("@oxlint/plugins").Rule;
7
9
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"handle-runtime-result.d.ts","sourceRoot":"","sources":["../../src/rules/handle-runtime-result.ts"],"names":[],"mappings":"AAiCA;;;;GAIG"}
1
+ {"version":3,"file":"handle-runtime-result.d.ts","sourceRoot":"","sources":["../../src/rules/handle-runtime-result.ts"],"names":[],"mappings":"AAgDA;;;;;;GAMG"}
@@ -21,10 +21,26 @@ const passesThrough = new Set(["ConditionalExpression", "LogicalExpression", "Pa
21
21
  * keep it as a `Result` the code still has to look at.
22
22
  */
23
23
  const unchecked = new Set(["CallExpression", "NewExpression", "TemplateLiteral", "Property", "ArrayExpression", "SpreadElement", "BinaryExpression", "JSXExpressionContainer"]);
24
+ /**
25
+ * Functions that take any value and do nothing with a `Result` but print or
26
+ * encode it. A `tick`, `restore`, or `rewind` result handed to any other
27
+ * function goes to a helper that checks it (`expectOk(runtime.tick(update))`).
28
+ */
29
+ const sinks = new Set(["JSON.stringify", "String", "console.log", "console.info", "console.warn", "console.error", "console.debug"]);
30
+ const calleeName = (node) => {
31
+ if (node.type === "Identifier")
32
+ return node.name;
33
+ if (node.type === "MemberExpression" && !node.computed && node.object.type === "Identifier" && node.property.type === "Identifier") {
34
+ return `${node.object.name}.${node.property.name}`;
35
+ }
36
+ return undefined;
37
+ };
24
38
  /**
25
39
  * The `Result` of `runtime.tick(...)`, `tryTick(...)`, `restore(...)`,
26
40
  * `rewind(...)`, `snapshot()`, and `checksum()` is checked: dropping it, or
27
- * passing it on where any value is accepted, hides the failure.
41
+ * passing it on where any value is accepted, hides the failure. A `tick`,
42
+ * `restore`, or `rewind` result passed to a function is left to that
43
+ * function (a test's `expectOk`), unless it only prints or encodes.
28
44
  */
29
45
  export default defineRule({
30
46
  meta: {
@@ -94,6 +110,13 @@ export default defineRule({
94
110
  // A property key is not a use of the value.
95
111
  if (parent.type === "Property" && parent.value !== node)
96
112
  return;
113
+ // A tick, restore, or rewind handed to a function goes to a helper that checks it, unless the function only prints or encodes.
114
+ // snapshot() and checksum() are data on their way somewhere, so a function that takes them unchecked is reported.
115
+ if ((parent.type === "CallExpression" || parent.type === "NewExpression") && takes === "arguments") {
116
+ const name = calleeName(parent.callee);
117
+ if (name === undefined || !sinks.has(name))
118
+ return;
119
+ }
97
120
  context.report({ node: call, messageId: "unchecked", data });
98
121
  }
99
122
  };
@@ -1 +1 @@
1
- {"version":3,"file":"handle-runtime-result.js","sourceRoot":"","sources":["../../src/rules/handle-runtime-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAMxE,mFAAmF;AACnF,MAAM,OAAO,GAAG,IAAI,GAAG,CAA+B;IACpD,CAAC,MAAM,EAAE,WAAW,CAAC;IACrB,CAAC,SAAS,EAAE,WAAW,CAAC;IACxB,CAAC,SAAS,EAAE,WAAW,CAAC;IACxB,CAAC,QAAQ,EAAE,WAAW,CAAC;IACvB,CAAC,UAAU,EAAE,MAAM,CAAC;IACpB,CAA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;oBACtC,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;wBAAE,OAAM;gBACpD,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;YAC9D,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeonce/oxlint-plugin-ritmo",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Oxlint rules for Ritmo games: deterministic, headless simulation code and checked runtime results",
5
5
  "author": "Sandro Maglione",
6
6
  "license": "MIT",
@@ -31,10 +31,27 @@ const passesThrough = new Set(["ConditionalExpression", "LogicalExpression", "Pa
31
31
  */
32
32
  const unchecked = new Set(["CallExpression", "NewExpression", "TemplateLiteral", "Property", "ArrayExpression", "SpreadElement", "BinaryExpression", "JSXExpressionContainer"])
33
33
 
34
+ /**
35
+ * Functions that take any value and do nothing with a `Result` but print or
36
+ * encode it. A `tick`, `restore`, or `rewind` result handed to any other
37
+ * function goes to a helper that checks it (`expectOk(runtime.tick(update))`).
38
+ */
39
+ const sinks = new Set(["JSON.stringify", "String", "console.log", "console.info", "console.warn", "console.error", "console.debug"])
40
+
41
+ const calleeName = (node: ESTree.Node): string | undefined => {
42
+ if (node.type === "Identifier") return node.name
43
+ if (node.type === "MemberExpression" && !node.computed && node.object.type === "Identifier" && node.property.type === "Identifier") {
44
+ return `${node.object.name}.${node.property.name}`
45
+ }
46
+ return undefined
47
+ }
48
+
34
49
  /**
35
50
  * The `Result` of `runtime.tick(...)`, `tryTick(...)`, `restore(...)`,
36
51
  * `rewind(...)`, `snapshot()`, and `checksum()` is checked: dropping it, or
37
- * passing it on where any value is accepted, hides the failure.
52
+ * passing it on where any value is accepted, hides the failure. A `tick`,
53
+ * `restore`, or `rewind` result passed to a function is left to that
54
+ * function (a test's `expectOk`), unless it only prints or encodes.
38
55
  */
39
56
  export default defineRule({
40
57
  meta: {
@@ -101,6 +118,12 @@ export default defineRule({
101
118
  if (parent.type === "CallExpression" && parent.callee === node) return
102
119
  // A property key is not a use of the value.
103
120
  if (parent.type === "Property" && parent.value !== node) return
121
+ // A tick, restore, or rewind handed to a function goes to a helper that checks it, unless the function only prints or encodes.
122
+ // snapshot() and checksum() are data on their way somewhere, so a function that takes them unchecked is reported.
123
+ if ((parent.type === "CallExpression" || parent.type === "NewExpression") && takes === "arguments") {
124
+ const name = calleeName(parent.callee)
125
+ if (name === undefined || !sinks.has(name)) return
126
+ }
104
127
  context.report({ node: call, messageId: "unchecked", data })
105
128
  }
106
129
  }