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>
* 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>
* 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
* 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
* 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>
* 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
* 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
* 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
* 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
* 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
* 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
* 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
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`.
* Use eslint rules to clean up useQuery code
* Code cleanup for useAuthenticatedMutation
* Add realm deletion and clear mock before each test in DeleteObservationDialog
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
* 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>
* 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.
* 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