ace-linters
ace-linters copied to clipboard
`return` without `function` syntax
~I am trying to load TypeScript types from /req.d.ts
, without using websocket to run the linter.
It's just a simple types that contain the following:~
class CSRequest extends Request {
constructor() {
super();
}
query: Record<string, string>
params: Record<string, string>
}
declare var req: CSRequest;
~I fixed it the types, but it seems that ESLint is saying req
is not defined.~ I fixed it
Moreover, I have a code that gets parsed using new Function(...)
(I know it's unsafe but the editor is authenticated), the linter throws A "return" statement can only be used within a function.
for the following code:
// Test code to echo all query parameters
return new Response(JSON.stringify(req.query), {
headers: {
'Content-Type': 'application/json'
}
});