Skip to content

Fix code quality issues: sentence case, promise handling, deprecated functions, settings headings#9

Merged
nilsandrey merged 6 commits intomainfrom
copilot/fix-code-quality-issues
Mar 9, 2026
Merged

Fix code quality issues: sentence case, promise handling, deprecated functions, settings headings#9
nilsandrey merged 6 commits intomainfrom
copilot/fix-code-quality-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 9, 2026

  • Explore the codebase and run ESLint to identify all issues
  • Fix orphaned ; in settings-tab.ts (replaced with heading, then removed redundant plugin-name heading)
  • Fix sentence case: "Join every N lines""Join every n lines" in main.ts
  • Fix Promise-returning function in void context (main.ts L341) - updated InputModal.onSubmit type to unknown
  • Fix unawaited promise: this.saveSettings()void this.saveSettings().catch(...) (main.ts L799)
  • Fix deprecated unescape/escape in encode.ts (replaced with TextEncoder/TextDecoder)
  • Remove unused vi import in lines.test.ts
  • Update ESLint config to allow proper acronyms/brands (UTC, ISO, Unix, GUIDs)
  • Fix no-undef for btoa/atob in ESLint config (added browser globals)
  • Fix unsafe assignment in main.ts L847 and encode.ts
  • Fix floating promises in InputModal at call sites (submitAndCatch helper with rejection logging)
  • Remove eslint-plugin-obsidian (wrong package), fix ESLint → 9.x and @eslint/json → 0.14.0 to match plugin peer deps; regenerate package-lock.json so npm ci works
  • Fix "N (lines per group)" label → "Number of lines per group" and notice to "Enter a positive integer."
  • Use { fatal: true } in TextDecoder for base64Decode to preserve fallback behavior on invalid UTF-8
  • Verify all ESLint checks pass (0 errors)
  • Verify all 135 tests pass
  • Verify build succeeds
  • Verify npm ci succeeds
Original prompt

This section details on the original issue you should resolve

<issue_title>Issues detected in code quality </issue_title>
<issue_description>A scan of the plugin code's revealed the following issues:

Required

[1][2][3][4][5][6]
Use sentence case for UI text.
[1]
Promise-returning function provided to property where a void return was expected.

[1]
Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the void operator.
[1][2][3][4][5]

For a consistent UI use new Setting(containerEl).setName(...).setHeading() instead of creating HTML heading elements directly.

[1]
unescape is deprecated. A legacy feature for browser compatibility

[1]
escape is deprecated. A legacy feature for browser compatibility

Optional

[1]
'vi' is defined but never used.


To run these checks locally, install the eslint plugin in the project. Run and fix before commiting changes.</issue_description>

<agent_instructions>Fix and check before committing all the problems redacted in the issue.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 9, 2026 01:21
Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues detected in code quality Fix code quality issues: sentence case, promise handling, deprecated functions, settings headings Mar 9, 2026
@nilsandrey nilsandrey marked this pull request as ready for review March 9, 2026 01:38
Copilot AI review requested due to automatic review settings March 9, 2026 01:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses ESLint and API deprecation findings in the Obsidian Text Tools plugin by adjusting UI text, improving promise/lint safety, modernizing Base64 encoding/decoding, and aligning settings UI structure with Obsidian’s Setting heading API.

Changes:

  • Modernize Base64 encode/decode to use TextEncoder/TextDecoder and tighten some type annotations.
  • Update UI strings for sentence case and refactor settings headings to use Setting(...).setHeading().
  • Improve promise-handling lint compliance (async onSubmit support, explicit ignored promises) and add ESLint flat config + dependencies.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
main.ts Sentence-case updates, promise handling change for settings persistence, and safer typing around settings loading.
src/modals/InputModal.ts Broadens onSubmit typing to allow async callbacks and marks returned promises as intentionally ignored.
src/settings-tab.ts Switches settings section headings to Obsidian’s Setting(...).setHeading() pattern and tweaks descriptions.
src/transforms/encode.ts Replaces deprecated escape/unescape Base64 shim with TextEncoder/TextDecoder; minor type-safety improvements.
src/transforms/lines.test.ts Removes unused vi import.
eslint.config.mjs Adds ESLint flat config using eslint-plugin-obsidianmd with sentence-case rule customization.
package.json Adds ESLint-related dev dependencies to support the new lint configuration.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Nils <nilsandrey@gmail.com>
nilsandrey and others added 2 commits March 8, 2026 19:50
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Nils <nilsandrey@gmail.com>
…ync onSubmit errors

Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
@nilsandrey nilsandrey merged commit a88def2 into main Mar 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues detected in code quality

3 participants