Improve eslint derived fixtures
Joe Savona committed
May 8, 2023 at 14:10 UTC
597e70d69f8a2c0023d0a001c819fed3c2c2ac3a
110 files changed
+87
-17
compiler/forget/scripts/build-react-hooks-fixures.js
+20
-15
@@ -16,6 +16,8 @@ const path = require("path");
16
const prettier = require("prettier");
17
const prettierConfigPath = require.resolve("../.prettierrc");
18
const process = require("process");
19
+const { createHash } = require("crypto");
20
+const { create } = require("domain");
21
22
const FIXTURES_DIR = path.join(
23
process.cwd(),
@@ -26,6 +28,10 @@ const FIXTURES_DIR = path.join(
28
"rules-of-hooks"
29
);
30
31
+const PRETTIER_OPTIONS = prettier.resolveConfig.sync(FIXTURES_DIR, {
32
+ config: prettierConfigPath,
33
+});
34
+
35
const fixtures = [];
36
for (const test of tests.valid) {
37
fixtures.push({ code: test.code, valid: true });
@@ -34,7 +40,6 @@ for (const test of tests.invalid) {
40
fixtures.push({ code: test.code, valid: false });
41
}
42
37
-let index = 0;
43
for (const fixture of fixtures) {
44
let error = null;
45
let passes = true;
@@ -63,29 +68,29 @@ for (const fixture of fixtures) {
68
} catch (e) {
69
error = e;
70
}
66
- let name = `rules-of-hooks-${index}.js`;
71
let code = fixture.code;
72
+ let prefix = "";
73
if (error !== null) {
69
- name = `todo.${name}`;
70
- code = `// @skip\n${code}`;
74
+ prefix = `todo.`;
75
+ code = `// @skip\n// Unsupported input\n${code}`;
76
} else if (fixture.valid === false) {
72
- name = `error.${name}`;
77
+ prefix = `error.`;
78
if (passes) {
79
// oops, passed when we expected an error
75
- name = `todo.${name}`;
76
- code = `// @skip\n${code}`;
80
+ prefix = `todo.error.`;
81
+ code = `// @skip\n// Passed but should have errored\n${code}`;
82
}
83
} else if (!passes) {
84
// oops, error when it should have passed
80
- name = `todo.${name}`;
81
- code = `// @skip\n${code}`;
85
+ prefix = `todo.`;
86
+ code = `// @skip\n// Failed but should have passed\n${code}`;
87
}
83
-
88
+ const formatted = prettier.format(code, PRETTIER_OPTIONS);
89
+ const hmac = createHash("sha256");
90
+ hmac.update(formatted, "utf8");
91
+ let name = `${prefix}rules-of-hooks-${hmac
92
+ .digest("hex")
93
+ .substring(0, 12)}.js`;
94
const fixturePath = path.join(FIXTURES_DIR, name);
85
- const options = prettier.resolveConfig.sync(fixturePath, {
86
- config: prettierConfigPath,
87
- });
88
- const formatted = prettier.format(code, options);
95
fs.writeFileSync(fixturePath, formatted, "utf8");
90
- index++;
96
}
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-1dd104f3e579.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-1dd104f3e579.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-2e9963324591.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-2e9963324591.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-3d95dc7a5f98.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-3d95dc7a5f98.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-62bded832974.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-62bded832974.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-70d37bc6dabc.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-70d37bc6dabc.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-92708a08b920.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-92708a08b920.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-99ca80f8b0b6.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-99ca80f8b0b6.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-baf61a179e4c.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-baf61a179e4c.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-bfa72d1b8135.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-bfa72d1b8135.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-e70a6f5d6d4b.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-e70a6f5d6d4b.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-ec94ef9d80df.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-ec94ef9d80df.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-fc7007852fe0.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/error.rules-of-hooks-fc7007852fe0.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-0592bd574811.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-0592bd574811.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-0e2214abc294.expect.md
new
+28
@@ -0,0 +1,28 @@
1
+
2
+## Input
3
+
4
+```javascript
5
+// Valid because exceptions abort rendering
6
+function RegressionTest() {
7
+ if (page == null) {
8
+ throw new Error("oh no!");
9
+ }
10
+ useState();
11
+}
12
+
13
+```
14
+
15
+## Code
16
+
17
+```javascript
18
+// Valid because exceptions abort rendering
19
+function RegressionTest() {
20
+ if (page == null) {
21
+ throw new Error("oh no!");
22
+ }
23
+
24
+ useState();
25
+}
26
+
27
+```
28
+
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-0e2214abc294.js
renamed
-2
@@ -1,5 +1,3 @@
1
-// @skip
2
-
1
// Valid because exceptions abort rendering
2
function RegressionTest() {
3
if (page == null) {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-1ff6c3fbbc94.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-1ff6c3fbbc94.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-23dc7fffde57.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-23dc7fffde57.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-2bec02ac982b.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-2bec02ac982b.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-2e405c78cb80.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-2e405c78cb80.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-33a6e23edac1.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-33a6e23edac1.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-347b0dae66f1.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-347b0dae66f1.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-485bf041f55f.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-485bf041f55f.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-4f6c78a14bf7.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-4f6c78a14bf7.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-7e52f5eec669.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-7e52f5eec669.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-844a496db20b.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-844a496db20b.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-8f1c2c3f71c9.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-8f1c2c3f71c9.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-9a47e97b5d13.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-9a47e97b5d13.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-9d7879272ff6.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-9d7879272ff6.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-c1e8c7f4c191.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-c1e8c7f4c191.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-cfdfe5572fc7.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-cfdfe5572fc7.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-df4d750736f3.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-df4d750736f3.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-dfde14171fcd.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-dfde14171fcd.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-e5dd6caf4084.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-e5dd6caf4084.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-e66a744cffbe.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-e66a744cffbe.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-eacfcaa6ef89.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-eacfcaa6ef89.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-fe6042f7628b.expect.md
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/rules-of-hooks-fe6042f7628b.js
renamed
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-0a42415d4990.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// This is invalid because "use"-prefixed functions used in named
5
// functions are assumed to be hooks.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-112dd48477e6.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-1a1e29f21a79.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's a common misunderstanding.
5
// We *could* make it valid but the runtime error could be confusing.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-251e67613de1.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-310a4e022130.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's a common misunderstanding.
5
// We *could* make it valid but the runtime error could be confusing.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-3d8726664cf7.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Currently invalid because it violates the convention and removes the "taint"
5
// from a hook. We *could* make it valid to avoid some false positives but let's
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-42576e5c5613.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
class ClassComponentWithFeatureFlag extends React.Component {
5
render() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-429b3b1a8ee4.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// These are neither functions nor hooks.
5
function _normalFunctionWithHook() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-4d1a9ed4d44a.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-52cd6055b4fb.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's a common misunderstanding.
5
// We *could* make it valid but the runtime error could be confusing.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-60e23f3caf5b.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-7451860cd46f.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
(class {
5
useHook() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-7bcc5c5c0416.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
Hook.useState();
5
Hook._useState();
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-880ce4a7e686.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous.
5
// Normally, this would crash, but not if you use inline requires.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-92503f581023.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-b4af90990150.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's a common misunderstanding.
5
// We *could* make it valid but the runtime error could be confusing.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-be9bff592ca0.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
(class {
5
h = () => {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-c0069d062d50.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
class C {
5
m() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-c277f25e7c03.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Technically this is a false positive.
5
// We *could* make it valid (and it used to be).
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-cdcb36730551.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-de96bb13ad47.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
class ClassComponentWithHook extends React.Component {
5
render() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-e803203d651b.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
(class {
5
useHook = () => {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-f486864c4bec.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
// This is a false positive (it's valid) that unfortunately
5
// we cannot avoid. Prefer to rename it to not start with "use"
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.error.rules-of-hooks-fbe12b5ccfce.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Passed but should have errored
3
4
(class {
5
i() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-279ac76f53af.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid -- this is a regression test.
5
jest.useFakeTimers();
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-27c18dc8dad2.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-28a78701970c.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid because hooks can be used in anonymous function arguments to
5
// React.memo.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-3d692676194b.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Invalid because it's a common misunderstanding.
5
// We *could* make it valid but the runtime error could be confusing.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-6949b255e7eb.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid because the neither the conditions before or after the hook affect the hook call
5
// Failed prior to implementing BigInt because pathsFromStartToEnd and allPathsFromStartToEnd were too big and had rounding errors
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-69521d94fa03.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid because the neither the condition nor the loop affect the hook call.
5
function App(props) {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-8503ca76d6f8.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Invalid because it's a common misunderstanding.
5
// We *could* make it valid but the runtime error could be confusing.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-93dc5d5e538a.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid because the loop doesn't change the order of hooks calls.
5
function RegressionTest() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-d0935abedc42.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// This is valid because "use"-prefixed functions called in
5
// unnamed function arguments are not assumed to be hooks.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-dba5889e4ba6.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-e0a5db3ae21e.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid because hooks can call hooks.
5
function useHook() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-e29c874aa913.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Invalid because it's dangerous and might not warn otherwise.
5
// This *must* be invalid.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-e9f9bac89f8f.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Valid because hooks can be used in anonymous arrow-function arguments
5
// to forwardRef.
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-f7b5986699ca.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Regression test for incorrectly flagged valid code.
5
function RegressionTest() {
compiler/forget/src/__tests__/fixtures/compiler/rules-of-hooks/todo.rules-of-hooks-fadd52c1e460.js
renamed
+1
@@ -1,4 +1,5 @@
1
// @skip
2
+// Unsupported input
3
4
// Currently invalid.
5
// These are variations capturing the current heuristic--