Skip to content

Commit

Permalink
Add lint tests that should fail (facebook#28147)
Browse files Browse the repository at this point in the history
These though fail.

Anon default export: facebook#21181
Promise callbacks: facebook#26186
Returning anon functions: facebook#22520
  • Loading branch information
rickhanlonii authored and AndyPengc12 committed Apr 15, 2024
1 parent d00dd26 commit 4175f82
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,39 @@ const tests = {
}
`,
},
{
code: normalizeIndent`
export const notAComponent = () => {
return () => {
useState();
}
}
`,
// TODO: this should error but doesn't.
// errors: [functionError('use', 'notAComponent')],
},
{
code: normalizeIndent`
export default () => {
if (isVal) {
useState(0);
}
}
`,
// TODO: this should error but doesn't.
// errors: [genericError('useState')],
},
{
code: normalizeIndent`
function notAComponent() {
return new Promise.then(() => {
useState();
});
}
`,
// TODO: this should error but doesn't.
// errors: [genericError('useState')],
},
],
invalid: [
{
Expand Down

0 comments on commit 4175f82

Please sign in to comment.