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

Svelte import sort #284

Closed
wants to merge 3 commits into from
Closed

Conversation

secondfry
Copy link

No description provided.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason behind this is jest failing to require an ESM module.
This patch is only applied to dev install, since prettier-plugin-svelte is dev dependency.

import { vuePreprocessor } from './preprocessors/vue-preprocessor';

const { parsers: svelteParsers } = require('prettier-plugin-svelte');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier-plugin-svelte@2 works with prettier@2 and has no types. This require is used to skip typing the module.
prettier-plugin-svelte@3 has typings.

@secondfry
Copy link
Author

It does not help with <script lang="ts">. I will fix it and update the PR.

@secondfry
Copy link
Author

Apparently I was mistaken – I thought that plugin does not work due to the fact that it didn't sort imports in such scenario:

import A from '../A.svelte';

import './app.css';

import B from 'svelte';

Plugin does indeed work and splits imports into chunks and does not sort around side effect imports.
Thus this PR is unneeded. Closing it.

@secondfry secondfry closed this Feb 29, 2024
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

Successfully merging this pull request may close these issues.

None yet

1 participant