Skip to content

Commit

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

Anon default export: #21181
Promise callbacks: #26186
Returning anon functions: #22520
  • Loading branch information
rickhanlonii authored and gaearon committed Feb 3, 2024
1 parent 2fcd051 commit 678b4d3
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 678b4d3

Please sign in to comment.