46 Commits

Author SHA1 Message Date
Abbey Campbell
bf0db16300 autofix post-merge main 2025-12-22 18:28:45 -08:00
Abbey Campbell
5fc34554c6 enforce consistent array type definition 2025-12-22 18:25:28 -08:00
Ryan Stelly
b78be9243d lint rule & autofix for "trailing comma" (#3299)
* (lint) MOB-1063 enforce trailing commas

* autofix trailing commas

* manually fix newly introduced maxlen violations

* add trailing comma convention to i18n build
2025-12-22 20:17:13 -06:00
Ryan Stelly
4c49e69851 MOB-1039 apply member delimiter style and autofix (#3281) 2025-12-12 14:04:58 -06:00
Ryan Stelly
1bdf8ddc4e MOB-1039 add stylistic eslint plugin package dependency (#3266) 2025-12-10 12:20:04 -06:00
Seth Peterson
12db53e7d6 Merge pull request #3249 from inaturalist/mob-512-implement-saved-match-screen
MOB-512 saved match screen experience
2025-12-09 09:22:10 -06:00
sepeterson
dfcf12cc73 MOB-512 merge main 2025-12-04 21:31:43 -06:00
Ryan Stelly
2e35071a5a more strict type import style (#3265)
* MOB-1058 add consistent-type-specifier-style lint for even more consistency

* MOB-1058 apply consistent-type-specifier-style lint autofix
2025-12-04 20:51:01 -06:00
Ryan Stelly
ca686f3c11 lint config for consistent import style (#3248)
* MOB-1008 add lint config for consistent ts imports

* auto-fix consistent imports

* auto-fix consistent imports

* reapply autofix from latest main

* Extend Props interface from PropsWithChildren

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-11-27 20:21:03 -06:00
sepeterson
19cb7064a6 MOB-512 minimal unit test fix and prop spreading allowed for tests 2025-11-21 10:12:59 -06:00
Ryan Stelly
362ed537ee MOB-978 turn off restricted-syntax rule to allow loops 2025-10-31 11:33:19 -05:00
Ryan Stelly
55fb2e0a1d MOB-945 use macos-15 in ci, set explicit iOS version in detox config (#3133)
Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-10-14 14:00:49 +02:00
Corey Farwell
8ad5036273 Limit Jest usage to test files; conslidate ESLint config. (#3086)
Prior to this commit, technically Jest could have been imported in production files and ESLint would have been okay with that since it was allowed across the codebase.

After this commit, ESLint will only allow Jest usage in test files. In addition, the 3-line test-specific ESLint config was consolidated into the main config.

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-09-09 16:37:06 +02:00
Corey Farwell
a43446909c Remove the need to specify TypeScript file extensions in imports (#3094)
* Don't require TS extensions in imports

* Resolve all import extension errors

* Remove file extension from import paths used in mocks

* Remove .d of type definition file paths

* Remove .d of type definition file and import as type

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-09-07 23:41:42 +02:00
Johannes Klein
49091f8fc4 Enable React Compiler (#3082)
* Update package.json

* Update package-lock.json

* Enable plugin

* Update package.json

* Update package-lock.json

* Update .eslintrc.js

* Create a new object instead of mutating the existing one

* Update SoundRecorder.js

* Do not mutate prop directly

* Do not mutate store value directly

* Disable compiler for zoom hook

Because it uses reanimated logic, and previous work laid out we should specifically disregard a rule of react here, unsure what to do here for now.

* Move array for tracking results into component

* Disable compiler for StandardCamera

* Do not mutate store value directly

* Disable compiler for FullPageWebView

* Do not mutate route param

* Remove unnecessary check if state is true before setting it to false

* Fix: user might be undefined

* Update reanimated usage with new compiler compliant API

* Fix: taxon might be undefined

* Fix: taxon might be undefined

* Fix: common pitfall of trying to render text outside of Text component

* Update interface

* Add package override

* Update package-lock.json

* Refactor updating of user preferences into User model

* Remove no memo directive from zoom

* Update file imports

* Migrate safeRealmWrite to TS

* Update interface and import path

* Update interface

* Refactor useLocaalObservation hook to not mutate return value of a function that should not be mutated

* Update tests to new return structure

* Remove useSafeRoute hook

We get the same information from error contexts and surrounding documents, and this hook was violating the rules of react by conditionally calling another hook.

* Use optional chaining

* Update TaxonNamesSetting.test.js

* Fix: use optional chaining

* Extend on RNTLs renderHook instead of re-implementing

* Remove unnecessary mock

* Remove unnecessary mock

* Remove unecessary mock

* Remove trailing spaces
2025-09-01 17:06:51 +02:00
Amanda Bullington
502393a5d1 Dev experience: linting for TypeScript (#2933)
* Change TS warning about unused variables to error & support _unused in catch blocks

* Use TS recommended object instead of Object

* Set Function issues to warnings in TS files for later fixing
2025-06-02 09:47:29 -07:00
Amanda Bullington
95151e065b Remove unused code and packages, add eslint package for TS, suppress TS errors (#2924) 2025-05-28 17:01:10 -07:00
Amanda Bullington
f5239881dd Speed up Explore nearby tile loading (#2912)
* Create a performance tracker to show urltile load time in debug mode

* Set default radius to 1km, not 50km

* Code cleanup & TypeScript definitions

* Fix TypeError

* Address eslint error

* Make github actions happy

---------

Co-authored-by: Johannes Klein <johannes.t.klein@gmail.com>
2025-05-21 14:40:54 -07:00
Ken-ichi
10bbea44c4 e2e mock for Geolocation.watchPosition to deflake tests (#1842) 2024-07-24 17:15:03 -07:00
Amanda Bullington
d9d7a6ff06 Suggestions screen UI fixes, location toggle, and offline reloading state (#1708)
* UI changes to suggestions screen

* Update offline suggestions UI and allow refetch

* Allow user to search online suggestions with and without evidence location

* Add improve location button and refactor header

* Use loading screen correctly between location/ignore location

* Hide location permission button and code cleanup

* Fix test for suggestions changes
2024-06-24 16:26:40 -07:00
Amanda Bullington
771e5c810b Changes to syncing process (#1670)
* Refactor syncing code and add preUploadProgress checks

* Progress on sync button functionality

* Fix deletions progress and toolbar test

* Time out deletion complete if no uploads

* Delete and then upload from sync button

* Test cleanup

* try to fix tests

* Improvements to automatic and button sync logging

* Code cleanup

* Renaming and rewriting sync functionality

* Restore MyObs test

* Add tests for useSyncObservations

* Code cleanup

* Use unique realm instance in useSyncObservations test

* Fixes for e2e crash

* Fix deletions, tests, and deletion errors

* Show and clear deletions on toolbar

* Sleep longer before resetting toolbar

* Remove sleep to pass e2e test
2024-06-18 19:04:28 -07:00
Ken-ichi
84c3b3c96d Track number of failed uploads (#1601) 2024-05-22 17:40:06 -07:00
Amanda Bullington
21b9cc6a97 Update Eslint to support TypeScript (#1419)
* Add typescript parser and fix Flow errors in JS files

* Uninstall packages from react-native/eslint-config

* Fix all flow errors (or ignore them for unknowns
2024-04-18 21:35:26 -07:00
Johannes Klein
5d022c25b7 Add comment to muted eslint extends 2024-03-29 18:18:39 +01:00
Johannes Klein
486ba4f30f Upgrade React Native to 0.72 (#1337) 2024-03-29 17:52:37 +01:00
Johannes Klein
4877c1a369 Add Support screen (#1171)
* Update strings.ftl

* Add drawer item for Support

* Update strings.ftl

* Change key

* UI for Support screen

* Link out to websites on button presses

* Restyle screen header

* Eslint settings to get rid of an error

* Use react-native-store-review to ask for review

* Not needed use of .tsx in import

* Remove comments
2024-02-25 22:33:04 +01:00
Ken-ichi
3eddba7daf Change bundle ID (#1013)
* Changed the Android package name to org.inaturalist.iNaturalistMobile
* Changed iOS bundle ID to org.inaturalist.iNaturalistMobile
* Updated fastlane; committing eslint fixes
* Updated ios/iNaturalistReactNative-ShareExtension/Info.plist with new bundle ID
2024-01-10 12:12:17 -08:00
Ken-ichi Ueda
ee38d76801 New eslint rules 2023-05-17 15:21:35 -07:00
Johannes Klein
1439c40c6a Upgrading the app to react-native 0.71.7 (#592)
* Changes in the unproblematic files

* Remove manually linked react-native-config

* Updates to files because of upgrade

* RN 71 and dependencies packages

* Update snapshot tests

* RN 71.1

* Fix missing jest mock

* RN 71.7

* Missing mock

* Fix errors with apisauce and axios

* Remove react-native-codegen direct dependency

* Code style
2023-04-25 17:18:24 +02:00
Amanda Bullington
32245cb526 Fix camera button alignment & add eslint indent rule 2023-03-15 17:26:44 -07:00
Ken-ichi
09ab2de8d6 Remove eslint rule requiring acc. hint with label and other minor changes (#447)
* Added identification-solid icon
* Used ActivityCount on obs detail to test out label without hint
* Minor fixes to the README
2023-02-07 18:58:28 -05:00
Johannes Klein
e57aac93f6 418 create an index.js file for importing shared components (#427)
* Update .eslintrc.js

* Create index.js

* Change Button usage in GridItem

* Replace imports

* Add strings

* Add hint prop to button

* Add a11y hint prop to EvidenceButton

* Add EvidenceButton to index

* Add a11y props to EvidenceButton

* Update UiLibrary.js

* Add a11y props to CloseButton

* Add CloseButton to index and UiLib

* Rename function

* Update string

* Add a11y props to AddObsButton

* Add Tabs to index

* Linebreak

* Add Typography to index

* Remove unused text

* Refactor UserIcon test coverage in it's own test

* Add UserIcon to index

* Add UserIcon to UiLib

* Add InlineUser to index

* Add Quality badge to index

* Update UiLibrary.js

* Remove unused component

* Change AddObsButton a11y label

* Change hint

* Use consistent uri in snapshots

* Add snapshot to InlineUser

* Fix wrong user key

* Update Tabs.test.js

* Snapshot TODO

* Update NavButton.js

* Update snapshot

* Add snapshot for active user icon

* Remove snapshot result

* Add ActivityCount to index

* Update UiLibrary.js
2023-02-04 15:18:42 +01:00
Johannes Klein
7bceb1214b 416 eslint a11y (#420)
* Add eslint-plugin-react-native-a11y dependency

* Do not fix warnings on eslint run

* Change all a11y error rules to warnings for now

* Add a11y hint to Tabs

* Add a11y prop to UserIcon

* Update strings.ftl

* Update strings

* Update README.md

* Update a11y props for InlineUser

* Update a11y label

* Add explanation for strings
2023-02-01 14:12:15 +01:00
Ken-ichi
c76be140b5 Fixes bug preventing photo uploads (#324)
Primary bug was that requests to POST /v2/observation_photos were using the
obs serial ID instead of the obs UUID.

Another major problem was that uploads always quit before the last observation
when there were multiple observations to upload, which I address by changing
the way we set `allObsToUpload` in `useLocalObservations`.
2022-12-31 09:46:50 -08:00
Amanda Bullington
310d2e743d Add eslint rules for React Query (#319)
* Use eslint rules to clean up useQuery code

* Code cleanup for useAuthenticatedMutation

* Add realm deletion and clear mock before each test in DeleteObservationDialog
2022-12-30 13:30:07 -08:00
Amanda Bullington
ec0a686df6 Eslint: disallow console logs (#312)
* Remove console.logs; remote useLoggedIn hook and instead use useCurrentUser; closes #310

* Comment out locale test
2022-12-29 10:56:50 -08:00
Ken-ichi Ueda
6c009bbdb6 Make eslint allow console statements 2022-11-02 16:09:13 -07:00
Amanda Bullington
c4d9cd4dc6 Use babel-plugin-module-resolver (#188)
* Add alias and update eslint/flow to resolve modules

* Update aliases for components and api

* Add other src directories to module resolver aliases
2022-10-07 10:20:55 -07:00
Ken-ichi
e929764c25 Adopted and enforced code style from other iNat Javascript projects
These rules are largely based on the AirBnB ones, which are not quite standard
for the React Native world, where Prettier seems to be more common, but I
think they add a lot of useful checks, and unlike Prettier we can customize
them. This also just makes it easier for people on the iNat team to work on
the mobile app.

Some specific changes:

* Added eslint-plugin-react-hooks to eslint rules
* Added eslint-plugin-simple-import-sort to eslint rules
* Bugfix: could not import photo from gallery
* Added support for react-native/no-inline-styles eslint rule
* useUser should not bother fetching a user for a blank userId
2022-07-13 13:55:59 -07:00
budowski
4b4b0f9244 Add ID - initial commit (#103) (#113)
* Adds a component for adding identifications, both from Obs Detail and Obs Edit
* Minor style and eslint change to disallow all-caps string literals

Closes #103 

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2022-07-02 16:01:48 -07:00
Amanda Bullington
2e184b97f4 Enforce globalized text with eslint plugin (#120)
Add plugin to enforce globalized text with warnings; globalize some strings; closes #93
2022-07-01 12:42:24 -07:00
Ken-ichi
523da746f2 Several updates to testing (#17)
* Several updates to testing

* Restructured tests so they are in their own dir at the root
* Added an integration test that mocks the response from inaturalistjs
* Instead of mocking Realm, I mocked the Realm config so it writes to an
  in-memory database for tests
* Added test data factories with factoria and faker

TODO
* Try mocking hooks to make a unit tests for the ObsList component; it should
  be possible to write unit tests for components with hooks
* Data in the in-memory Realm db is probably sticking around between tests; we
  need a way to trash the db after each test

* Tried to address logbox failure in Github Actions test run

* Tried bumping the timeout for tests for github actions

* Added skip duplicates and Slack notification to test action

* Added unit test for ObsList

* Seriously, how much time do you need to run a test...

* Added missing factory import

* Test fixes for context & providers

* DRY out ObsList.test.js a bit

* Made ObsList.test.js synchronous

In theory I suspect all component tests should be synchronous because if
you've mocked out all the hooks, there should be no reason to wait for
effects to complete.

Also removed subscriptionRef which didn't seem to be doing anything.
2021-11-19 13:53:44 -08:00
Amanda Bullington
67f130fe59 Code cleanup; add accessibility engine to test suite 2021-11-04 16:36:52 -07:00
Amanda Bullington
ff6789c32c Merge obs list, obs card, and user profile into main (#4)
* Obs detail screen skeleton; move safe area view to wrapper component

* Progress on obs detail

* Get ids and photos from api v2

* Fetch data needed for data tab in obs detail

* Create basic map for data tab, centered on lat/long

* Create linked realms for photos and identifications; access these on obs detail screen

* User Profile and more setup for test suite

* Delete coverage directory

* Add Jest coverage folder to gitignore

* Keep trying to mock out fetch for inatjs in ObsList.test.js

* Rename ObsList.test to match component name
2021-11-04 15:44:57 -07:00
Amanda Bullington
a839f7867c Add eslint rules & make lint fixes 2021-09-15 11:16:47 -07:00
Amanda Bullington
d4adde847d Create RN repo with npx react-native init 2021-09-13 14:38:14 -07:00