Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Add prettier config #151

Closed
RikuVan opened this issue Nov 14, 2020 · 6 comments · Fixed by #168
Closed

Add prettier config #151

RikuVan opened this issue Nov 14, 2020 · 6 comments · Fixed by #168
Assignees

Comments

@RikuVan
Copy link
Contributor

RikuVan commented Nov 14, 2020

Would make it easier to do pull requests if the prettier settings were checked into the repo, e.g. .prettierrc or in the package.json

@illright
Copy link
Owner

Will do!

@illright
Copy link
Owner

Okay, so I tried setting it up, you can see it in the prettier branch. It's currently doing weird stuff with Svelte files, transforming the attractions/popover/popover-button.svelte file into this:

<script>
  import { createEventDispatcher } from 'svelte';
  import classes from '../utils/classes.js';

  let _class = null;
  export { _class as class };

  const dispatch = createEventDispatcher();
</script>

<svelte:options tag="a-popover-button" /><button
  type="button"
  class={classes('popover-button', _class)}
  on:click={e => dispatch('click', { nativeEvent: e })}
  {...$$restProps}
>
  <slot />
</button>

<style src="./popover-button.scss">
</style>

I am mostly bothered by that svelte:options thing. Have you encountered anything similar? Any ideas how to fix it?

@RikuVan
Copy link
Contributor Author

RikuVan commented Nov 14, 2020

oh, that is a bit annoying. Not an issue I was aware of. Have you been using prettier locally already in your editor with Svelte (just wondering of this is an issue when using config)? If you can't get it working maybe the minimum is to add a comment to disable prettier with the project until the bug for this whitespace removal is resolved.

@illright
Copy link
Owner

Nope, haven't used Prettier before. I'm thinking of opening an issue on the Svelte Prettier config about this and hold on to merging that branch until they fix it

@RikuVan
Copy link
Contributor Author

RikuVan commented Nov 14, 2020

seems to be an issue already in the plugin repo about putting options at the top: sveltejs/prettier-plugin-svelte#73

When I use prettier, I does move options to the markup part of the code but it doesn't remove whitespace between it and the next element. I suppose that is something in the prettier settings.

@aabounegm
Copy link
Collaborator

@illright Now that we no longer have <svelte:options> in the source code, maybe it's worth giving this another shot?

@illright illright self-assigned this Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants