Skip to content
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

eslint returns incorrect Svelte error #18

Open
hamilton opened this issue Jun 19, 2020 · 6 comments
Open

eslint returns incorrect Svelte error #18

hamilton opened this issue Jun 19, 2020 · 6 comments

Comments

@hamilton
Copy link
Collaborator

hamilton commented Jun 19, 2020

The following code (reduced for clarity) caused an error:

export let whatever = 10;
let internal = writable(whatever);
$: $internal = whatever;

let someOtherStore = derived(internal, $internal => $internal + 10);

This should not technically be an error, but it's breaking a PR that was passing last night. Has something changed?

@hamilton hamilton changed the title dependabot returns invalid Svelte errors dependabot returns incorrect Svelte error Jun 19, 2020
@openjck openjck changed the title dependabot returns incorrect Svelte error eslint returns incorrect Svelte error Jun 23, 2020
@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

I'm looking into this. Do you mean you're seeing a no-unused-vars error about $internal? That error is correct; it isn't used. The $internal that's used on line 5 is the argument of the anonymous function.

@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

If that's not what you meant, let me know.

@hamilton
Copy link
Collaborator Author

hamilton commented Jun 26, 2020

$: $internal = whatever is a fairly normal way of shorthanding $: internal.set(whatever), and the part in packages/datagraphic/DataGraphic.svelte the caused the issue didn't to date raise this eslint error before, so something must have changed in our eslint setup to make it raise an error now. I would argue that it shouldn't raise an error for these kinds of reactive autosubscribed set operations, and in fact it didn't before. I think whether it is used / unused is largely semantics since a derived store reactively uses the store value itself. But I guess eslint is largely concerned with semantics :)

Don't know the right course of action, I guess we're ruled by whatever eslint prescribes. I've already fixed the error where it occurred. I just think this is kind of useless and arbitrary. Let's chalk this issue up to grumbling. Closing now

@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

Oh, I see. This sounds like a bug, then. I'll find a GitHub issue against eslint-plugin-svelte3 or open one.

@openjck openjck reopened this Jun 26, 2020
@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

I opened an issue:
sveltejs/eslint-plugin-svelte3#66

There's a related issue which has already been filed, which mine might be a duplicate of:
sveltejs/eslint-plugin-svelte3#64

@openjck
Copy link
Contributor

openjck commented Aug 19, 2020

Reminder:

We can close this when sveltejs/eslint-plugin-svelte3#66 is fixed and we have upgraded to a version of eslint-plugin-svelte3 which includes the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants