deno_lint
deno_lint copied to clipboard
[explicit-function-return-type] does not work on inline arrow functions
deno 2.0.0 (stable, release, x86_64-unknown-linux-gnu)
v8 12.9.202.13-rusty
typescript 5.6.2
deno lint does not enforce the explicit-function-return-type rule.
Assuming the following deno.json snippet:
{
"lint": {
"include": ["src"],
"rules": {
"include": [
"camelcase",
"default-param-last",
"eqeqeq",
"explicit-function-return-type",
"explicit-module-boundary-types",
"guard-for-in",
"no-await-in-loop",
"no-boolean-literal-for-arguments",
"no-eval",
"no-inferrable-types",
"no-non-null-asserted-optional-chain",
"no-non-null-assertion",
"no-self-compare",
"no-sparse-arrays",
"no-sync-fn-in-async-fn",
"no-throw-literal",
"no-top-level-await",
"no-undef",
"prefer-ascii",
"single-var-declarator",
"triple-slash-reference",
"verbatim-module-syntax"
]
}
}
}
And the following TS snippet of a Hono project:
const rootHandler = (ctx: Context) => {
return ctx.json({ shade: "?", random: randomInt(0, 256) });
};
That rule would have to raise an error during linting, because a Response return type was not provided. But it does not raise any errors and the lint succeeds.
As a reference, other linting rules seem to work, at least the few that I intentionally tested out, such as camelcase and eqeqeq.
Looks like the lint rule only works on exported functions.
Issue is in const name = ()=>{} syntax. With casual function name() {} it works as expected.