style: Use prettier to format more files. (#381)

This commit is contained in:
Dylan Vann 2018-12-30 21:29:08 -05:00 committed by GitHub
parent 35e6ea984b
commit 4f4a5b5b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 52 additions and 90 deletions

View File

@ -13,6 +13,9 @@ jobs:
- run: - run:
name: Install name: Install
command: yarn install command: yarn install
- run:
name: Lint
command: yarn lint
- run: - run:
name: Build name: Build
command: yarn build command: yarn build

1
.prettierignore Normal file
View File

@ -0,0 +1 @@
ios/Vendor

View File

@ -1,7 +1,8 @@
module.exports = { module.exports = {
preset: 'react-native', preset: 'react-native',
"transform": { transform: {
"^.+\\.(js)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js" '^.+\\.(js)$':
'<rootDir>/node_modules/react-native/jest/preprocessor.js',
}, },
modulePathIgnorePatterns: [ modulePathIgnorePatterns: [
'react-native-fast-image-example*', 'react-native-fast-image-example*',

View File

@ -24,7 +24,9 @@
"scripts": { "scripts": {
"build": "exit 0", "build": "exit 0",
"commit": "git-cz", "commit": "git-cz",
"format": "prettier --write --list-different ./src/*.js", "prettier": "prettier './**/*.{js,d.ts,js.flow,yml}'",
"format": "yarn prettier --write",
"lint": "yarn prettier --list-different",
"prepare": "git submodule update --init --recursive", "prepare": "git submodule update --init --recursive",
"semantic-release": "semantic-release", "semantic-release": "semantic-release",
"test": "yarn run format && yarn run test:jest", "test": "yarn run format && yarn run test:jest",
@ -42,7 +44,7 @@
"cz-conventional-changelog": "^2.1.0", "cz-conventional-changelog": "^2.1.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"metro-react-native-babel-preset": "0.48.1", "metro-react-native-babel-preset": "0.48.1",
"prettier": "^1.15.2", "prettier": "^1.15.3",
"prettier-check": "^2.0.0", "prettier-check": "^2.0.0",
"prop-types": "^15.6.2", "prop-types": "^15.6.2",
"react": "16.6.0-alpha.8af6728", "react": "16.6.0-alpha.8af6728",

View File

@ -1,7 +1,7 @@
/** @format */ /** @format */
import {AppRegistry} from 'react-native'; import { AppRegistry } from 'react-native'
import App from './src'; import App from './src'
import {name as appName} from './app.json'; import { name as appName } from './app.json'
AppRegistry.registerComponent(appName, () => App); AppRegistry.registerComponent(appName, () => App)

View File

@ -8,9 +8,7 @@ const DefaultImageGrid = () => <ImageGrid ImageComponent={Image} />
DefaultImageGrid.navigationOptions = { DefaultImageGrid.navigationOptions = {
tabBarLabel: 'Image Grid', tabBarLabel: 'Image Grid',
tabBarIcon: props => ( tabBarIcon: props => <Icon name="ios-image" {...props} />,
<Icon name="ios-image" {...props} />
),
} }
export default DefaultImageGrid export default DefaultImageGrid

View File

@ -45,12 +45,7 @@ const FastImageExample = () => (
FastImageExample.navigationOptions = { FastImageExample.navigationOptions = {
tabBarLabel: 'FastImage Example', tabBarLabel: 'FastImage Example',
tabBarIcon: props => ( tabBarIcon: props => <Icon name="ios-information-circle" {...props} />,
<Icon
name="ios-information-circle"
{...props}
/>
),
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({

View File

@ -7,9 +7,7 @@ const FastImageGrid = () => <ImageGrid ImageComponent={FastImage} />
FastImageGrid.navigationOptions = { FastImageGrid.navigationOptions = {
tabBarLabel: 'FastImage Grid', tabBarLabel: 'FastImage Grid',
tabBarIcon: props => ( tabBarIcon: props => <Icon name="ios-photos" {...props} />,
<Icon name="ios-photos" {...props} />
),
} }
export default FastImageGrid export default FastImageGrid

View File

@ -1,7 +1,7 @@
/** @format */ /** @format */
import {AppRegistry} from 'react-native'; import { AppRegistry } from 'react-native'
import App from './src'; import App from './src'
import {name as appName} from './app.json'; import { name as appName } from './app.json'
AppRegistry.registerComponent(appName, () => App); AppRegistry.registerComponent(appName, () => App)

View File

@ -8,9 +8,7 @@ const DefaultImageGrid = () => <ImageGrid ImageComponent={Image} />
DefaultImageGrid.navigationOptions = { DefaultImageGrid.navigationOptions = {
tabBarLabel: 'Image Grid', tabBarLabel: 'Image Grid',
tabBarIcon: props => ( tabBarIcon: props => <Icon name="ios-image" {...props} />,
<Icon name="ios-image" {...props} />
),
} }
export default DefaultImageGrid export default DefaultImageGrid

View File

@ -45,12 +45,7 @@ const FastImageExample = () => (
FastImageExample.navigationOptions = { FastImageExample.navigationOptions = {
tabBarLabel: 'FastImage Example', tabBarLabel: 'FastImage Example',
tabBarIcon: props => ( tabBarIcon: props => <Icon name="ios-information-circle" {...props} />,
<Icon
name="ios-information-circle"
{...props}
/>
),
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({

View File

@ -7,9 +7,7 @@ const FastImageGrid = () => <ImageGrid ImageComponent={FastImage} />
FastImageGrid.navigationOptions = { FastImageGrid.navigationOptions = {
tabBarLabel: 'FastImage Grid', tabBarLabel: 'FastImage Grid',
tabBarIcon: props => ( tabBarIcon: props => <Icon name="ios-photos" {...props} />,
<Icon name="ios-photos" {...props} />
),
} }
export default FastImageGrid export default FastImageGrid

35
src/index.d.ts vendored
View File

@ -1,8 +1,13 @@
import * as React from 'react' import * as React from 'react'
import { FlexStyle, LayoutChangeEvent, ShadowStyleIOS, StyleProp, TransformsStyle } from 'react-native' import {
FlexStyle,
LayoutChangeEvent,
ShadowStyleIOS,
StyleProp,
TransformsStyle,
} from 'react-native'
declare namespace FastImage { declare namespace FastImage {
namespace priority { namespace priority {
type low = 'low' type low = 'low'
type normal = 'normal' type normal = 'normal'
@ -15,7 +20,7 @@ declare namespace FastImage {
type stretch = 'stretch' type stretch = 'stretch'
type center = 'center' type center = 'center'
} }
namespace cacheControl { namespace cacheControl {
type cacheOnly = 'cacheOnly' type cacheOnly = 'cacheOnly'
type immutable = 'immutable' type immutable = 'immutable'
@ -23,25 +28,25 @@ declare namespace FastImage {
} }
export type Priority = export type Priority =
FastImage.priority.low | | FastImage.priority.low
FastImage.priority.normal | | FastImage.priority.normal
FastImage.priority.high | FastImage.priority.high
export type ResizeMode = export type ResizeMode =
FastImage.resizeMode.contain | | FastImage.resizeMode.contain
FastImage.resizeMode.cover | | FastImage.resizeMode.cover
FastImage.resizeMode.stretch | | FastImage.resizeMode.stretch
FastImage.resizeMode.center | FastImage.resizeMode.center
export type Cache = export type Cache =
FastImage.cacheControl.cacheOnly | | FastImage.cacheControl.cacheOnly
FastImage.cacheControl.immutable | | FastImage.cacheControl.immutable
FastImage.cacheControl.web | FastImage.cacheControl.web
} }
export type FastImageSource = { export type FastImageSource = {
uri?: string uri?: string
headers?: {[key: string]: string} headers?: { [key: string]: string }
priority?: FastImage.Priority priority?: FastImage.Priority
cache?: FastImage.Cache cache?: FastImage.Cache
} }
@ -124,7 +129,7 @@ interface FastImageStatic extends React.ComponentClass<FastImageProperties> {
normal: FastImage.priority.normal normal: FastImage.priority.normal
high: FastImage.priority.high high: FastImage.priority.high
} }
cache: { cache: {
cacheOnly: FastImage.cache.cacheOnly cacheOnly: FastImage.cache.cacheOnly
immutable: FastImage.cache.immutable immutable: FastImage.cache.immutable

View File

@ -2645,7 +2645,7 @@ debug@^4.1.0:
dependencies: dependencies:
ms "^2.1.1" ms "^2.1.1"
debuglog@*, debuglog@^1.0.1: debuglog@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
@ -4015,7 +4015,7 @@ import-local@^1.0.0:
pkg-dir "^2.0.0" pkg-dir "^2.0.0"
resolve-cwd "^2.0.0" resolve-cwd "^2.0.0"
imurmurhash@*, imurmurhash@^0.1.4: imurmurhash@^0.1.4:
version "0.1.4" version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
@ -5228,11 +5228,6 @@ lockfile@^1.0.4:
dependencies: dependencies:
signal-exit "^3.0.2" signal-exit "^3.0.2"
lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=
lodash._baseuniq@~4.6.0: lodash._baseuniq@~4.6.0:
version "4.6.0" version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
@ -5241,33 +5236,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0" lodash._createset "~4.0.0"
lodash._root "~3.0.0" lodash._root "~3.0.0"
lodash._bindcallback@*:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=
lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=
lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"
lodash._createset@~4.0.0: lodash._createset@~4.0.0:
version "4.0.3" version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=
lodash._getnative@*, lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
lodash._root@~3.0.0: lodash._root@~3.0.0:
version "3.0.1" version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692" resolved "https://registry.yarnpkg.com/lodash._root/-/lodash._root-3.0.1.tgz#fba1c4524c19ee9a5f8136b4609f017cf4ded692"
@ -5333,11 +5306,6 @@ lodash.pick@^4.4.0:
resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3"
integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=
lodash.restparam@*:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
lodash.set@^4.3.2: lodash.set@^4.3.2:
version "4.3.2" version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
@ -6991,10 +6959,10 @@ prettier-check@^2.0.0:
dependencies: dependencies:
execa "^0.6.0" execa "^0.6.0"
prettier@^1.15.2: prettier@^1.15.3:
version "1.15.2" version "1.15.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.2.tgz#d31abe22afa4351efa14c7f8b94b58bb7452205e" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.3.tgz#1feaac5bdd181237b54dbe65d874e02a1472786a"
integrity sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug== integrity sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==
pretty-format@^23.4.1, pretty-format@^23.6.0: pretty-format@^23.4.1, pretty-format@^23.6.0:
version "23.6.0" version "23.6.0"
@ -7450,7 +7418,7 @@ readable-stream@~1.1.10:
isarray "0.0.1" isarray "0.0.1"
string_decoder "~0.10.x" string_decoder "~0.10.x"
readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0: readdir-scoped-modules@^1.0.0:
version "1.0.2" version "1.0.2"
resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747"
integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c= integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=