svelteuidev / svelteui

SvelteUI Monorepo
https://svelteui.dev
MIT License
1.27k stars 63 forks source link

[core]: linting and formatting precommit hook #403

Closed khalibloo closed 1 year ago

khalibloo commented 1 year ago

Description

Fixed prettier script in lint-staged. Added eslint to lint-staged. Fixed linting errors. Formatted all files with prettier.

Before submitting the PR, please make sure you do the following

khalibloo commented 1 year ago

There are lots of changes because I ran prettier on all files. To ease the review, the prettier command was run in a separate commit. The commits can thus be reviewed sequentially.

With prettier in place now, there's an odd behavior that emerges. Running yarn prepush (specifically the syncpack command) changes the line endings of the package.json files in the monorepo. They appear as false changes in the git status, but when you try to stage and commit the change, prettier fixes the line endings and the git status becomes clean again, leaving you with an empty commit. I can't find any option in syncpack to address the line endings.

BeeMargarida commented 1 year ago

This should not be doing all those changes, since it should only be applying the eslint and prettier configs that we are already doing for prepush. Why these changes?

khalibloo commented 1 year ago

This should not be doing all those changes, since it should only be applying the eslint and prettier configs that we are already doing for prepush. Why these changes?

I ran the prettier command in the root of the project yarn prettier --write . and it produced all those changes. But even before this PR, I noticed when I touched some files, formatting them produced new changes. That's what led me to believe the files weren't getting formatted during the commits or during yarn prepush.

BeeMargarida commented 1 year ago

Hum, let me check on my side, I have not touched prettier/eslint setup in some time