From 77f2a01d966d0f43f6410acebe4f6b2071a6ee2c Mon Sep 17 00:00:00 2001 From: Dylan Vann Date: Sun, 30 Dec 2018 21:22:43 -0500 Subject: [PATCH] style: Use prettier to format more files. --- .circleci/config.yml | 3 ++ jest.config.js | 5 +- package.json | 6 ++- .../index.js | 8 ++-- .../src/DefaultImageGrid.js | 4 +- .../src/FastImageExamples.js | 7 +-- .../src/FastImageGrid.js | 4 +- react-native-fast-image-example/index.js | 8 ++-- .../src/DefaultImageGrid.js | 4 +- .../src/FastImageExamples.js | 7 +-- .../src/FastImageGrid.js | 4 +- src/index.d.ts | 35 ++++++++------ yarn.lock | 46 +++---------------- 13 files changed, 51 insertions(+), 90 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8487ae7dd..d9a0958ee 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,6 +13,9 @@ jobs: - run: name: Install command: yarn install + - run: + name: Lint + command: yarn lint - run: name: Build command: yarn build diff --git a/jest.config.js b/jest.config.js index 5c0082ae8..3ea5bda02 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,8 @@ module.exports = { preset: 'react-native', - "transform": { - "^.+\\.(js)$": "/node_modules/react-native/jest/preprocessor.js" + transform: { + '^.+\\.(js)$': + '/node_modules/react-native/jest/preprocessor.js', }, modulePathIgnorePatterns: [ 'react-native-fast-image-example*', diff --git a/package.json b/package.json index d20ad157b..851bb406c 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,9 @@ "scripts": { "build": "exit 0", "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", "semantic-release": "semantic-release", "test": "yarn run format && yarn run test:jest", @@ -42,7 +44,7 @@ "cz-conventional-changelog": "^2.1.0", "jest": "^23.6.0", "metro-react-native-babel-preset": "0.48.1", - "prettier": "^1.15.2", + "prettier": "^1.15.3", "prettier-check": "^2.0.0", "prop-types": "^15.6.2", "react": "16.6.0-alpha.8af6728", diff --git a/react-native-fast-image-example-cocoapods/index.js b/react-native-fast-image-example-cocoapods/index.js index e349033b5..0cc3ec829 100644 --- a/react-native-fast-image-example-cocoapods/index.js +++ b/react-native-fast-image-example-cocoapods/index.js @@ -1,7 +1,7 @@ /** @format */ -import {AppRegistry} from 'react-native'; -import App from './src'; -import {name as appName} from './app.json'; +import { AppRegistry } from 'react-native' +import App from './src' +import { name as appName } from './app.json' -AppRegistry.registerComponent(appName, () => App); +AppRegistry.registerComponent(appName, () => App) diff --git a/react-native-fast-image-example-cocoapods/src/DefaultImageGrid.js b/react-native-fast-image-example-cocoapods/src/DefaultImageGrid.js index 3adaea3fa..36b4e976c 100644 --- a/react-native-fast-image-example-cocoapods/src/DefaultImageGrid.js +++ b/react-native-fast-image-example-cocoapods/src/DefaultImageGrid.js @@ -8,9 +8,7 @@ const DefaultImageGrid = () => DefaultImageGrid.navigationOptions = { tabBarLabel: 'Image Grid', - tabBarIcon: props => ( - - ), + tabBarIcon: props => , } export default DefaultImageGrid diff --git a/react-native-fast-image-example-cocoapods/src/FastImageExamples.js b/react-native-fast-image-example-cocoapods/src/FastImageExamples.js index a3cffd103..5dac37eaa 100644 --- a/react-native-fast-image-example-cocoapods/src/FastImageExamples.js +++ b/react-native-fast-image-example-cocoapods/src/FastImageExamples.js @@ -45,12 +45,7 @@ const FastImageExample = () => ( FastImageExample.navigationOptions = { tabBarLabel: 'FastImage Example', - tabBarIcon: props => ( - - ), + tabBarIcon: props => , } const styles = StyleSheet.create({ diff --git a/react-native-fast-image-example-cocoapods/src/FastImageGrid.js b/react-native-fast-image-example-cocoapods/src/FastImageGrid.js index 8d845ba36..68bc25bc7 100644 --- a/react-native-fast-image-example-cocoapods/src/FastImageGrid.js +++ b/react-native-fast-image-example-cocoapods/src/FastImageGrid.js @@ -7,9 +7,7 @@ const FastImageGrid = () => FastImageGrid.navigationOptions = { tabBarLabel: 'FastImage Grid', - tabBarIcon: props => ( - - ), + tabBarIcon: props => , } export default FastImageGrid diff --git a/react-native-fast-image-example/index.js b/react-native-fast-image-example/index.js index e349033b5..0cc3ec829 100644 --- a/react-native-fast-image-example/index.js +++ b/react-native-fast-image-example/index.js @@ -1,7 +1,7 @@ /** @format */ -import {AppRegistry} from 'react-native'; -import App from './src'; -import {name as appName} from './app.json'; +import { AppRegistry } from 'react-native' +import App from './src' +import { name as appName } from './app.json' -AppRegistry.registerComponent(appName, () => App); +AppRegistry.registerComponent(appName, () => App) diff --git a/react-native-fast-image-example/src/DefaultImageGrid.js b/react-native-fast-image-example/src/DefaultImageGrid.js index 3adaea3fa..36b4e976c 100644 --- a/react-native-fast-image-example/src/DefaultImageGrid.js +++ b/react-native-fast-image-example/src/DefaultImageGrid.js @@ -8,9 +8,7 @@ const DefaultImageGrid = () => DefaultImageGrid.navigationOptions = { tabBarLabel: 'Image Grid', - tabBarIcon: props => ( - - ), + tabBarIcon: props => , } export default DefaultImageGrid diff --git a/react-native-fast-image-example/src/FastImageExamples.js b/react-native-fast-image-example/src/FastImageExamples.js index a3cffd103..5dac37eaa 100644 --- a/react-native-fast-image-example/src/FastImageExamples.js +++ b/react-native-fast-image-example/src/FastImageExamples.js @@ -45,12 +45,7 @@ const FastImageExample = () => ( FastImageExample.navigationOptions = { tabBarLabel: 'FastImage Example', - tabBarIcon: props => ( - - ), + tabBarIcon: props => , } const styles = StyleSheet.create({ diff --git a/react-native-fast-image-example/src/FastImageGrid.js b/react-native-fast-image-example/src/FastImageGrid.js index 8d845ba36..68bc25bc7 100644 --- a/react-native-fast-image-example/src/FastImageGrid.js +++ b/react-native-fast-image-example/src/FastImageGrid.js @@ -7,9 +7,7 @@ const FastImageGrid = () => FastImageGrid.navigationOptions = { tabBarLabel: 'FastImage Grid', - tabBarIcon: props => ( - - ), + tabBarIcon: props => , } export default FastImageGrid diff --git a/src/index.d.ts b/src/index.d.ts index 057e3e787..eca7894b7 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,8 +1,13 @@ 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 { - namespace priority { type low = 'low' type normal = 'normal' @@ -15,7 +20,7 @@ declare namespace FastImage { type stretch = 'stretch' type center = 'center' } - + namespace cacheControl { type cacheOnly = 'cacheOnly' type immutable = 'immutable' @@ -23,25 +28,25 @@ declare namespace FastImage { } export type Priority = - FastImage.priority.low | - FastImage.priority.normal | - FastImage.priority.high + | FastImage.priority.low + | FastImage.priority.normal + | FastImage.priority.high export type ResizeMode = - FastImage.resizeMode.contain | - FastImage.resizeMode.cover | - FastImage.resizeMode.stretch | - FastImage.resizeMode.center + | FastImage.resizeMode.contain + | FastImage.resizeMode.cover + | FastImage.resizeMode.stretch + | FastImage.resizeMode.center export type Cache = - FastImage.cacheControl.cacheOnly | - FastImage.cacheControl.immutable | - FastImage.cacheControl.web + | FastImage.cacheControl.cacheOnly + | FastImage.cacheControl.immutable + | FastImage.cacheControl.web } export type FastImageSource = { uri?: string - headers?: {[key: string]: string} + headers?: { [key: string]: string } priority?: FastImage.Priority cache?: FastImage.Cache } @@ -124,7 +129,7 @@ interface FastImageStatic extends React.ComponentClass { normal: FastImage.priority.normal high: FastImage.priority.high } - + cache: { cacheOnly: FastImage.cache.cacheOnly immutable: FastImage.cache.immutable diff --git a/yarn.lock b/yarn.lock index adc351baa..dc6d42453 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2645,7 +2645,7 @@ debug@^4.1.0: dependencies: ms "^2.1.1" -debuglog@*, debuglog@^1.0.1: +debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -4015,7 +4015,7 @@ import-local@^1.0.0: pkg-dir "^2.0.0" resolve-cwd "^2.0.0" -imurmurhash@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -5228,11 +5228,6 @@ lockfile@^1.0.4: dependencies: 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: version "4.6.0" 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._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: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" 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: version "3.0.1" 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" 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: version "4.3.2" resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" @@ -6991,10 +6959,10 @@ prettier-check@^2.0.0: dependencies: execa "^0.6.0" -prettier@^1.15.2: - version "1.15.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.2.tgz#d31abe22afa4351efa14c7f8b94b58bb7452205e" - integrity sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug== +prettier@^1.15.3: + version "1.15.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.3.tgz#1feaac5bdd181237b54dbe65d874e02a1472786a" + integrity sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg== pretty-format@^23.4.1, pretty-format@^23.6.0: version "23.6.0" @@ -7450,7 +7418,7 @@ readable-stream@~1.1.10: isarray "0.0.1" string_decoder "~0.10.x" -readdir-scoped-modules@*, readdir-scoped-modules@^1.0.0: +readdir-scoped-modules@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.0.2.tgz#9fafa37d286be5d92cbaebdee030dc9b5f406747" integrity sha1-n6+jfShr5dksuuve4DDcm19AZ0c=