Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ disallowed-methods = [
{ path = "str::replace", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replace` instead." },
{ path = "str::replacen", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replacen` instead." },
{ path = "std::env::current_dir", reason = "To get an `AbsolutePathBuf`, Use `vite_path::current_dir` instead." },
{ path = "std::thread::sleep", reason = "Use proper synchronization (channels, condvars, etc.) instead of sleeping. Sleep is only acceptable for intentional user-facing delays (e.g. animations, debouncing)." },
{ path = "tokio::time::sleep", reason = "Use proper synchronization (channels, signals, etc.) instead of sleeping. Sleep is only acceptable for intentional user-facing delays (e.g. animations, debouncing)." },
]

disallowed-types = [
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ jobs:
env:
RUSTFLAGS: '-D warnings --cfg tokio_unstable' # also update .cargo/config.toml

- run: cargo clippy --all-targets --all-features -- -D warnings
- name: Clippy
id: clippy
continue-on-error: true
run: cargo clippy --all-targets --all-features -- -D warnings

# Set up node and pnpm for running tests
# For x86_64-apple-darwin, use x64 node for fspy tests that verify Node.js fs accesses
Expand All @@ -87,6 +90,10 @@ jobs:
- run: cargo-zigbuild test --target x86_64-unknown-linux-gnu.2.17
if: ${{ matrix.os == 'ubuntu-latest' }}

- name: Check clippy result
if: ${{ steps.clippy.outcome == 'failure' }}
run: exit 1

fmt:
name: Format and Check Deps
runs-on: ubuntu-latest
Expand Down
26 changes: 26 additions & 0 deletions .non-vite.clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Clippy configuration for non-vite crates (fspy_*, subprocess_test, pty_terminal, etc.)
# that don't depend on vite_str/vite_path.
#
# This is a subset of the root .clippy.toml, with rules recommending vite_str/vite_path
# alternatives removed. Generic rules (cow_utils, rustc-hash) still apply.
#
# To use: symlink as `.clippy.toml` in the crate's directory:
# ln -s ../../.non-vite.clippy.toml .clippy.toml

avoid-breaking-exported-api = false

disallowed-methods = [
{ path = "str::to_ascii_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_lowercase` instead." },
{ path = "str::to_ascii_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_uppercase` instead." },
{ path = "str::to_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_lowercase` instead." },
{ path = "str::to_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_uppercase` instead." },
{ path = "str::replace", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replace` instead." },
{ path = "str::replacen", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replacen` instead." },
{ path = "std::thread::sleep", reason = "Use proper synchronization (channels, condvars, etc.) instead of sleeping. Sleep is only acceptable for intentional user-facing delays (e.g. animations, debouncing)." },
{ path = "tokio::time::sleep", reason = "Use proper synchronization (channels, signals, etc.) instead of sleeping. Sleep is only acceptable for intentional user-facing delays (e.g. animations, debouncing)." },
]

disallowed-types = [
{ path = "std::collections::HashMap", reason = "Use `rustc_hash::FxHashMap` instead, which is typically faster." },
{ path = "std::collections::HashSet", reason = "Use `rustc_hash::FxHashSet` instead, which is typically faster." },
]
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Test fixtures and snapshots:
cargo xtest --builder cargo-xwin --target aarch64-pc-windows-msvc -p <package> --test <test>

# Examples:
cargo xtest --builder cargo-xwin --target aarch64-pc-windows-msvc -p vite_pty --test terminal
cargo xtest --builder cargo-xwin --target aarch64-pc-windows-msvc -p vite_pty --test terminal -- resize_terminal
cargo xtest --builder cargo-xwin --target aarch64-pc-windows-msvc -p pty_terminal --test terminal
cargo xtest --builder cargo-xwin --target aarch64-pc-windows-msvc -p pty_terminal --test terminal -- resize_terminal
```

3. **Cross-Platform Test Design Patterns**:
Expand All @@ -64,7 +64,7 @@ Test fixtures and snapshots:
- **Unix**: SIGWINCH signals, ioctl, /dev/null, etc.
- **Windows**: ConPTY, GetConsoleScreenBufferInfo, NUL, etc.

4. **Example**: The `vite_pty::resize_terminal` test demonstrates proper cross-platform testing:
4. **Example**: The `pty_terminal::resize_terminal` test demonstrates proper cross-platform testing:
- Unix: Installs SIGWINCH handler to verify signal delivery
- Windows: Acknowledges synchronous ConPTY resize behavior
- Both: Query terminal size using cross-platform `terminal_size` crate
Expand Down
Loading