diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index 37a6fde760b..9f23aebe6bd 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -18,9 +18,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check spelling - run: | - sudo apt-get install aspell - ci/spellcheck.sh list + uses: crate-ci/typos@v1.39.2 doc_tests: name: Documentation Tests diff --git a/ci/dictionary.txt b/ci/dictionary.txt deleted file mode 100644 index 122baa08a1b..00000000000 --- a/ci/dictionary.txt +++ /dev/null @@ -1,86 +0,0 @@ -personal_ws-1.1 en 0 utf-8 -alloc -ALLOC -allocator -analagous -Angular's -asmjs -binaryen -Binaryen -bindgen -bool -boolean -cdylib -charset -codebase -codegen -Component -composable -Config -declaratively -defs -deps -DerefMut -DOCTYPE -DOCUSAURUS -emscripten -Emscripten -enum -enums -emmet -Github -href -html -Html -IDEA -IHtmlElement -includeLanguages -IntelliJ -intellij-rust -impl -init -INIT -interop -interoperate -json -lifecycle -Lifecycle -linecap -linejoin -memoized -MSRV -natively -onclick -proc -React's -README -rlib -roadmap -Roadmap -rollup -rustc -rustup -stateful -stdweb -struct -structs -tbody -textarea -thead -TODO -toml -toolchain -Unselected -usize -VecDeque -Vuetify -wasm -Wasm -webpack -Webpack -WeeAlloc -workspaces -xmlns -Javascript -yewtil -Yewtil diff --git a/ci/spellcheck.sh b/ci/spellcheck.sh deleted file mode 100755 index 5a9e89bf7fc..00000000000 --- a/ci/spellcheck.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash - -aspell --version - -# Taken from the Rust Book (https://github.com/rust-lang/book/) - -# Checks project Markdown files for spelling mistakes. - -# Notes: - -# This script needs dictionary file ($dict_filename) with project-specific -# valid words. If this file is missing, first invocation of a script generates -# a file of words considered typos at the moment. User should remove real typos -# from this file and leave only valid words. When script generates false -# positive after source modification, new valid word should be added -# to dictionary file. - -# Default mode of this script is interactive. Each source file is scanned for -# typos. aspell opens window, suggesting fixes for each found typo. Original -# files with errors will be backed up to files with format "filename.md.bak". - -# When running in CI, this script should be run in "list" mode (pass "list" -# as first argument). In this mode script scans all files and reports found -# errors. Exit code in this case depends on scan result: -# 1 if any errors found, -# 0 if all is clear. - -# Script skips words with length less than or equal to 3. This helps to avoid -# some false positives. - -# We can consider skipping source code in markdown files (```code```) to reduce -# rate of false positives, but then we lose ability to detect typos in code -# comments/strings etc. - -shopt -s nullglob - -dict_filename=./ci/dictionary.txt -markdown_sources=(./docs/**/*.md) -mode="check" - -# aspell repeatedly modifies the personal dictionary for some reason, -# so we should use a copy of our dictionary. -dict_path="/tmp/dictionary.txt" - -if [[ "$1" == "list" ]]; then - mode="list" -fi - -# Error if running in list (CI) mode and there isn't a dictionary file; -# creating one in CI won't do any good :( -if [[ "$mode" == "list" && ! -f "$dict_filename" ]]; then - echo "No dictionary file found! A dictionary file is required in CI!" - exit 1 -fi - -if [[ ! -f "$dict_filename" ]]; then - # Pre-check mode: generates dictionary of words aspell consider typos. - # After user validates that this file contains only valid words, we can - # look for typos using this dictionary and some default aspell dictionary. - echo "Scanning files to generate dictionary file '$dict_filename'." - echo "Please check that it doesn't contain any misspellings." - - echo "personal_ws-1.1 en 0 utf-8" >"$dict_filename" - cat "${markdown_sources[@]}" | aspell --ignore 3 --camel-case list | sort -u >>"$dict_filename" -elif [[ "$mode" == "list" ]]; then - # List (default) mode: scan all files, report errors. - declare -i retval=0 - - cp "$dict_filename" "$dict_path" - - if [ ! -f $dict_path ]; then - retval=1 - exit "$retval" - fi - - for fname in "${markdown_sources[@]}"; do - command=$(aspell --ignore 3 --camel-case --personal="$dict_path" "$mode" <"$fname") - if [[ -n "$command" ]]; then - for error in $command; do - # FIXME: find more correct way to get line number - # (ideally from aspell). Now it can make some false positives, - # because it is just a grep. - grep --with-filename --line-number --color=always "$error" "$fname" - done - retval=1 - fi - done - exit "$retval" -elif [[ "$mode" == "check" ]]; then - # Interactive mode: fix typos. - cp "$dict_filename" "$dict_path" - - if [ ! -f $dict_path ]; then - retval=1 - exit "$retval" - fi - - for fname in "${markdown_sources[@]}"; do - aspell --ignore 3 --camel-case --dont-backup --personal="$dict_path" "$mode" "$fname" - done -fi diff --git a/examples/async_clock/src/main.rs b/examples/async_clock/src/main.rs index 84ade6a82b0..7cd3a583d4b 100644 --- a/examples/async_clock/src/main.rs +++ b/examples/async_clock/src/main.rs @@ -71,7 +71,7 @@ impl Component for AsyncComponent { // In parallel we launch a background task that produces jokes to make the clock // more fun to watch. The jokes are emitted back to the component - // throught the Msg::Joke callback. + // through the Msg::Joke callback. let joke_cb = ctx.link().callback(Msg::Joke); emit_jokes(joke_cb); } diff --git a/examples/communication_child_to_parent/src/parent.rs b/examples/communication_child_to_parent/src/parent.rs index ccd179d37fe..3f95597d9e1 100644 --- a/examples/communication_child_to_parent/src/parent.rs +++ b/examples/communication_child_to_parent/src/parent.rs @@ -24,9 +24,9 @@ impl Component for Parent { fn update(&mut self, _ctx: &Context, msg: Self::Message) -> bool { match msg { - Msg::ButtonClick(childs_name) => { + Msg::ButtonClick(children_name) => { // Keep track of the name of the child that was clicked - self.last_updated = Some(childs_name); + self.last_updated = Some(children_name); // Increment the total number of clicks self.total_clicks += 1; diff --git a/examples/communication_grandchild_with_grandparent/src/grandparent.rs b/examples/communication_grandchild_with_grandparent/src/grandparent.rs index 222e5fb91fa..2f33a1907ef 100644 --- a/examples/communication_grandchild_with_grandparent/src/grandparent.rs +++ b/examples/communication_grandchild_with_grandparent/src/grandparent.rs @@ -24,11 +24,11 @@ impl Component for GrandParent { fn update(&mut self, _ctx: &Context, msg: Self::Message) -> bool { match msg { - Msg::ButtonClick(childs_name) => { + Msg::ButtonClick(children_name) => { // Update the shared state let shared_state = Rc::make_mut(&mut self.state); shared_state.total_clicks += 1; - shared_state.last_clicked = Some(childs_name); + shared_state.last_clicked = Some(children_name); true } } diff --git a/examples/communication_grandparent_to_grandchild/index.html b/examples/communication_grandparent_to_grandchild/index.html index eb397c080bb..c6d8e8c8a1f 100644 --- a/examples/communication_grandparent_to_grandchild/index.html +++ b/examples/communication_grandparent_to_grandchild/index.html @@ -2,7 +2,7 @@ - Yew • Granparent-to-GrandChild Communication + Yew • Grandparent-to-Grandchild Communication diff --git a/examples/keyed_list/README.md b/examples/keyed_list/README.md index 4f8a1932b62..c0c611e2a2e 100644 --- a/examples/keyed_list/README.md +++ b/examples/keyed_list/README.md @@ -6,7 +6,7 @@ This example consists of a list which can be manipulated in various ways. ### Notes -If you would like to view this example as a performance demonstation, run this example in `release` mode. +If you would like to view this example as a performance demonstration, run this example in `release` mode. ## Concepts diff --git a/packages/yew-macro/src/derive_props/mod.rs b/packages/yew-macro/src/derive_props/mod.rs index 017f3fd7fb2..d007d8241f4 100644 --- a/packages/yew-macro/src/derive_props/mod.rs +++ b/packages/yew-macro/src/derive_props/mod.rs @@ -30,7 +30,7 @@ pub struct DerivePropsInput { preserved_attrs: Vec, } -/// AST visitor that replaces all occurences of the keyword `Self` with `new_self` +/// AST visitor that replaces all occurrences of the keyword `Self` with `new_self` struct Normaliser<'ast> { new_self: &'ast Ident, generics: &'ast Generics, @@ -152,7 +152,7 @@ impl Parse for DerivePropsInput { } impl DerivePropsInput { - /// Replaces all occurences of `Self` in the struct with the actual name of the struct. + /// Replaces all occurrences of `Self` in the struct with the actual name of the struct. /// Must be called before tokenising the struct. pub fn normalise(&mut self) { let mut normaliser = Normaliser::new(&self.props_name, &self.generics); diff --git a/packages/yew-macro/src/function_component.rs b/packages/yew-macro/src/function_component.rs index 49d4d48de04..0b5ea99a8c0 100644 --- a/packages/yew-macro/src/function_component.rs +++ b/packages/yew-macro/src/function_component.rs @@ -253,7 +253,7 @@ impl FunctionComponent { let mut block = *block.clone(); let (impl_generics, _ty_generics, where_clause) = generics.split_for_impl(); - // We use _ctx here so if the component does not use any hooks, the usused_vars lint will + // We use _ctx here so if the component does not use any hooks, the unused_vars lint will // not be triggered. let ctx_ident = Ident::new("_ctx", Span::mixed_site()); diff --git a/packages/yew-macro/tests/html_lints/fail.rs b/packages/yew-macro/tests/html_lints/fail.rs index c37088e2ca8..f59abf43129 100644 --- a/packages/yew-macro/tests/html_lints/fail.rs +++ b/packages/yew-macro/tests/html_lints/fail.rs @@ -13,7 +13,7 @@ fn main() { let bad_img = html! { }; - let misformed_tagname = html! { + let malformed_tagname = html! {