Skip to content

chore(lint): Rule adjustments and fix warnings #19718

Description

@github-actions

Note

The pull request "chore(lint): Rule adjustments and fix warnings" was created by @logaretm but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.

This is a follow up PR that cleans up our configuration and reverts the downgrade to warning for some of the rules we use. This brings us to a similar level of coverage with eslint.

Some rules have sensitivity issue, especially when it comes to optional chaining and types so we will still have a lot of warnings.

Summary of Changes

Config changes (.oxlintrc.json)

Globally disabled (TS files)

Rule Why
no-redundant-type-constituents Many violations are intentional — AI integration types use 'literal' | string for autocomplete hints, and unknown | X patterns are common throughout the codebase. Low bug-catching value.
restrict-template-expressions 81 violations mostly from OTel span attributes and unknown values in template strings. Would require String() wrappers everywhere for minimal safety gain — the SDK handles these at runtime.
await-thenable await on non-Promises is valid JS — it's a useful pattern for uniformly handling T | Promise<T> without branching. Not a bug.
no-base-to-string Set to warn (not off). Kept visible since [object Object] in strings is a real issue, but not blocking CI while we clean up the 22 remaining source violations.

Disabled in tests + dev-packages only

Rule Why
no-misused-spread Tests intentionally spread class instances to create plain fixture objects.
require-array-sort-compare Test assertions sorting string arrays — .sort() without comparator is fine for strings.
no-base-to-string Tests don't need strict toString safety.

Configured

Rule Why
no-unused-vars Set to warn with _ prefix ignore patterns (argsIgnorePattern, varsIgnorePattern, caughtErrorsIgnorePattern). Standard convention — unused catch params/args prefixed with _ are intentional.

Dev-packages config (dev-packages/.oxlintrc.json)

Added require-array-sort-compare, no-misused-spread, and no-base-to-string as off — these rules aren't worth enforcing in test infrastructure.

Code fixes

Change Count What
Removed | undefined from optional params 19 param?: T | undefinedparam?: T — the ? already implies undefined
Prefixed unused catch params with _ 25 catch (error)catch (_error) — follows the _ convention for intentionally unused variables
Prefixed unused callback param 1 (error, version)(error, _version) in bun/scripts/install-bun.js

Result

373 warnings → 31 (22 of which are the intentional no-base-to-string warnings we kept visible).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions