Upgrade eslint-config-expensify to 4.0.6#802
Draft
roryabraham wants to merge 34 commits into
Draft
Conversation
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>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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>
This comment was marked as resolved.
This comment was marked as resolved.
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>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
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>
This comment was marked as resolved.
This comment was marked as resolved.
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>
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>
Draft
40 tasks
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>
…bility" This reverts commit 939d563.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
eslint-config-expensifyfrom2.0.108to4.0.6and replaces the monolithicimport expensify from 'eslint-config-expensify'config with modular sub-configs (browser,react,typescript,jest,scripts), matching the pattern used inexpensify-common.@typescript-eslintplugin/parser block and ~40 per-rule overrides that duplicated what v4 now ships (type imports/exports, import extensions, redeclare handling, JSDoc disables, etc.).eslint-seatbeltwith an initial baseline (eslint.seatbelt.tsv) to grandfather existing type-checked violations from the jump torecommendedTypeChecked, without blocking CI.eslint-plugin-import,eslint-plugin-jsx-a11y,eslint-plugin-react,@typescript-eslint/*,@lwc/eslint-plugin-lwc,@react-native-community/eslint-config) now provided transitively byeslint-config-expensify.eslint-disablecomments for rules that v4 no longer reports (dot-notation,@typescript-eslint/no-empty-function).Overrides retained (by category)
Onyx / project-structure specific (intentional):
rulesdir/no-multiple-onyx-in-file: offimport/extensions: offtests/**, mocksno-restricted-syntax(allowfor...of/for...in)@typescript-eslint/no-require-imports: off**/*.native.ts(x)require()globals.jestMemoryOnlyProvider.tsglobalIgnoresfor.github/**,dist/**,cpp/**, etc.Not Onyx-specific (generic library / TypeScript conventions — candidates to remove over time):
class-methods-use-this: offes/no-optional-chaining: offes/no-nullish-coalescing-operators: offreact/prop-types: offreact/require-default-props: offreact/jsx-props-no-spreading: offuseOnyx) spread props intentionallyDeliberately not imported:
eslint-config-expensify/expensify— contains App-onlyrulesdir/*rules (prefer-onyx-connect-in-libs,no-onyx-connect, restrictedreact-nativeimports, etc.) that do not apply to this package.Test plan
CI only.
Linked E/App PR
Expensify/App#95893
Author Checklist
### Related Issuessection above### Linked E/App PRsection above, and verified this change against it (E/App CI passed and manual testing completed)TestssectiontoggleReportand notonIconClick)myBool && <MyComponent />.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)Avataris modified, I verified thatAvataris working as expected in all cases)mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.