mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-04 13:43:34 -04:00
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
23 lines
676 B
JavaScript
23 lines
676 B
JavaScript
import factory from "factoria";
|
|
import fs from "fs";
|
|
import path from "path";
|
|
|
|
// Require each individual factory definition, not to use the export but just
|
|
// to register them with factoria
|
|
const pathToFactories = path.join( __dirname, "factories" );
|
|
fs.readdirSync( pathToFactories ).forEach( file => {
|
|
const factoryName = path.basename( file, ".js" );
|
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
require( `./factories/${factoryName}` );
|
|
} );
|
|
|
|
// Makes a basic API response from an array of results
|
|
export const makeResponse = results => ( {
|
|
total_results: results.length,
|
|
page: 1,
|
|
per_page: 30,
|
|
results
|
|
} );
|
|
|
|
export default factory;
|