You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run ESLint with eslint-config-love on a file like the following.
/** * @param {string} username - user name * @returns {void} */constsayHello=(username)=>{console.log(`Hello, ${username}`)}constmyName='Alice'sayHello(myName)
Then, the following error is then detected.
5:29 error Missing return type on function @typescript-eslint/explicit-function-return-type
This is an odd behavior since JavaScript does not allow for return types.
Solution
Perhaps this rule should be enabled for TS files only.
{"rules": {// disable the rule for all files"@typescript-eslint/explicit-function-return-type": "off",},"overrides": [{// enable the rule specifically for TypeScript files"files": ["*.ts","*.mts","*.cts","*.tsx"],"rules": {"@typescript-eslint/explicit-function-return-type": "error",},},],}
Run ESLint with eslint-config-love on a file like the following.
Then, the following error is then detected.
This is an odd behavior since JavaScript does not allow for return types.
Solution
Perhaps this rule should be enabled for TS files only.
cf. https://typescript-eslint.io/rules/explicit-function-return-type/#configuring-in-a-mixed-jsts-codebase
Or should eslint-config-love be configured on the user side to apply only to TS files?
The text was updated successfully, but these errors were encountered: