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

prettier removes eslint disable comments in svelte components #19

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

prettier removes eslint disable comments in svelte components #19

hamilton opened this issue Jun 19, 2020 · 8 comments

Comments

@hamilton
Copy link
Collaborator

hamilton commented Jun 19, 2020

It appears that I cannot make my eslint disable comments survive svelte + prettier. I think this is a new thing, probably from one of the dependabot merges, but this collides with the eslint errors being surfaced in the #18.

@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

I'm looking into this. Can you help me build a reproducible example? The disable lines in the following example aren't removed when I run npm run format:

<script>
  /* eslint-disable no-var, vars-on-top */

  import { writable, derived } from "svelte/store";

  var value = writable(0);

  // eslint-disable-next-line no-unused-vars
  $: $value = 5;

  const double = derived(value, ($value) => value * 2); // eslint-disable-line no-unused-vars, no-shadow
</script>

<p>Double is {$double}</p>

@hamilton
Copy link
Collaborator Author

hamilton commented Jun 26, 2020

I believe I encountered this in an arrow function inside the template itself, for instance something like

<button on:click={() => {
   acc = acc - 10; // eslint-disable-line
}}>click</button>

@hamilton
Copy link
Collaborator Author

I recognize this might be a limitation of svelte eslint support at this point.

@hamilton
Copy link
Collaborator Author

(I figured it out since CI passes! I just won't do that sort of thing in the future.)

@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

Ah. Still, that shouldn't happen. Thanks for the help. I opened a bug:

sveltejs/prettier-plugin-svelte#104

@hamilton
Copy link
Collaborator Author

Thanks for filing, appreciate it. I should have just done that myself.

@openjck
Copy link
Contributor

openjck commented Jun 26, 2020

No worries. I'll keep track of the issue and close this once it's fixed.

@openjck
Copy link
Contributor

openjck commented Aug 19, 2020

Note:

We can close this after sveltejs/prettier-plugin-svelte#104 is fixed and we upgrade to a version of prettier-plugin-svelte 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