Skip to content

feat: implement prettier and fix all issues#7385

Merged
jasonsaayman merged 6 commits intov1.xfrom
feat/improve-linting
Feb 14, 2026
Merged

feat: implement prettier and fix all issues#7385
jasonsaayman merged 6 commits intov1.xfrom
feat/improve-linting

Conversation

@jasonsaayman
Copy link
Member

@jasonsaayman jasonsaayman commented Feb 9, 2026


Summary by cubic

Implemented Prettier and stricter ESLint repo-wide, stabilized CI/test tooling, hardened the examples server against path traversal, and made utils.trim non-throwing. Also corrected a small regression introduced during the lint/format pass.

Description

  • Summary of changes

    • Added Prettier config/ignore and formatted lib, bin, examples, tests, and configs.
    • ESLint: standardized config and enforced no-unused-vars (ignores args and _-prefixed vars).
    • Safe refactors to satisfy linting; minor log/regex cleanups; HTML/MD reflows.
    • package.json: main → index.js; removed coveralls; added lint-staged; exports unchanged (CJS via dist).
    • Tooling: tweaked rollup/karma/gulp/bin scripts; stabilized test server/retry helpers; added path validation to examples server.
    • Types: index.d.cts reflowed; no API surface change.
    • Fix: addressed an incorrect earlier change from the lint pass.
  • Reasoning

    • Consistent formatting and stricter rules reduce noise and catch dead code.
    • Tooling/test fixes reduce flakiness and improve CI reliability.
    • Server hardening blocks directory traversal; non-throwing trim prevents unexpected crashes.
  • Additional context

    • No intended runtime API changes.

Docs

  • No API docs updates. Markdown/examples reflowed for consistency.

Testing

  • Updated test helpers (server, retry) and Karma runner for stability; formatting-only elsewhere.
  • No new tests added; existing tests adjusted as needed.
  • Validate:
    • CI green.
    • CJS require('axios') and ESM import in browser still resolve as before.
    • Dist output unchanged aside from formatting.

Written for commit a133ffd. Summary will update on new commits.

@jasonsaayman jasonsaayman self-assigned this Feb 9, 2026
@jasonsaayman jasonsaayman added priority::low A low priority issue commit::feat The PR is related to a feature labels Feb 9, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

4 issues found across 181 files

Confidence score: 3/5

  • There is a concrete runtime risk in lib/adapters/fetch.js: the encodeText fallback uses new Request(str), which can throw invalid URL errors when TextEncoder is missing, potentially breaking text encoding in affected environments.
  • The HTML example files include innerHTML usage and missing rel="noopener noreferrer"; these are security concerns but appear limited to examples, so overall impact is narrower.
  • Score reflects a real functional risk in a core adapter plus medium‑severity example security hygiene issues; likely fixable, but worth addressing before merging.
  • Pay close attention to lib/adapters/fetch.js, examples/get/index.html, examples/postMultipartFormData/index.html - text encoding fallback and example page security hygiene.

Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="examples/get/index.html">

<violation number="1" location="examples/get/index.html:23">
P2: Add rel="noopener noreferrer" to external links that open in a new tab to prevent window.opener security issues.</violation>
</file>

<file name="examples/postMultipartFormData/index.html">

<violation number="1" location="examples/postMultipartFormData/index.html:514">
P2: Avoid injecting server response data with innerHTML; render it as text to prevent HTML execution from echoed content.</violation>

<violation number="2" location="examples/postMultipartFormData/index.html:524">
P2: Use textContent for the error output to avoid rendering HTML from error messages or response data.</violation>
</file>

<file name="lib/adapters/fetch.js">

<violation number="1" location="lib/adapters/fetch.js:61">
P1: The fallback for `encodeText` (used when `TextEncoder` is missing) incorrectly uses `Request` instead of `Response`. `new Request(str)` treats `str` as a URL, which will either throw an invalid URL error (for plain text) or result in an empty body. `new Response(str)` correctly creates a response with `str` as the body, allowing conversion to ArrayBuffer.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jasonsaayman jasonsaayman changed the title Implement prettier and fix all issues feat: implement prettier and fix all issues Feb 9, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 7 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="lib/utils.js">

<violation number="1" location="lib/utils.js:261">
P2: Avoid throwing in trim for long strings. This introduces a breaking runtime error for legitimate large payloads (e.g., stringifySafely uses utils.trim), turning valid data into failures.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

jasonsaayman and others added 2 commits February 14, 2026 16:41
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="lib/utils.js">

<violation number="1" location="lib/utils.js:261">
P0: Duplicate `const trim` declaration causes a `SyntaxError` that will crash the module on load. The ReDoS guard removal left behind the original function signature, and a second `const trim = (str) => {` was added. Remove the duplicate line to restore a single valid declaration.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@jasonsaayman jasonsaayman merged commit ef3711d into v1.x Feb 14, 2026
11 checks passed
@jasonsaayman jasonsaayman deleted the feat/improve-linting branch February 17, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit::feat The PR is related to a feature priority::low A low priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant