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

Enhancing Code Quality: Linting and Formatting Improvements #81

Merged
merged 5 commits into from
Mar 30, 2024

Conversation

siguici
Copy link
Collaborator

@siguici siguici commented Mar 29, 2024

This PR complements the great work done by @iivvaannxx by adding scripts for linting and organizing imports, as well as checking both using the biome ci . command. Additionally, since Biome supports all files in this project, I removed the --no-errors-on-unmatched and --files-ignore-unknown=true flags.

I noticed that Lefthook indicates that it didn't find any matching files. I don't use this tool, so I'm not sure if this is normal or not.

@thejackshelton
Copy link
Member

Looks good from what I've tested! (running each of the scripts, and making some sample commits).

I didn't see a warning from lefthook about no matching files.

@iivvaannxx does anything look off with lefthook here?

@siguici
Copy link
Collaborator Author

siguici commented Mar 30, 2024

The warning must be coming from my end. Let's see what @iivvaannxx thinks.

Copy link

changeset-bot bot commented Mar 30, 2024

⚠️ No Changeset found

Latest commit: 8d7c398

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@thejackshelton thejackshelton merged commit dd3a348 into QwikDev:main Mar 30, 2024
@iivvaannxx
Copy link
Contributor

@siguici @thejackshelton Mmm the change on the JSON schema looks good to me. However, regarding the change on the command flags I am not sure, the fact that lefthook is telling you that no files were processed may be precisely because of the removal of --no-errors-on-unmatched. What I did was just follow the docs here. Indeed, they say that those flags are not strictly necessary, but you may like to use them to:

  • Silent possible errors if no files were matched for --no-errors-on-unmatched
  • Prevent Biome for handling unknown files for --files-ignore-unknown=true

Removing --files-ignore-unknown in the lefthook.yaml it's okay because we are already using the glob option. But that only applies for the command run via lefthook. For the npm comands it will run for every non-ignored file in the repo. I believe the ignore list in the biome.json it's fine, it should not analyze any files it's not supposed to.

In my case for example, I have a couple of extra files in the repo that are not committed. These files configure my development environment so I can work with the repo because my machine runs a linux distribution which is a bit special and makes some of the binaries shipped with NPM packages (like the Biome CLI) not work out of the box. For me it didn't make sense adding these files to the Biome ignore list, so adding --files-ignore-unknown=true prevented Biome from analyzing them and failing whenever I executed those commands. I guess that's also why the docs use it in the examples, it acts as a "last barrier" in case files non-recognizable by Biome are given.

Now, if you want to leave it like this I have no problem, I think I should be able to work around that by manually passing the flags or temporarily modifying the commands if I want to work on some PR.

One last thing I actually discourage is the usage of --apply-unsafe on the lint command, I believe in most situations it would not probably bring many problems at all, but sometimes it may introduce changes that may need manual review and that it's not always desired.

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.

3 participants