diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.expect.md new file mode 100644 index 0000000000..87f0c65a86 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.expect.md @@ -0,0 +1,21 @@ + +## Input + +```javascript +let wat = {}; + +function Foo() { + delete wat.foo; + return wat; +} + +``` + + +## Error + +``` +[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (4:4) +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.js new file mode 100644 index 0000000000..54b42a607d --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.mutate-property-from-global.js @@ -0,0 +1,6 @@ +let wat = {}; + +function Foo() { + delete wat.foo; + return wat; +} diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.expect.md b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.expect.md new file mode 100644 index 0000000000..9e08cb67b7 --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.expect.md @@ -0,0 +1,21 @@ + +## Input + +```javascript +let wat = {}; + +function Foo() { + wat.test = 1; + return wat; +} + +``` + + +## Error + +``` +[ReactForget] InvalidReact: This mutates a variable after it was passed to React, which means that React cannot observe changes to it (4:4) +``` + + \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.js b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.js new file mode 100644 index 0000000000..a210cd702b --- /dev/null +++ b/compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.store-property-in-global.js @@ -0,0 +1,6 @@ +let wat = {}; + +function Foo() { + wat.test = 1; + return wat; +}