-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@typescript-eslint/unbound-method
triggered when destructuring function from arg
#13481
Comments
6 tasks
Fixed in sveltejs/kit#12955 |
@Stadly would you mind sharing your |
Sure, here is my module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:svelte/prettier",
"plugin:svelte/recommended",
"prettier",
],
ignorePatterns: ["/build/"],
overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
project: true,
tsconfigRootDir: __dirname,
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
// These type names have special meanings in Svelte components and should not be reported as unused.
// Ref: https://github.com/sveltejs/eslint-plugin-svelte/issues/348
varsIgnorePattern: "^\\$\\$(Props|Events|Slots|Generic)$",
},
],
},
},
],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
extraFileExtensions: [".svelte"],
project: ["tsconfig.json", "tsconfig.eslint.json"],
tsconfigRootDir: __dirname,
},
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
eqeqeq: "error",
},
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When destructuring a function out of a function argument, for example like this:
ESLint yells at me:
Destructuing the function argument is very common, and is the way it's done in both the Docs and Tutorial for the handle hook.
I don't think
resolve
usesthis
, so I think the issue would be solved by declaringHandle
like this (using arrow function):or this (annotating with
this: void
):instead of this:
Note: The same issue applies to some other functions. At least
parent
inLayoutLoad
andPageLoad
comes to mind.Reproduction
Set up SvelteKit with ESLint and
@typescript-eslint/recommended-type-checked
.Set up a handle hook:
Logs
No response
System Info
System: OS: Linux 5.15 Debian GNU/Linux 12 (bookworm) 12 (bookworm) CPU: (16) x64 Intel(R) Xeon(R) W-11955M CPU @ 2.60GHz Memory: 4.39 GB / 15.23 GB Container: Yes Shell: 5.2.15 - /bin/bash Binaries: Node: 20.17.0 - /usr/local/bin/node Yarn: 1.22.22 - /usr/local/bin/yarn npm: 10.8.2 - /usr/local/bin/npm npmPackages: svelte: ^4.2.19 => 4.2.19
The text was updated successfully, but these errors were encountered: