Skip to content

Commit

Permalink
feat: add typos to GitHub action
Browse files Browse the repository at this point in the history
Signed-off-by: Zhizhen He <[email protected]>
  • Loading branch information
hezhizhen authored and logseq-cldwalker committed Feb 21, 2023
1 parent f6d4560 commit 25c1505
Show file tree
Hide file tree
Showing 44 changed files with 146 additions and 123 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ env:
BABASHKA_VERSION: '1.0.168'

jobs:
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Check spelling with custom config file
uses: crate-ci/[email protected]
with:
config: ./typos.toml

test:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# NOTE: please keep it in sync with .github pipelines
# NOTE: during testing make sure to change the branch below
# NOTE: before runing the build-docker GH action edit
# NOTE: before running the build-docker GH action edit
# build-docker.yml and change the release channel from :latest to :testing

# Builder image
Expand Down
2 changes: 1 addition & 1 deletion deps/db/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bb lint:rules
The package.json dependencies are just for testing and should be updated if there is
new behavior to test.

The deps.edn dependecies are used by both ClojureScript and nbb-logseq. Their
The deps.edn dependencies are used by both ClojureScript and nbb-logseq. Their
versions should be backwards compatible with each other with priority given to
the frontend. _No new dependency_ should be introduced to this library without
an understanding of the tradeoffs of adding this to nbb-logseq.
4 changes: 2 additions & 2 deletions deps/db/src/logseq/db/rules.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
;; https://docs.datomic.com/on-prem/query/query-executing.html#clause-order
;; Recursive optimization Reference:
;; https://stackoverflow.com/questions/42457136/recursive-datalog-queries-for-datomic-really-slow
;; Should optimize for query the decendents of a block
;; Should optimize for query the descendents of a block
;; Quote:
;; My theory is that your rules are not written in a way that Datalog can optimize for this read pattern - probably resulting in a traversal of all the entities. I suggest to rewrite them as follows:
;; [[(ubersymbol ?c ?p)
Expand Down Expand Up @@ -62,7 +62,7 @@

(def ^:large-vars/data-var query-dsl-rules
"Rules used by frontend.db.query-dsl. The symbols ?b and ?p respectively refer
to block and page. Do not alter them as they are programatically built by the
to block and page. Do not alter them as they are programmatically built by the
query-dsl ns"
{:page-property
'[(page-property ?p ?key ?val)
Expand Down
2 changes: 1 addition & 1 deletion deps/graph-parser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ yarn test
The package.json dependencies are just for testing and should be updated if there is
new behavior to test.

The deps.edn dependecies are used by both ClojureScript and nbb-logseq. Their
The deps.edn dependencies are used by both ClojureScript and nbb-logseq. Their
versions should be backwards compatible with each other with priority given to
the frontend. _No new dependency_ should be introduced to this library without
an understanding of the tradeoffs of adding this to nbb-logseq.
2 changes: 1 addition & 1 deletion deps/graph-parser/src/logseq/graph_parser/util.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
(keyword format)))

(defn path->file-name
;; Only for interal paths, as they are converted to POXIS already
;; Only for internal paths, as they are converted to POXIS already
;; https://github.com/logseq/logseq/blob/48b8e54e0fdd8fbd2c5d25b7f1912efef8814714/deps/graph-parser/src/logseq/graph_parser/extract.cljc#L32
;; Should be converted to POXIS first for external paths
[path]
Expand Down
2 changes: 1 addition & 1 deletion docs/accessibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- We can also provide alternative options in order to conform with AAA standards. For instance, our default themes can aim for AA, but we can provide a high-contrast theme that aims for AAA. Providing [alternative versions](https://www.w3.org/WAI/GL/2007/05/alternate-versions.html) with different levels of conformance is permitted according to WCAG, if there is an accessible way to reach those alternatives.
- ## Simple development guidelines
- Use semantically correct markup whenever possible. Every time you are about to decide which html tag you are going to use, choose the one that behaves the way you want it. For example, let's say you want to create an element that looks like plain text, but triggers an action on click. Usually, the best approach would be to create a `<button>` and make it look like a `<span>` using css. If you use a `span`, you will also have to override other html attributes like `tabindex` and `role` to make the element behave like a button. This is almost always a bad sign, and should be avoided. If you use the appropriate html element, the browser will be able to properly handle it.
- Do not skip headings. People who use screen readers and a keyboard to navigate through the app, use the headings structure to quickly jump to areas of interest. Skipping headings to visually conform with the design, makes this hard for them. If you want to create a heading tha looks like an `<h4>` but is in terms of document structure an `<h2>`, use the latter and make it look like an `<h4>`.
- Do not skip headings. People who use screen readers and a keyboard to navigate through the app, use the headings structure to quickly jump to areas of interest. Skipping headings to visually conform with the design, makes this hard for them. If you want to create a heading that looks like an `<h4>` but is in terms of document structure an `<h2>`, use the latter and make it look like an `<h4>`.
- A more [in-depth guide about HTML and accessibility](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML).
- ## Advanced concepts
- Focus management is extremely important for [keyboard navigation](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Keyboard). Focusable elements can help people with motor disabilities navigate. [Focus Order](https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-focus-order.html) plays an important role in this.
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ test('template', async ({ page, block }) => {
test('auto completion square brackets', async ({ page, block }) => {
await createRandomPage(page)

// In this test, `type` is unsed instead of `fill`, to allow for auto-completion.
// In this test, `type` is unused instead of `fill`, to allow for auto-completion.

// [[]]
await block.mustType('This is a [', { toBe: 'This is a []' })
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/code-editing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test('switch code editing mode', async ({ page }) => {
await page.waitForTimeout(200) // editor unloading
await page.press('.block-editor textarea', 'Escape')
await page.waitForTimeout(200) // editor loading
// click position is estimated to be at the begining of the first line
// click position is estimated to be at the beginning of the first line
await page.click('.CodeMirror pre', { position: { x: 1, y: 5 } })
await page.waitForTimeout(200)

Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test('create new page from bracketing text #4971', async ({ page, block }) => {
test.skip('backspace and cursor position #4897', async ({ page, block }) => {
await createRandomPage(page)

// Delete to previous block, and check cursor postion, with markup
// Delete to previous block, and check cursor position, with markup
await block.mustFill('`012345`')
await block.enterNext()
await block.mustType('`abcdef', { toBe: '`abcdef`' }) // "`" auto-completes
Expand All @@ -111,7 +111,7 @@ test.skip('backspace and cursor position #4897', async ({ page, block }) => {
test.skip('next block and cursor position', async ({ page, block }) => {
await createRandomPage(page)

// Press Enter and check cursor postion, with markup
// Press Enter and check cursor position, with markup
await block.mustType('abcde`12345', { toBe: 'abcde`12345`' }) // "`" auto-completes
for (let i = 0; i < 7; i++) {
await page.keyboard.press('ArrowLeft')
Expand All @@ -131,7 +131,7 @@ test(
// cases should trigger [[]] #3251
async ({ page, block }) => {
// This test requires dev mode
test.skip(process.env.RELEASE === 'true', 'not avaliable for release version')
test.skip(process.env.RELEASE === 'true', 'not available for release version')

for (let [idx, events] of [
kb_events.win10_pinyin_left_full_square_bracket,
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const test = base.extend<LogseqFixtures>({
},
activeEditing: async (nth: number): Promise<void> => {
await page.waitForSelector(`.ls-block >> nth=${nth}`, { timeout: 1000 })
// scroll, for isVisble test
// scroll, for isVisible test
await page.$eval(`.ls-block >> nth=${nth}`, (element) => {
element.scrollIntoView();
});
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/logseq-url.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test("Logseq URLs (same graph)", async ({ page, block }) => {
let page_title = await createRandomPage(page)
await block.mustFill(identify_text)

// paste current page's URL to another page, then redirect throught the URL
// paste current page's URL to another page, then redirect through the URL
await page.click('.ui__dropdown-trigger .toolbar-dots-btn')
await page.locator("text=Copy page URL").click()
await createRandomPage(page)
Expand All @@ -26,7 +26,7 @@ test("Logseq URLs (same graph)", async ({ page, block }) => {
expect(await cursor_locator.inputValue()).toBe(identify_text)
}

// paste the identify block's URL to another page, then redirect throught the URL
// paste the identify block's URL to another page, then redirect through the URL
await page.click('span.bullet >> nth=0', { button: "right" })
await page.locator("text=Copy block URL").click()
await createRandomPage(page)
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/page-search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IsMac, createRandomPage, newBlock, newInnerBlock, randomString, lastBlo

/***
* Test alias features
* Test search refering features
* Test search referring features
* Consider diacritics
***/

Expand Down Expand Up @@ -101,7 +101,7 @@ async function alias_test( block: Block, page: Page, page_name: string, search_k
// the target page will contains the content in
// alias_test_content_1,
// alias_test_content_2, and
// alias_test_content_3 sequentialy, to validate the target page state
// alias_test_content_3 sequentially, to validate the target page state
await page.type('textarea >> nth=0', 'alias:: [[' + alias_name, {delay: 10})
await page.keyboard.press('Enter', {delay: 200}) // Enter for finishing selection
await page.keyboard.press('Enter', {delay: 200}) // double Enter for exit property editing
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/random.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ test.skip('Random editor operations', async ({ page, block }) => {
await page.keyboard.press('Backspace', { delay: 50 })
}
} else if (op === "delete") {
// move text-cursor to begining
// move text-cursor to beginning
// then press delete
// then move text-cursor to the end
await block.activeEditing(target)
Expand Down
10 changes: 5 additions & 5 deletions ios/App/App/FsWatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class FsWatcher: CAPPlugin, PollingWatcherDelegate {
call.resolve()
}

public func recevedNotification(_ url: URL, _ event: PollingWatcherEvent, _ metadata: SimpleFileMetadata?) {
public func receivedNotification(_ url: URL, _ event: PollingWatcherEvent, _ metadata: SimpleFileMetadata?) {
// NOTE: Event in js {dir path content stat{mtime}}
switch event {
case .Unlink:
Expand Down Expand Up @@ -112,7 +112,7 @@ extension URL {
// MARK: PollingWatcher

public protocol PollingWatcherDelegate {
func recevedNotification(_ url: URL, _ event: PollingWatcherEvent, _ metadata: SimpleFileMetadata?)
func receivedNotification(_ url: URL, _ event: PollingWatcherEvent, _ metadata: SimpleFileMetadata?)
}

public enum PollingWatcherEvent {
Expand Down Expand Up @@ -253,14 +253,14 @@ public class PollingWatcher {
if let idx = self.metaDb.index(forKey: url) {
let (_, oldMeta) = self.metaDb.remove(at: idx)
if oldMeta != meta {
self.delegate?.recevedNotification(url, .Change, meta)
self.delegate?.receivedNotification(url, .Change, meta)
}
} else {
self.delegate?.recevedNotification(url, .Add, meta)
self.delegate?.receivedNotification(url, .Add, meta)
}
}
for url in self.metaDb.keys {
self.delegate?.recevedNotification(url, .Unlink, nil)
self.delegate?.receivedNotification(url, .Unlink, nil)
}
self.metaDb = newMetaDb
}
Expand Down
2 changes: 1 addition & 1 deletion libs/src/LSPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export interface IAppProxy {
) => Promise<void>

/**
* Call external plugin command provided by models or registerd commands
* Call external plugin command provided by models or registered commands
* @added 0.0.13
* @param type `xx-plugin-id.commands.xx-key`, `xx-plugin-id.models.xx-key`
* @param args
Expand Down
2 changes: 1 addition & 1 deletion scripts/src/logseq/tasks/file_sync.clj
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
\"dir\": \"/Users/me/Documents/untitled folder 31\"}
```
* you alse need to open logseq-app(or yarn electron-watch),
* you also need to open logseq-app(or yarn electron-watch),
and open <dir> and start file-sync"
[& _args]
(setup-vars)
Expand Down
2 changes: 1 addition & 1 deletion src/electron/electron/context_menu.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
["electron" :refer [Menu MenuItem shell nativeImage clipboard] :as electron]
["electron-dl" :refer [download]]))

;; context menu is registerd in window/setup-window-listeners!
;; context menu is registered in window/setup-window-listeners!
(defn setup-context-menu!
[^js win]
(let [web-contents (.-webContents win)
Expand Down
8 changes: 4 additions & 4 deletions src/electron/electron/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@

(defn- setup-deeplink! []
;; Works for Deeplink v1.0.9
;; :mainWindow is only used for handeling window restoring on second-instance,
;; :mainWindow is only used for handling window restoring on second-instance,
;; But we already handle window restoring without deeplink.
;; https://github.com/glawson/electron-deeplink/blob/73d58edcde3d0e80b1819cd68a0c6e837a9c9258/src/index.ts#L150-L155
(-> (Deeplink. #js
Expand Down Expand Up @@ -290,7 +290,7 @@
(win/switch-to-window! window))))

(.on app "window-all-closed" (fn []
(logger/debug "window-all-closed" "Quiting...")
(logger/debug "window-all-closed" "Quitting...")
(try
(fs-watcher/close-watcher!)
(search/close!)
Expand Down Expand Up @@ -342,7 +342,7 @@
(let [_ (async/<! state/persistent-dbs-chan)]
(if (or @win/*quitting? (not mac?))
;; MacOS: only cmd+q quitting will trigger actual closing
;; otherwise, it's just hiding - don't do any actuall closing in that case
;; otherwise, it's just hiding - don't do any actual closing in that case
;; except saving transit
(when-let [win @*win]
(when-let [dir (state/get-window-graph-path win)]
Expand All @@ -351,7 +351,7 @@
(win/destroy-window! win)
;; FIXME: what happens when closing main window on Windows?
(reset! *win nil))
;; Just hiding - don't do any actuall closing operation
;; Just hiding - don't do any actual closing operation
(do (.preventDefault ^js/Event e)
(if (and mac? (.isFullScreen win))
(do (.once win "leave-full-screen" #(.hide win))
Expand Down
38 changes: 19 additions & 19 deletions src/electron/electron/search.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@

(defn open-db!
[db-name]
(let [[db-sanitized-name db-full-path] (get-db-full-path db-name)]
(try (let [db (sqlite3 db-full-path nil)]
(create-blocks-table! db)
(create-blocks-fts-table! db)
(create-pages-table! db)
(create-pages-fts-table! db)
(add-blocks-fts-triggers! db)
(add-pages-fts-triggers! db)
(swap! databases assoc db-sanitized-name db))
(catch :default e
(logger/error (str e ": " db-name))
(fs/unlinkSync db-full-path)))))
(let [[db-sanitized-name db-full-path] (get-db-full-path db-name)]
(try (let [db (sqlite3 db-full-path nil)]
(create-blocks-table! db)
(create-blocks-fts-table! db)
(create-pages-table! db)
(create-pages-fts-table! db)
(add-blocks-fts-triggers! db)
(add-pages-fts-triggers! db)
(swap! databases assoc db-sanitized-name db))
(catch :default e
(logger/error (str e ": " db-name))
(fs/unlinkSync db-full-path)))))

(defn open-dbs!
[]
Expand Down Expand Up @@ -246,7 +246,7 @@
(medley/distinct-by f (seq col)))

(defn search-blocks
":page - the page to specificly search on"
":page - the page to specifically search on"
[repo q {:keys [limit page]}]
(when-let [database (get-db repo)]
(when-not (string/blank? q)
Expand All @@ -263,9 +263,9 @@
" content like ? limit ?")
matched-result (->>
(map
(fn [match-input]
(search-blocks-aux database match-sql match-input page limit))
match-inputs)
(fn [match-input]
(search-blocks-aux database match-sql match-input page limit))
match-inputs)
(apply concat))]
(->>
(concat matched-result
Expand Down Expand Up @@ -328,9 +328,9 @@
" content like ? limit ?")
matched-result (->>
(map
(fn [match-input]
(search-pages-aux database match-sql match-input limit))
match-inputs)
(fn [match-input]
(search-pages-aux database match-sql match-input limit))
match-inputs)
(apply concat))]
(->>
(concat matched-result
Expand Down
4 changes: 2 additions & 2 deletions src/electron/electron/url.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
(graph-identifier-error-handler graph-identifier))))

(defn- x-callback-url-handler
"win - a window used for fallback (main window is prefered)"
"win - a window used for fallback (main window is preferred)"
[^js win ^js/URL parsed-url]
(let [action (.-pathname parsed-url)]
(cond
;; url: (string) Page url
;; title: (stirng) Page title
;; title: (string) Page title
;; content: (string) Highlighted text
;; page: (string) Page name to insert to, use "TODAY" to insert to today page
;; append: (bool) Append to the end of the page, default to false(current editing position)
Expand Down
6 changes: 3 additions & 3 deletions src/main/frontend/components/block.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@
(pdf-utils/fix-local-asset-pagename page-name)

(not= (util/safe-page-name-sanity-lc original-name) page-name-in-block)
page-name-in-block ;; page-name-in-block might be overrided (legacy))
page-name-in-block ;; page-name-in-block might be overridden (legacy))

:else
(util/trim-safe page-name))
Expand Down Expand Up @@ -1899,7 +1899,7 @@
priority (priority-cp t)
tags (block-tags-cp t)
bg-color (:background-color properties)
;; `heading-level` is for backward compatiblity, will remove it in later releases
;; `heading-level` is for backward compatibility, will remove it in later releases
heading-level (:block/heading-level t)
heading (or
(and heading-level
Expand Down Expand Up @@ -2991,7 +2991,7 @@
[log]
(let [clocks (filter #(string/starts-with? % "CLOCK:") log)
clocks (reverse (sort-by str clocks))
;; TODO: diplay states change log
;; TODO: display states change log
; states (filter #(not (string/starts-with? % "CLOCK:")) log)
]
(when (seq clocks)
Expand Down
Loading

0 comments on commit 25c1505

Please sign in to comment.