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

format: replace @import("./foo.zig") with @import("foo.zig") #16365

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fel1x-developer
Copy link
Contributor

@fel1x-developer fel1x-developer commented Jan 12, 2025

@import("./foo.zig") and @import("foo.zig") are equivalent, and ziglang/zig uses @import("foo.zig") in their lib/std since ./ is redundant.

Even in C++, this is not the case. #include "foo.h" is common, whereas #include "./foo.h" is not.

What does this PR do?

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

@paperclover
Copy link
Member

instead of manually fixing this, this type of style thing should be enforced through a linter, or else the problem will just come back.

@fel1x-developer
Copy link
Contributor Author

instead of manually fixing this, this type of style thing should be enforced through a linter, or else the problem will just come back.

This cannot be fixed by linter yet because neither zig fmt and vscode-zig's auto-format support this case. I created an issue in ziglang/vscode-zig(ziglang/vscode-zig#379) to support this feature. Until zig or vscode have a feature to format this, we should check manually if the correct syntax is used when reviewing new PRs.

#16366 suggests making a coding style for Bun project, and I have written a section about this.

@fel1x-developer
Copy link
Contributor Author

@paperclover Could you give a try for CI run?

`@import("./foo.zig")` and `@import("foo.zig")` are equivalent, and
ziglang/zig uses `@import("foo.zig")` in their lib/std since `./` is
redundant.

Even in C++, this is not the case. `#include "foo.h"` is common, whereas
`#include "./foo.h"` is not.
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.

2 participants