Skip to content

Fix NoopProvider seatbelt lint errors - #838

Closed
roryabraham wants to merge 40 commits into
mainfrom
rory-seatbelt-noop-provider
Closed

Fix NoopProvider seatbelt lint errors#838
roryabraham wants to merge 40 commits into
mainfrom
rory-seatbelt-noop-provider

Conversation

@roryabraham

Copy link
Copy Markdown
Contributor

Details

Remove the two grandfathered eslint-seatbelt errors in NoopProvider. getItem now returns null through an overloaded helper so TypeScript accepts it as OnyxValue<TKey> without a type assertion, and the unused key is passed into that helper instead of void key. The matching eslint.seatbelt.tsv rows are deleted.

Related Issues

For #802

Linked E/App PR

Automated Tests

No new tests. This is a lint/type-only change in a no-op storage provider. Verified with npx eslint lib/storage/providers/NoopProvider.ts and npx tsc --noEmit.

Manual Tests

// TODO: The human co-author must fill out the QA tests you ran before marking this PR as "ready for review".
// Please describe what QA needs to do to validate your changes and what areas do they need to test for regressions.

Author Checklist

  • I linked the correct issue in the ### Related Issues section above
  • I linked the corresponding Expensify/App PR in the ### Linked E/App PR section above, and verified this change against it (E/App CI passed and manual testing completed)
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

roryabraham and others added 30 commits June 19, 2026 11:14
Adopt modular v4 flat config with eslint-seatbelt to grandfather
type-checked violations while removing the bespoke TypeScript plugin
setup and App-specific rulesdir overrides from the old monolithic config.

Co-authored-by: Cursor <cursoragent@cursor.com>
Base config already allows ?? and ?. in TypeScript and bans them only
in JavaScript via file-scoped rules in es6.js.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the local class-methods-use-this override now that react.js no
longer re-enables the rule disabled in style.js.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
- Drop no-restricted-syntax from tests block (browserConfig already
  sets the same 3 restrictions globally)
- Drop react/jsx-props-no-spreading: off (not enabled by any upstream
  config; was a no-op)
- Drop rulesdir/no-multiple-onyx-in-file: off (not enabled by any
  upstream config; was a no-op)
- Drop @typescript-eslint/no-require-imports: off for .native.ts
  (tsExpensifyConfig already turns it off for all *.ts/*.tsx globally)

Co-authored-by: Cursor <cursoragent@cursor.com>
Autofixes applied:
- rulesdir/prefer-at: arr[N] → arr.at(N)
- @typescript-eslint/dot-notation: obj['prop'] → obj.prop
- @typescript-eslint/non-nullable-type-assertion-style: as NonNullable<T> → !
- @typescript-eslint/no-unnecessary-type-assertion: remove redundant casts
- @typescript-eslint/prefer-nullish-coalescing: || → ?? where applicable
- jsdoc/no-types: remove JSDoc type annotations in TS files

Follow-up fixes for autofix side-effects:
- Remove GenericCollection/OnyxInput unused imports made orphaned
  by the removal of type assertions that were their only usage
- Add no-non-null-assertion seatbelt entries for the four files
  where non-nullable-type-assertion-style converted as NonNullable<T> → !
- Update seatbelt for newly surfaced unbound-method and unsafe-*
  counts in OnyxConnectionManager and OnyxCache perf-test files

Co-authored-by: Cursor <cursoragent@cursor.com>
Configure Node globals for CJS config files, disable
no-use-before-define in OnyxUtils, and relax test naming
rules for collection key object properties.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use lodash.bindall and inline noop instead of umbrella
lodash subpath imports that fail extraneous-deps.

Co-authored-by: Cursor <cursoragent@cursor.com>
Type getItem with void key usage and hoist handlers outside
the connect loop to satisfy no-loop-func.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve template expressions, nullish coalescing, non-null
assertions in lib code, unbound-method in tests, and type
cleanup across OnyxUtils, merge, and utils. Update seatbelt
to drop fixed suppressions while keeping test-only allowances.

Co-authored-by: Cursor <cursoragent@cursor.com>
…pensify-4

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	lib/OnyxConnectionManager.ts
#	lib/OnyxUtils.ts
#	tests/unit/OnyxConnectionManagerTest.ts
#	tests/unit/collectionHydrationTest.ts
#	tests/unit/onyxTest.ts
#	tests/unit/onyxUtilsTest.ts
Restore variadic noop stubs for InstanceSync, correct the circuit
breaker halfOpen state check, guard indexed key lookups, and add
lodash.bindall type declarations so prepare/build succeeds in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Remove stale seatbelt entries for dropped no-unsafe-argument rule,
restore CustomTypeOptions as an augmentable interface for test:types,
fix private property access and collection typing in tests, and restore
IDB abort mocks so write-error normalization tests propagate DOMException.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sync seatbelt counts, add perf-test prefer-at override, restore
CustomTypeOptions interface augmentation, fix typecheck issues in perf
and storage provider tests, and resolve OnyxConnectionManager seatbelt rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add seatbelt entries for new rule violations, disable dot-notation in
tests that access private APIs, and restore no-unsafe-argument budget.

Co-authored-by: Cursor <cursoragent@cursor.com>
Dot-notation is disabled for test files globally, so the per-line
directives were unused and caused lint to fail CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the local lodash.bindall module shim with the official
DefinitelyTyped package now that imports use lodash.bindall directly.

Co-authored-by: Cursor <cursoragent@cursor.com>
Drop dot-notation and prefer-at disables for tests; use typed test
harnesses for private member access, getAtIndex for array indexing, and
restore useLiveRef deprecation with seatbelt-documented exceptions.

Co-authored-by: Cursor <cursoragent@cursor.com>
Use unknown intermediate casts and ConnectOptions for
generateConnectionID so test harness types match the real API.

Co-authored-by: Cursor <cursoragent@cursor.com>
Fix lint CI prettier diff check after typecheck harness changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
The shared typescript config does not lint typeProperty, so the
snake_case exception had no effect. Document why the tests override
must repeat the base naming-convention rules.

Co-authored-by: Cursor <cursoragent@cursor.com>
Grandfather snake_case type properties (record_key, page_size, page_count)
that mirror SQLite column and PRAGMA result names after the
eslint-config-expensify 4 upgrade started linting typeProperty names.

Co-authored-by: Cursor <cursoragent@cursor.com>
Record<string, unknown> excluded interface-based CustomTypeOptions
values from deep nullish mapping, breaking partial nested Onyx.merge
updates. Revert to the object constraint (arrays/builtins still
excluded via NonTransformableTypes) and add a compile-time regression
test for interface-shaped settings updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
Wrap JSON.stringify in a try/fallback path so circular objects,
BigInt, functions, and symbols no longer throw during error
normalization before classifyError can run.

Co-authored-by: Cursor <cursoragent@cursor.com>
Call helper functions directly in setWithRetry, multiSetWithRetry, and
setCollectionWithRetry instead of referencing the OnyxUtils export before
it is defined. Move logKeyChanged and logKeyRemoved above their first use.

Co-authored-by: Cursor <cursoragent@cursor.com>
Forward-declare the OnyxUtils export and route retry helpers through it
so jest.spyOn(OnyxUtils, 'retryOperation' | 'getMergeQueue' | ...) still
intercepts internal calls without needing no-use-before-define off.

Co-authored-by: Cursor <cursoragent@cursor.com>
Retry helpers call sibling functions directly — all are already defined
above them in the file. Update tests to count Storage.setItem attempts
and seed the real merge queue instead of spying on the export object.

Co-authored-by: Cursor <cursoragent@cursor.com>
When Onyx.update batches [null, undefined], return undefined instead of
coercing to {} so set() ignores the entry like a direct multiSet would.

Co-authored-by: Cursor <cursoragent@cursor.com>
roryabraham and others added 10 commits July 11, 2026 01:30
The mergeChanges regression fix uses `lastChange as TChange` to preserve
undefined at runtime; bump the non-nullable-type-assertion-style budget
in OnyxUtils from 1 to 2 alongside the existing matchedKey cast.

Co-authored-by: Cursor <cursoragent@cursor.com>
Rewrite the shouldRemoveNestedNulls ternary so prettier does not strip
required parentheses around the nullish-coalescing expression.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reverts the consumer-breaking parts of fa7a8d5 while keeping
collection-root snapshot delivery as the only runtime mode. OnyxDerived
and E/App depend on the optional sourceValue connect callback argument
and the waitForCollectionCallback / ResultMetadata<T> types from 3.0.86.

Co-authored-by: Cursor <cursoragent@cursor.com>
4.0.7 whitelists notation/annotation in no-negated-variables, so we can
restore test dot-notation/prefer-at overrides and drop the harness helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>
…pensify-4

# Conflicts:
#	lib/Onyx.ts
#	lib/OnyxUtils.ts
#	lib/storage/InstanceSync/index.web.ts
#	lib/utils.ts
#	tests/unit/mocks/sqliteMock.ts
#	tests/unit/useOnyxTest.ts
Drop useOnyx dependency-list tests removed on main
and refresh the seatbelt baseline for main's new lint.
scriptsConfig already self-scopes; leave it as-is so
seatbelt baselines for buildDocs stay consistent.
Take the landed atomic PRs (#822#826). Keep this branch's
seatbelt OnyxUtils entries; drop the obsolete no-nested-ternary
allowance now that degradePerformance is flattened.
@roryabraham roryabraham self-assigned this Sep 3, 2026
@roryabraham
roryabraham requested a review from a team September 3, 2026 05:19
@roryabraham

Copy link
Copy Markdown
Contributor Author

@codex review
@MelvinBot review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 9ee6899b36

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@roryabraham
roryabraham changed the base branch from rory-eslint-config-expensify-4 to main September 7, 2026 18:41
@roryabraham

Copy link
Copy Markdown
Contributor Author

Closing: this branch was cut from the eslint-upgrade PR and included all of #802. Recut onto main as a single-file change — see the replacement PR linked from this thread.

@roryabraham roryabraham closed this Sep 7, 2026
@roryabraham

Copy link
Copy Markdown
Contributor Author

Replacement: #841

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.

1 participant