feat: support handling .svelte files#950
Conversation
Without this addition, prettier-eslint will only run the Prettier step for .svelte files, but NOT the Eslint step!
🦋 Changeset detectedLatest commit: 1791e37 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codes look good to me, CI is broken, maybe a |
|
I'm new to this repo. Does the lint problem have anything to do with my pull request at all? |
The CI is broken because the new codes add one more complexity. See https://github.com/prettier/prettier-eslint/actions/runs/7572175398/job/20622456917?pr=950#step:5:17 |
As I don't have any experience with eslint complexity rule, I'm not 100% sure this is the correct way to do it.
|
@robertheessels Test case is missing, you can follow prettier-eslint/src/__tests__/index.js Lines 182 to 195 in 689f67a |
|
@JounQin I added the test an hour ago (even before your comment 😄), but the ci still seems to be in queue or something? |
|
https://github.com/prettier/prettier-eslint/actions/runs/7582808184/job/20654893335?pr=950 You'll need to add https://github.com/sveltejs/prettier-plugin-svelte at https://github.com/prettier/prettier-eslint/blob/master/.prettierrc.js Could you please run the test cases successfully before committing? I believe it should be added as an optional dependency. |
|
@JounQin Sorry for not running test locally, doing so now. Is .prettierrc.js even used in the tests? I have tried adding prettier-plugin-svelte to it, as I have done successfully in my other project, and in a few other different ways, but always it errors with Even if I add invalid strings in .prettierrc.js, the tests run without complaining about that, so I was wondering if .prettierrc.js is used in the tests? |
|
It should be related to prettier-eslint/src/__mocks__/prettier.js Line 10 in 689f67a You can change it just like |
|
@JounQin All tests passing locally. I had to add more packages than I expected, like
I have no idea how to do that? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #950 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 301 303 +2
Branches 83 84 +1
=========================================
+ Hits 301 303 +2 ☔ View full report in Codecov by Sentry. |
|
|
If I put any of my 3 packages in I have no experience at all with peerDependencies and optionalDependencies, so I really don't know what is best here? |
|
It's peerDependencies and peerDependenciesMeta, not optionalDependencies, as I linked above. I'll edit this PR later when I'm free then. |
See my last comment. :-) |
|
I don't understand, you were saying Both |
svelte package needed for test.
|
@robertheessels Thanks for your contribution! |
|
@JounQin You're welcome! Did the tests run in CI without the svelte package? They failed for me locally without it. |
|
@robertheessels It's already been listed in |
|
Right. Once a new prettier-eslint version is released, I can update the docs, if you want. We should tell users about the Svelte option? And maybe also suggested Prettier and Eslint configs for Svelte? |
|
Oh, sure, I totally forgot about the document part, feel free to raise a new PR. |
Without this addition, prettier-eslint will only run the Prettier step for .svelte files, but NOT the Eslint step!
close #525