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

fix most typos, add crate-ci/typos to CI #2653

Merged
merged 4 commits into from
Jul 24, 2024
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
10 changes: 9 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ jobs:
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo fmt --all -- --check


typos:
if: github.event.pull_request.draft == false
name: Check for typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
clippy:
if: github.event.pull_request.draft == false
name: Clippy
Expand Down
10 changes: 10 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[default.extend-words]
# https://ratatui.rs/
ratatui = "ratatui"
# lits is short for literals
lits = "lits"
# https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeked_event
seeked = "seeked"

[files]
extend-exclude = ["translations/*", "CHANGELOG.md", "*.js"]
2 changes: 1 addition & 1 deletion examples/PWA-example/public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ self.addEventListener("fetch", function (event) {
- You should also consider the origin. It's easier to decide what
"unavailable" means for requests against your origins than for requests
against a third party, such as an ad provider.
- Generate a Response programmaticaly, as shown below, and return that.
- Generate a Response programmatically, as shown below, and return that.
*/

//console.log('WORKER: fetch request failed in both cache and network.');
Expand Down
2 changes: 1 addition & 1 deletion examples/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn app() -> Element {
// Store the counters in a signal
let mut counters = use_signal(|| vec![0, 0, 0]);

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

rsx! {
Expand Down
2 changes: 1 addition & 1 deletion examples/crm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//! in a way that works across pages.
//!
//! We implement a number of important details here too, like focusing inputs, handling form submits, navigating the router,
//! platform-specific configuration, and importing 3rd party CSS libaries.
//! platform-specific configuration, and importing 3rd party CSS libraries.

use dioxus::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion examples/flat_router.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This example shows how to use the `Router` component to create a simple navigation system.
//! The more complex router example uses all of the router features, while this simple exmaple showcases
//! The more complex router example uses all of the router features, while this simple example showcases
//! just the `Layout` and `Route` features.
//!
//! Layouts let you wrap chunks of your app with a component. This is useful for things like a footers, heeaders, etc.
Expand Down
2 changes: 1 addition & 1 deletion examples/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn app() -> Element {

// On desktop/liveview, the form will not navigate the page - the expectation is that you handle
// The form event.
// Howver, if your form doesn't have a submit handler, it might navigate the page depending on the webview.
// However, if your form doesn't have a submit handler, it might navigate the page depending on the webview.
// We suggest always attaching a submit handler to the form.
onsubmit: move |ev| {
println!("Submit event: {:#?}", ev);
Expand Down
2 changes: 1 addition & 1 deletion examples/future.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! A simple example that shows how to use the use_future hook to run a background task.
//!
//! use_future won't return a value, analagous to use_effect.
//! use_future won't return a value, analogous to use_effect.
//! If you want to return a value from a future, use use_resource instead.

use dioxus::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion examples/multiwindow.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Multiwindow example
//!
//! This exmaple shows how to implement a simple multiwindow application using dioxus.
//! This example shows how to implement a simple multiwindow application using dioxus.
//! This works by spawning a new window when the user clicks a button. We have to build a new virtualdom which has its
//! own context, root elements, etc.

Expand Down
2 changes: 1 addition & 1 deletion examples/openid_connect_demo/Dioxus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# dioxus project name
name = "OpenID Connect authentication demo"

# default platfrom
# default platform
# you can also use `dioxus serve/build --platform XXX` to use other platform
# value: web | desktop
default_platform = "web"
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fn app() -> Element {
e: "asd".to_string(),
}

// `b` and `e` are ommitted
// `b` and `e` are omitted
Button {
a: "asd".to_string(),
c: "asd".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion examples/rsx_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ mod baller {
}
}

/// Documention for this component is visible within the rsx macro
/// Documentation for this component is visible within the rsx macro
#[component]
pub fn Taller(
/// Fields are documented and accessible in rsx!
Expand Down
2 changes: 1 addition & 1 deletion examples/signals.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! A simple example demonstrating how to use signals to modify state from several different places.
//!
//! This simlpe example implements a counter that can be incremented, decremented, and paused. It also demonstrates
//! This simple example implements a counter that can be incremented, decremented, and paused. It also demonstrates
//! that background tasks in use_futures can modify the value as well.
//!
//! Most signals implement Into<ReadOnlySignal<T>>, making ReadOnlySignal a good default type when building new
Expand Down
4 changes: 2 additions & 2 deletions examples/web_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ fn app() -> Element {
rsx! {
div {
h1 { "Web Components" }
CoolWebComponet { my_prop: "Hello, world!".to_string() }
CoolWebComponent { my_prop: "Hello, world!".to_string() }
}
}
}

/// A web-component wrapped with a strongly typed interface using a component
#[component]
fn CoolWebComponet(my_prop: String) -> Element {
fn CoolWebComponent(my_prop: String) -> Element {
rsx! {
// rsx! takes a webcomponent as long as its tag name is separated with dashes
web-component {
Expand Down
4 changes: 2 additions & 2 deletions packages/autofmt/tests/samples/staged.rsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ rsx! {

div { "hi" }

div { class: "helo", "hi" }
div { class: "hello", "hi" }

div { class: "helo", glass: "123", "hi" }
div { class: "hello", glass: "123", "hi" }

div { {some_expr} }
div {
Expand Down
2 changes: 1 addition & 1 deletion packages/autofmt/tests/wrong/multiexpr-4sp.rsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn ItWroks() {
fn ItWorks() {
rsx! {
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
{left}
Expand Down
2 changes: 1 addition & 1 deletion packages/autofmt/tests/wrong/multiexpr-4sp.wrong.rsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn ItWroks() {
fn ItWorks() {
rsx! {
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light", {left}, {right} }
}
Expand Down
2 changes: 1 addition & 1 deletion packages/autofmt/tests/wrong/multiexpr-tab.rsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn ItWroks() {
fn ItWorks() {
rsx! {
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
{left}
Expand Down
2 changes: 1 addition & 1 deletion packages/autofmt/tests/wrong/multiexpr-tab.wrong.rsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn ItWroks() {
fn ItWorks() {
rsx! {
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light", {left}, {right} }
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ crossterm = { version = "0.27.0", features = ["event-stream"] }
ansi-to-tui = "=5.0.0-rc.1"
ansi-to-html = "0.2.1"

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

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/assets/dioxus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# dioxus project name
name = "{{project-name}}"

# default platfrom
# default platform
# you can also use `dx serve/build --platform XXX` to use other platform
# value: web | desktop
default_platform = "{{default-platform}}"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cli/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl LinkCommand {
return Ok(());
};

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

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;

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

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mod test {
.unwrap();
});

// Expose *just* the fileystem web server's address
// Expose *just* the filesystem web server's address
server_handle_handle.listening().await.unwrap().to_string()
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ fn no_cache(
let mut response = response.into_response();

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

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/serve/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl Watcher {
}

/// Ensure the changes we've received from the queue are actually legit changes to either assets or
/// rust code. We don't care about changes otherwise, unless we get a signle elsewhere to do a full rebuild
/// rust code. We don't care about changes otherwise, unless we get a signal elsewhere to do a full rebuild
pub fn pending_changes(&mut self) -> bool {
!self.queued_events.is_empty()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl Tool {
"windows" => tool_path.join(&dir_name).join(self.name()).join(".exe"),
_ => tool_path.join(&dir_name).join(self.name()),
};
// Manualy creating tool directory because we directly download the binary via Github
// Manually creating tool directory because we directly download the binary via Github
std::fs::create_dir(tool_path.join(dir_name))?;

let mut final_file = std::fs::File::create(&bin_path)?;
Expand Down
2 changes: 1 addition & 1 deletion packages/core-macro/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl ToTokens for ComponentBody {
// No props declared, so we don't need to generate a props struct
true => quote! {},

// Props declared, so we generate a props struct and thatn also attach the doc attributes to it
// Props declared, so we generate a props struct and then also attach the doc attributes to it
false => {
let doc = format!("Properties for the [`{}`] component.", &comp_fn.sig.ident);
let props_struct = self.props_struct();
Expand Down
2 changes: 1 addition & 1 deletion packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ If you are just starting, check out the Guides first.

## Understanding the implementation

`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.
`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.

The important abstractions to understand are:

Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,25 @@ impl VirtualDom {
}

impl ElementPath {
pub(crate) fn is_decendant(&self, small: &[u8]) -> bool {
pub(crate) fn is_descendant(&self, small: &[u8]) -> bool {
small.len() <= self.path.len() && small == &self.path[..small.len()]
}
}

#[test]
fn is_decendant() {
fn is_descendant() {
let event_path = ElementPath {
path: &[1, 2, 3, 4, 5],
};

assert!(event_path.is_decendant(&[1, 2, 3, 4, 5]));
assert!(event_path.is_decendant(&[1, 2, 3, 4]));
assert!(event_path.is_decendant(&[1, 2, 3]));
assert!(event_path.is_decendant(&[1, 2]));
assert!(event_path.is_decendant(&[1]));
assert!(event_path.is_descendant(&[1, 2, 3, 4, 5]));
assert!(event_path.is_descendant(&[1, 2, 3, 4]));
assert!(event_path.is_descendant(&[1, 2, 3]));
assert!(event_path.is_descendant(&[1, 2]));
assert!(event_path.is_descendant(&[1]));

assert!(!event_path.is_decendant(&[1, 2, 3, 4, 5, 6]));
assert!(!event_path.is_decendant(&[2, 3, 4]));
assert!(!event_path.is_descendant(&[1, 2, 3, 4, 5, 6]));
assert!(!event_path.is_descendant(&[2, 3, 4]));
}

impl PartialEq<&[u8]> for ElementPath {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/mutations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ impl Mutations {
/// Rewrites IDs to just be "template", so you can compare the mutations
///
/// Used really only for testing
pub fn santize(mut self) -> Self {
pub fn sanitize(mut self) -> Self {
for edit in self.edits.iter_mut() {
if let Mutation::LoadTemplate { name, .. } = edit {
*name = "template"
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl Drop for VNode {
// FIXME:
// TODO:
//
// We have to add this drop *here* becase we can't add a drop impl to AttributeValue and
// We have to add this drop *here* because we can't add a drop impl to AttributeValue and
// keep semver compatibility. Adding a drop impl means you can't destructure the value, which
// we need to do for enums.
//
Expand Down Expand Up @@ -546,7 +546,7 @@ impl TemplateNode {

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

#[cfg(debug_assertions)]
pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
let mut with_indecies = paths.iter().copied().enumerate().collect::<Vec<_>>();
with_indecies.sort_by(|(_, a), (_, b)| {
let mut with_indices = paths.iter().copied().enumerate().collect::<Vec<_>>();
with_indices.sort_by(|(_, a), (_, b)| {
let mut a = a.iter();
let mut b = b.iter();
loop {
Expand All @@ -1163,7 +1163,7 @@ pub(crate) fn sort_bfo(paths: &[&'static [u8]]) -> Vec<(usize, &'static [u8])> {
}
}
});
with_indecies
with_indices
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/reactive_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl ReactiveContext {
/// # use futures_util::StreamExt;
/// fn use_simplified_memo(mut closure: impl FnMut() -> i32 + 'static) -> Signal<i32> {
/// use_hook(|| {
/// // Create a new reactive context and channel that will recieve a value every time a value the reactive context subscribes to changes
/// // Create a new reactive context and channel that will receive a value every time a value the reactive context subscribes to changes
/// let (reactive_context, mut changed) = ReactiveContext::new();
/// // Compute the value of the memo inside the reactive context. This will subscribe the reactive context to any values you read inside the closure
/// let value = reactive_context.reset_and_run_in(&mut closure);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/scopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{cell::Ref, rc::Rc};

/// A component's unique identifier.
///
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unqiue across
/// `ScopeId` is a `usize` that acts a key for the internal slab of Scopes. This means that the key is not unique across
/// time. We do try and guarantee that between calls to `wait_for_work`, no ScopeIds will be recycled in order to give
/// time for any logic that relies on these IDs to properly update.
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/virtual_dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ impl VirtualDom {

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

// Break if this is the exact target element.
Expand Down
Loading
Loading