Skip to content

Commit 9167cd9

Browse files
fix most typos, add crate-ci/typos to CI (#2653)
* fix most typos, add crate-ci/typos to CI --------- Co-authored-by: Jonathan Kelley <[email protected]>
1 parent 841b447 commit 9167cd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+258
-203
lines changed

.github/workflows/main.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,15 @@ jobs:
117117
cache-all-crates: "true"
118118
save-if: ${{ github.ref == 'refs/heads/main' }}
119119
- run: cargo fmt --all -- --check
120-
120+
121+
typos:
122+
if: github.event.pull_request.draft == false
123+
name: Check for typos
124+
runs-on: ubuntu-latest
125+
steps:
126+
- uses: actions/checkout@v4
127+
- name: Check for typos
128+
uses: crate-ci/typos@master
121129
clippy:
122130
if: github.event.pull_request.draft == false
123131
name: Clippy

_typos.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[default.extend-words]
2+
# https://ratatui.rs/
3+
ratatui = "ratatui"
4+
# lits is short for literals
5+
lits = "lits"
6+
# https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeked_event
7+
seeked = "seeked"
8+
9+
[files]
10+
extend-exclude = ["translations/*", "CHANGELOG.md", "*.js"]

examples/PWA-example/public/sw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ self.addEventListener("fetch", function (event) {
137137
- You should also consider the origin. It's easier to decide what
138138
"unavailable" means for requests against your origins than for requests
139139
against a third party, such as an ad provider.
140-
- Generate a Response programmaticaly, as shown below, and return that.
140+
- Generate a Response programmatically, as shown below, and return that.
141141
*/
142142

143143
//console.log('WORKER: fetch request failed in both cache and network.');

examples/counters.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn app() -> Element {
1212
// Store the counters in a signal
1313
let mut counters = use_signal(|| vec![0, 0, 0]);
1414

15-
// Whenver the counters change, sum them up
15+
// Whenever the counters change, sum them up
1616
let sum = use_memo(move || counters.read().iter().copied().sum::<i32>());
1717

1818
rsx! {

examples/crm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! in a way that works across pages.
88
//!
99
//! We implement a number of important details here too, like focusing inputs, handling form submits, navigating the router,
10-
//! platform-specific configuration, and importing 3rd party CSS libaries.
10+
//! platform-specific configuration, and importing 3rd party CSS libraries.
1111
1212
use dioxus::prelude::*;
1313

examples/flat_router.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! This example shows how to use the `Router` component to create a simple navigation system.
2-
//! The more complex router example uses all of the router features, while this simple exmaple showcases
2+
//! The more complex router example uses all of the router features, while this simple example showcases
33
//! just the `Layout` and `Route` features.
44
//!
55
//! Layouts let you wrap chunks of your app with a component. This is useful for things like a footers, heeaders, etc.

examples/form.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn app() -> Element {
3737

3838
// On desktop/liveview, the form will not navigate the page - the expectation is that you handle
3939
// The form event.
40-
// Howver, if your form doesn't have a submit handler, it might navigate the page depending on the webview.
40+
// However, if your form doesn't have a submit handler, it might navigate the page depending on the webview.
4141
// We suggest always attaching a submit handler to the form.
4242
onsubmit: move |ev| {
4343
println!("Submit event: {:#?}", ev);

examples/future.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! A simple example that shows how to use the use_future hook to run a background task.
22
//!
3-
//! use_future won't return a value, analagous to use_effect.
3+
//! use_future won't return a value, analogous to use_effect.
44
//! If you want to return a value from a future, use use_resource instead.
55
66
use dioxus::prelude::*;

examples/multiwindow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Multiwindow example
22
//!
3-
//! This exmaple shows how to implement a simple multiwindow application using dioxus.
3+
//! This example shows how to implement a simple multiwindow application using dioxus.
44
//! This works by spawning a new window when the user clicks a button. We have to build a new virtualdom which has its
55
//! own context, root elements, etc.
66

examples/openid_connect_demo/Dioxus.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# dioxus project name
44
name = "OpenID Connect authentication demo"
55

6-
# default platfrom
6+
# default platform
77
# you can also use `dioxus serve/build --platform XXX` to use other platform
88
# value: web | desktop
99
default_platform = "web"

examples/optional_props.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn app() -> Element {
3131
e: "asd".to_string(),
3232
}
3333

34-
// `b` and `e` are ommitted
34+
// `b` and `e` are omitted
3535
Button {
3636
a: "asd".to_string(),
3737
c: "asd".to_string(),

examples/rsx_usage.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ mod baller {
261261
}
262262
}
263263

264-
/// Documention for this component is visible within the rsx macro
264+
/// Documentation for this component is visible within the rsx macro
265265
#[component]
266266
pub fn Taller(
267267
/// Fields are documented and accessible in rsx!

examples/signals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! A simple example demonstrating how to use signals to modify state from several different places.
22
//!
3-
//! This simlpe example implements a counter that can be incremented, decremented, and paused. It also demonstrates
3+
//! This simple example implements a counter that can be incremented, decremented, and paused. It also demonstrates
44
//! that background tasks in use_futures can modify the value as well.
55
//!
66
//! Most signals implement Into<ReadOnlySignal<T>>, making ReadOnlySignal a good default type when building new

examples/web_component.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ fn app() -> Element {
1414
rsx! {
1515
div {
1616
h1 { "Web Components" }
17-
CoolWebComponet { my_prop: "Hello, world!".to_string() }
17+
CoolWebComponent { my_prop: "Hello, world!".to_string() }
1818
}
1919
}
2020
}
2121

2222
/// A web-component wrapped with a strongly typed interface using a component
2323
#[component]
24-
fn CoolWebComponet(my_prop: String) -> Element {
24+
fn CoolWebComponent(my_prop: String) -> Element {
2525
rsx! {
2626
// rsx! takes a webcomponent as long as its tag name is separated with dashes
2727
web-component {

packages/autofmt/tests/samples/staged.rsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ rsx! {
33

44
div { "hi" }
55

6-
div { class: "helo", "hi" }
6+
div { class: "hello", "hi" }
77

8-
div { class: "helo", glass: "123", "hi" }
8+
div { class: "hello", glass: "123", "hi" }
99

1010
div { {some_expr} }
1111
div {

packages/autofmt/tests/wrong/multiexpr-4sp.rsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn ItWroks() {
1+
fn ItWorks() {
22
rsx! {
33
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
44
{left}

packages/autofmt/tests/wrong/multiexpr-4sp.wrong.rsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn ItWroks() {
1+
fn ItWorks() {
22
rsx! {
33
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light", {left}, {right} }
44
}

packages/autofmt/tests/wrong/multiexpr-tab.rsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn ItWroks() {
1+
fn ItWorks() {
22
rsx! {
33
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
44
{left}

packages/autofmt/tests/wrong/multiexpr-tab.wrong.rsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fn ItWroks() {
1+
fn ItWorks() {
22
rsx! {
33
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light", {left}, {right} }
44
}

packages/cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ crossterm = { version = "0.27.0", features = ["event-stream"] }
105105
ansi-to-tui = "=5.0.0-rc.1"
106106
ansi-to-html = "0.2.1"
107107

108-
# on maco, we need to specify the vendored feature on ssl when cross compiling
108+
# on macos, we need to specify the vendored feature on ssl when cross compiling
109109
# [target.'cfg(target_os = "macos")'.dependencies]
110110
# openssl = { version = "0.10", features = ["vendored"] }
111111

packages/cli/assets/dioxus.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# dioxus project name
44
name = "{{project-name}}"
55

6-
# default platfrom
6+
# default platform
77
# you can also use `dx serve/build --platform XXX` to use other platform
88
# value: web | desktop
99
default_platform = "{{default-platform}}"

packages/cli/src/cli/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl LinkCommand {
1818
return Ok(());
1919
};
2020

21-
// Parse object files, deserialize JSON, & create a file to propogate JSON.
21+
// Parse object files, deserialize JSON, & create a file to propagate JSON.
2222
let json = manganis_cli_support::get_json_from_object_files(object_files);
2323
let parsed = serde_json::to_string(&json).unwrap();
2424

packages/cli/src/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
66

77
#[derive(ThisError, Debug)]
88
pub enum Error {
9-
/// Used when errors need to propogate but are too unique to be typed
9+
/// Used when errors need to propagate but are too unique to be typed
1010
#[error("{0}")]
1111
Unique(String),
1212

packages/cli/src/serve/proxy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ mod test {
176176
.unwrap();
177177
});
178178

179-
// Expose *just* the fileystem web server's address
179+
// Expose *just* the filesystem web server's address
180180
server_handle_handle.listening().await.unwrap().to_string()
181181
}
182182

packages/cli/src/serve/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ fn no_cache(
471471
let mut response = response.into_response();
472472

473473
// If there's a 404 and we're supposed to index on 404, upgrade that failed request to the index.html
474-
// We migth want to isnert a header here saying we *did* that but oh well
474+
// We might want to isnert a header here saying we *did* that but oh well
475475
if response.status() == StatusCode::NOT_FOUND && index_on_404 {
476476
let body = Body::from(std::fs::read_to_string(out_dir.join("index.html")).unwrap());
477477

packages/cli/src/serve/watcher.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ impl Watcher {
248248
}
249249

250250
/// Ensure the changes we've received from the queue are actually legit changes to either assets or
251-
/// rust code. We don't care about changes otherwise, unless we get a signle elsewhere to do a full rebuild
251+
/// rust code. We don't care about changes otherwise, unless we get a signal elsewhere to do a full rebuild
252252
pub fn pending_changes(&mut self) -> bool {
253253
!self.queued_events.is_empty()
254254
}

packages/cli/src/tools.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl Tool {
217217
"windows" => tool_path.join(&dir_name).join(self.name()).join(".exe"),
218218
_ => tool_path.join(&dir_name).join(self.name()),
219219
};
220-
// Manualy creating tool directory because we directly download the binary via Github
220+
// Manually creating tool directory because we directly download the binary via Github
221221
std::fs::create_dir(tool_path.join(dir_name))?;
222222

223223
let mut final_file = std::fs::File::create(&bin_path)?;

packages/core-macro/src/component.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl ToTokens for ComponentBody {
4040
// No props declared, so we don't need to generate a props struct
4141
true => quote! {},
4242

43-
// Props declared, so we generate a props struct and thatn also attach the doc attributes to it
43+
// Props declared, so we generate a props struct and then also attach the doc attributes to it
4444
false => {
4545
let doc = format!("Properties for the [`{}`] component.", &comp_fn.sig.ident);
4646
let props_struct = self.props_struct();

packages/core/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If you are just starting, check out the Guides first.
4040

4141
## Understanding the implementation
4242

43-
`dioxus-core` is designed to be a lightweight crate that. It exposes a number of flexible primitives without being deeply concerned about the intracices of state management itself. We proivde a number of useful abstractions built on these primitives in the `dioxus-hooks` crate as well as the `dioxus-signals` crate.
43+
`dioxus-core` is designed to be a lightweight crate that. It exposes a number of flexible primitives without being deeply concerned about the intracices of state management itself. We provide a number of useful abstractions built on these primitives in the `dioxus-hooks` crate as well as the `dioxus-signals` crate.
4444

4545
The important abstractions to understand are:
4646

packages/core/src/arena.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,25 @@ impl VirtualDom {
9292
}
9393

9494
impl ElementPath {
95-
pub(crate) fn is_decendant(&self, small: &[u8]) -> bool {
95+
pub(crate) fn is_descendant(&self, small: &[u8]) -> bool {
9696
small.len() <= self.path.len() && small == &self.path[..small.len()]
9797
}
9898
}
9999

100100
#[test]
101-
fn is_decendant() {
101+
fn is_descendant() {
102102
let event_path = ElementPath {
103103
path: &[1, 2, 3, 4, 5],
104104
};
105105

106-
assert!(event_path.is_decendant(&[1, 2, 3, 4, 5]));
107-
assert!(event_path.is_decendant(&[1, 2, 3, 4]));
108-
assert!(event_path.is_decendant(&[1, 2, 3]));
109-
assert!(event_path.is_decendant(&[1, 2]));
110-
assert!(event_path.is_decendant(&[1]));
106+
assert!(event_path.is_descendant(&[1, 2, 3, 4, 5]));
107+
assert!(event_path.is_descendant(&[1, 2, 3, 4]));
108+
assert!(event_path.is_descendant(&[1, 2, 3]));
109+
assert!(event_path.is_descendant(&[1, 2]));
110+
assert!(event_path.is_descendant(&[1]));
111111

112-
assert!(!event_path.is_decendant(&[1, 2, 3, 4, 5, 6]));
113-
assert!(!event_path.is_decendant(&[2, 3, 4]));
112+
assert!(!event_path.is_descendant(&[1, 2, 3, 4, 5, 6]));
113+
assert!(!event_path.is_descendant(&[2, 3, 4]));
114114
}
115115

116116
impl PartialEq<&[u8]> for ElementPath {

packages/core/src/mutations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ impl Mutations {
344344
/// Rewrites IDs to just be "template", so you can compare the mutations
345345
///
346346
/// Used really only for testing
347-
pub fn santize(mut self) -> Self {
347+
pub fn sanitize(mut self) -> Self {
348348
for edit in self.edits.iter_mut() {
349349
if let Mutation::LoadTemplate { name, .. } = edit {
350350
*name = "template"

packages/core/src/nodes.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ impl Drop for VNode {
193193
// FIXME:
194194
// TODO:
195195
//
196-
// We have to add this drop *here* becase we can't add a drop impl to AttributeValue and
196+
// We have to add this drop *here* because we can't add a drop impl to AttributeValue and
197197
// keep semver compatibility. Adding a drop impl means you can't destructure the value, which
198198
// we need to do for enums.
199199
//
@@ -546,7 +546,7 @@ impl TemplateNode {
546546

547547
/// A node created at runtime
548548
///
549-
/// This node's index in the DynamicNode list on VNode should match its repsective `Dynamic` index
549+
/// This node's index in the DynamicNode list on VNode should match its respective `Dynamic` index
550550
#[derive(Debug)]
551551
pub enum DynamicNode {
552552
/// A component node
@@ -761,7 +761,7 @@ pub struct Attribute {
761761
impl Attribute {
762762
/// Create a new [`Attribute`] from a name, value, namespace, and volatile bool
763763
///
764-
/// "Volatile" referes to whether or not Dioxus should always override the value. This helps prevent the UI in
764+
/// "Volatile" refers to whether or not Dioxus should always override the value. This helps prevent the UI in
765765
/// some renderers stay in sync with the VirtualDom's understanding of the world
766766
pub fn new(
767767
name: &'static str,
@@ -1145,8 +1145,8 @@ pub trait HasAttributes {
11451145

11461146
#[cfg(debug_assertions)]
11471147
pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
1148-
let mut with_indecies = paths.iter().copied().enumerate().collect::<Vec<_>>();
1149-
with_indecies.sort_by(|(_, a), (_, b)| {
1148+
let mut with_indices = paths.iter().copied().enumerate().collect::<Vec<_>>();
1149+
with_indices.sort_by(|(_, a), (_, b)| {
11501150
let mut a = a.iter();
11511151
let mut b = b.iter();
11521152
loop {
@@ -1163,7 +1163,7 @@ pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
11631163
}
11641164
}
11651165
});
1166-
with_indecies
1166+
with_indices
11671167
}
11681168

11691169
#[test]

packages/core/src/reactive_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl ReactiveContext {
162162
/// # use futures_util::StreamExt;
163163
/// fn use_simplified_memo(mut closure: impl FnMut() -> i32 + 'static) -> Signal<i32> {
164164
/// use_hook(|| {
165-
/// // Create a new reactive context and channel that will recieve a value every time a value the reactive context subscribes to changes
165+
/// // Create a new reactive context and channel that will receive a value every time a value the reactive context subscribes to changes
166166
/// let (reactive_context, mut changed) = ReactiveContext::new();
167167
/// // Compute the value of the memo inside the reactive context. This will subscribe the reactive context to any values you read inside the closure
168168
/// let value = reactive_context.reset_and_run_in(&mut closure);

packages/core/src/scopes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{cell::Ref, rc::Rc};
66

77
/// A component's unique identifier.
88
///
9-
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unqiue across
9+
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unique across
1010
/// time. We do try and guarantee that between calls to `wait_for_work`, no ScopeIds will be recycled in order to give
1111
/// time for any logic that relies on these IDs to properly update.
1212
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]

packages/core/src/virtual_dom.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ impl VirtualDom {
887887

888888
for attr in attrs.iter() {
889889
// Remove the "on" prefix if it exists, TODO, we should remove this and settle on one
890-
if attr.name.get(2..) == Some(name) && target_path.is_decendant(this_path) {
890+
if attr.name.get(2..) == Some(name) && target_path.is_descendant(this_path) {
891891
listeners.push(&attr.value);
892892

893893
// Break if this is the exact target element.

0 commit comments

Comments
 (0)