Repository navigation
Expand file tree
/
Copy pathclippy.toml
More file actions
147 lines (143 loc) · 13.8 KB
/
Copy pathclippy.toml
File metadata and controls
147 lines (143 loc) · 13.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# The handles of `bun lint` are a `&File` and an index. They are hashed and compared by the index alone. A `RuleId` is by name or address.
ignore-interior-mutability = ["..", "bun_lint::ast::File", "bun_lint::linter::message::RuleId"]
disallowed-methods = [
{ path = "std::fs::read", reason = "use bun_sys::file" },
{ path = "std::fs::write", reason = "use bun_sys::file" },
{ path = "std::fs::read_to_string", reason = "use bun_sys::file" },
{ path = "std::fs::remove_file", reason = "use bun_sys::file" },
{ path = "std::fs::remove_dir_all", reason = "use bun_sys::dir" },
{ path = "std::fs::create_dir", reason = "use bun_sys::dir" },
{ path = "std::fs::create_dir_all", reason = "use bun_sys::dir" },
{ path = "std::fs::metadata", reason = "use bun_sys::file" },
{ path = "std::fs::canonicalize", reason = "use bun_paths" },
{ path = "std::fs::rename", reason = "use bun_sys::file" },
{ path = "std::fs::read_dir", reason = "use bun_sys::dir" },
{ path = "std::fs::read_link", reason = "use bun_sys::file" },
{ path = "std::fs::symlink_metadata", reason = "use bun_sys::file" },
{ path = "std::os::unix::fs::symlink", reason = "use bun_sys::file" },
{ path = "libc::read", reason = "use bun_sys::read", allow-invalid = true },
{ path = "libc::write", reason = "use bun_sys::write", allow-invalid = true },
{ path = "libc::fstat", reason = "use bun_sys::fstat", allow-invalid = true },
{ path = "libc::fsync", reason = "use bun_sys::fsync", allow-invalid = true },
{ path = "libc::fdatasync", reason = "use bun_sys::fdatasync", allow-invalid = true },
{ path = "libc::truncate", reason = "use bun_sys::truncate", allow-invalid = true },
{ path = "libc::link", reason = "use bun_sys::link", allow-invalid = true },
{ path = "libc::unlink", reason = "use bun_sys::unlink", allow-invalid = true },
{ path = "libc::rmdir", reason = "use bun_sys::rmdir", allow-invalid = true },
{ path = "libc::mkdtemp", reason = "use bun_sys::mkdtemp", allow-invalid = true },
{ path = "libc::isatty", reason = "use bun_sys::isatty", allow-invalid = true },
{ path = "libc::socketpair", reason = "use bun_sys::socketpair", allow-invalid = true },
{ path = "libc::fallocate", reason = "use bun_sys::linux::fallocate", allow-invalid = true },
{ path = "libc::splice", reason = "use bun_sys::linux::splice", allow-invalid = true },
{ path = "libc::shm_open", reason = "use bun_sys::freebsd::create_shared_memory", allow-invalid = true },
{ path = "libc::ioctl", reason = "use a function of bun_sys for the request", allow-invalid = true },
{ path = "libc::cfsetispeed", reason = "use bun_sys::posix::cfsetspeed", allow-invalid = true },
{ path = "libc::cfsetospeed", reason = "use bun_sys::posix::cfsetspeed", allow-invalid = true },
{ path = "libc::socket", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::bind", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::listen", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::getsockopt", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::setsockopt", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::getsockname", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::getpeername", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::if_nametoindex", reason = "use bun_sys::net", allow-invalid = true },
{ path = "libc::if_indextoname", reason = "use bun_sys::net", allow-invalid = true },
{ path = "std::env::var", reason = "use bun_core::env_var" },
{ path = "std::env::var_os", reason = "use bun_core::env_var" },
{ path = "std::thread::spawn", reason = "use std::thread::Builder with a stack size, and name the thread (Output::Source::configure_named_thread), or use bun_threading::ThreadPool" },
{ path = "std::mem::zeroed", reason = "use MaybeUninit; zeroed is UB for most Bun types" },
{ path = "bun_core::output::pretty_fmt_rt", reason = "const format strings must use pretty_fmt!/write_pretty! (compile-time rewrite); the runtime walk is only for templates built at runtime — allow with justification" },
{ path = "bun_core::output::pretty_fmt_args", reason = "const format strings must use pretty_fmt!/write_pretty! (compile-time rewrite); the runtime walk is only for templates built at runtime — allow with justification" },
{ path = "bun_core::output::pretty_fmt_runtime", reason = "const format strings must use pretty_fmt!/write_pretty! (compile-time rewrite); the runtime walk is only for templates built at runtime — allow with justification" },
{ path = "bun_core::output::pretty", reason = "renders args then tag-walks the rendered bytes (allocates twice, mangles user-controlled '<'); use the pretty! macro — allow only for runtime-built payloads, with justification" },
{ path = "bun_core::output::prettyln", reason = "renders args then tag-walks the rendered bytes; use the prettyln! macro — allow only for runtime-built payloads, with justification" },
{ path = "bun_core::output::pretty_errorln", reason = "renders args then tag-walks the rendered bytes; use the pretty_errorln! macro — allow only for runtime-built payloads, with justification" },
{ path = "bun_core::output::warn", reason = "renders args then tag-walks the rendered bytes; use the warn! macro — allow only for runtime-built payloads, with justification" },
{ path = "bun_core::output::debug_warn", reason = "renders args then tag-walks the rendered bytes; use the debug_warn! macro — allow only for runtime-built payloads, with justification" },
{ path = "alloc::string::String::from_utf8", reason = "keep data as bytes; for display use bstr::BStr, for JS-visible strings use bun_core::String::clone_utf8" },
{ path = "alloc::string::String::from_utf8_lossy", reason = "silently corrupts non-UTF-8 bytes and allocates; keep data as bytes (bstr::BStr for Display)" },
# == byte/substring search must go through bun_core::strings (highway, runtime-dispatched SIMD) ==
# libcore's searchers are scalar or compile-time-gated SSE2/NEON (we build with
# -Ctarget-cpu=nehalem on x64); highway picks AVX2/AVX-512 at runtime. The
# element-generic forms (`<[u8]>::contains`, `iter().position(|b| ..)`) can't be
# expressed here and are covered by test/internal/source-lints/byte-search.test.ts.
{ path = "str::find", reason = "use bun_core::strings::index_of_char / index_of on .as_bytes() (highway SIMD)" },
{ path = "str::rfind", reason = "use bun_core::strings::last_index_of_char / last_index_of on .as_bytes() (highway SIMD)" },
{ path = "str::contains", reason = "use bun_core::strings::contains_char / contains on .as_bytes() (highway SIMD)" },
{ path = "str::split_once", reason = "use bun_core::strings::split_once_char / split_once on .as_bytes() (highway SIMD)" },
{ path = "str::rsplit_once", reason = "use bun_core::strings::rsplit_once_char / rsplit_once on .as_bytes() (highway SIMD)" },
{ path = "str::split", reason = "use bun_core::strings::split on .as_bytes() (highway SIMD)" },
{ path = "str::rsplit", reason = "use bun_core::strings on .as_bytes() (highway SIMD)" },
{ path = "str::splitn", reason = "use bun_core::strings::split / split_once on .as_bytes() (highway SIMD)" },
{ path = "str::rsplitn", reason = "use bun_core::strings::rsplit_once on .as_bytes() (highway SIMD)" },
{ path = "str::split_terminator", reason = "use bun_core::strings::split on .as_bytes() (highway SIMD)" },
{ path = "str::rsplit_terminator", reason = "use bun_core::strings on .as_bytes() (highway SIMD)" },
{ path = "str::split_inclusive", reason = "use bun_core::strings::index_of_char in a loop on .as_bytes() (highway SIMD)" },
{ path = "str::lines", reason = "use bun_core::strings::split(bytes, b\"\\n\") and strip a trailing b'\\r' per field (str::lines does) (highway SIMD)" },
{ path = "str::matches", reason = "use bun_core::strings on .as_bytes() (highway SIMD)" },
{ path = "str::rmatches", reason = "use bun_core::strings on .as_bytes() (highway SIMD)" },
{ path = "str::match_indices", reason = "use bun_core::strings on .as_bytes() (highway SIMD)" },
{ path = "str::rmatch_indices", reason = "use bun_core::strings on .as_bytes() (highway SIMD)" },
{ path = "str::replace", reason = "use bun_core::strings::replace_owned on .as_bytes() (highway SIMD)" },
{ path = "str::replacen", reason = "use bun_core::strings::replace_owned on .as_bytes() (highway SIMD)" },
{ path = "slice::windows", reason = "substring search must use bun_core::strings::index_of (highway memmem); for genuine sliding-window iteration, #[allow] with a reason" },
{ path = "memchr::memchr", reason = "use bun_core::strings::index_of_char (highway SIMD)" },
{ path = "memchr::memchr2", reason = "use bun_core::strings::index_of_any (highway SIMD)" },
{ path = "memchr::memchr3", reason = "use bun_core::strings::index_of_any (highway SIMD)" },
{ path = "memchr::memrchr", reason = "use bun_core::strings::last_index_of_char (highway SIMD)" },
{ path = "memchr::memchr_iter", reason = "use bun_core::strings::index_of_char in a loop (highway SIMD)" },
{ path = "memchr::memmem::find", reason = "use bun_core::strings::index_of (highway memmem)" },
{ path = "memchr::memmem::rfind", reason = "use bun_core::strings::last_index_of (highway memrmem)" },
{ path = "memchr::memmem::find_iter", reason = "use bun_core::strings::index_of in a loop (highway memmem)" },
{ path = "bstr::ByteSlice::find", reason = "use bun_core::strings::index_of (highway memmem)" },
{ path = "bstr::ByteSlice::rfind", reason = "use bun_core::strings::last_index_of (highway memrmem)" },
{ path = "bstr::ByteSlice::find_byte", reason = "use bun_core::strings::index_of_char (highway SIMD)" },
{ path = "bstr::ByteSlice::rfind_byte", reason = "use bun_core::strings::last_index_of_char (highway SIMD)" },
{ path = "bstr::ByteSlice::find_char", reason = "use bun_core::strings::index_of_char / index_of (highway SIMD)" },
{ path = "bstr::ByteSlice::rfind_char", reason = "use bun_core::strings::last_index_of_char / last_index_of (highway SIMD)" },
{ path = "bstr::ByteSlice::find_byteset", reason = "use bun_core::strings::index_of_any (highway SIMD)" },
{ path = "bstr::ByteSlice::contains_str", reason = "use bun_core::strings::contains (highway memmem)" },
{ path = "bstr::ByteSlice::find_iter", reason = "use bun_core::strings::index_of in a loop (highway memmem)" },
{ path = "bstr::ByteSlice::rfind_iter", reason = "use bun_core::strings::last_index_of in a loop (highway memrmem)" },
{ path = "bstr::ByteSlice::split_str", reason = "use bun_core::strings::split (highway memmem)" },
{ path = "bstr::ByteSlice::rsplit_str", reason = "use bun_core::strings (highway memrmem)" },
{ path = "bstr::ByteSlice::split_once_str", reason = "use bun_core::strings::split_once (highway memmem)" },
{ path = "bstr::ByteSlice::rsplit_once_str", reason = "use bun_core::strings::rsplit_once (highway memrmem)" },
{ path = "bstr::ByteSlice::replace", reason = "use bun_core::strings::replace_owned (highway memmem)" },
# `u8x16` and the other aliases hide `Simd` and `Mask` from disallowed-types, so their constructors are listed too.
{ path = "core::simd::Simd::splat", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Simd::from_array", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Simd::from_slice", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Simd::load_or_default", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Simd::load_or", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Mask::splat", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Mask::from_array", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Mask::from_bitmask", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
]
disallowed-types = [
{ path = "std::sync::Mutex", reason = "use bun_threading::Mutex" },
{ path = "std::sync::RwLock", reason = "use bun_threading::RwLock" },
{ path = "parking_lot::Mutex", reason = "use bun_threading::Mutex" },
{ path = "parking_lot::RwLock", reason = "use bun_threading::RwLock" },
{ path = "parking_lot::RawMutex", reason = "use bun_threading::Mutex" },
{ path = "std::collections::HashMap", reason = "use bun_collections (wyhash)" },
{ path = "std::collections::HashSet", reason = "use bun_collections (wyhash)" },
{ path = "std::fs::File", reason = "use bun_sys::File" },
{ path = "core::simd::Simd", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "core::simd::Mask", reason = "use bun_highway / bun_core::strings (highway): one SIMD system, with runtime dispatch" },
{ path = "std::process::Command", reason = "use bun_core::util::spawn_sync_inherit (CLI helpers) or bun_spawn_sys (full control)" },
{ path = "std::backtrace::Backtrace", reason = "release builds compile std without its `backtrace` feature (scripts/build/rust.ts), so this captures frames it cannot symbolize; use bun_core::dump_current_stack_trace (bun_crash_handler)" },
]
disallowed-macros = [
{ path = "std::println", reason = "use bun_core::output" },
{ path = "std::eprintln", reason = "use bun_core::output" },
{ path = "std::print", reason = "use bun_core::output" },
{ path = "std::eprint", reason = "use bun_core::output" },
{ path = "std::dbg", reason = "remove before commit" },
]
pass-by-value-size-limit = 64
stack-size-threshold = 131072
enum-variant-size-threshold = 128
too-large-for-stack = 4096
avoid-breaking-exported-api = false
accept-comment-above-attributes = true