From e751138c447a5dba9960398c37870238d2a4334e Mon Sep 17 00:00:00 2001 From: Mikael Sand Date: Fri, 8 Nov 2019 23:32:40 +0200 Subject: [PATCH] chore: fix linting --- package.json | 3 ++- src/BlurView.android.js | 7 ++++++- src/BlurView.ios.js | 8 ++++++-- src/VibrancyView.ios.js | 13 ++++++------- yarn.lock | 16 +++++++++++++++- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 847575e..277ae3f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "lint": "eslint ." + "lint": "eslint src index.js" }, "repository": { "type": "git", @@ -28,6 +28,7 @@ "devDependencies": { "@react-native-community/eslint-config": "^0.0.5", "eslint": "^6.6.0", + "eslint-plugin-prettier": "^3.1.1", "husky": "^3.0.9", "lint-staged": "^9.4.2", "prettier": "1.18.2", diff --git a/src/BlurView.android.js b/src/BlurView.android.js index 1c44d70..e08a76d 100644 --- a/src/BlurView.android.js +++ b/src/BlurView.android.js @@ -6,6 +6,7 @@ import { DeviceEventEmitter, ViewPropTypes, Platform, + StyleSheet, } from 'react-native'; const OVERLAY_COLORS = { @@ -79,12 +80,16 @@ class BlurView extends Component { blurRadius={this.blurRadius()} downsampleFactor={this.downsampleFactor()} overlayColor={this.overlayColor()} - style={[{ backgroundColor: 'transparent' }, style]} + style={StyleSheet.compose(styles.transparent, style)} /> ); } } +const styles = StyleSheet.create({ + transparent: { backgroundColor: 'transparent' }, +}); + BlurView.propTypes = { ...(ViewPropTypes || View.propTypes), blurAmount: PropTypes.number, diff --git a/src/BlurView.ios.js b/src/BlurView.ios.js index aad7ef7..df34bfb 100644 --- a/src/BlurView.ios.js +++ b/src/BlurView.ios.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { View, requireNativeComponent, ViewPropTypes } from 'react-native'; +import {View, requireNativeComponent, ViewPropTypes, StyleSheet} from 'react-native'; class BlurView extends Component { setNativeProps = nativeProps => { @@ -14,12 +14,16 @@ class BlurView extends Component { (this._root = e)} {...this.props} - style={[{ backgroundColor: 'transparent' }, this.props.style]} + style={StyleSheet.compose(styles.transparent, this.props.style)} /> ); } } +const styles = StyleSheet.create({ + transparent: { backgroundColor: 'transparent' }, +}); + BlurView.propTypes = { ...(ViewPropTypes || View.propTypes), blurType: PropTypes.oneOf([ diff --git a/src/VibrancyView.ios.js b/src/VibrancyView.ios.js index adec2f1..afd5760 100644 --- a/src/VibrancyView.ios.js +++ b/src/VibrancyView.ios.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { requireNativeComponent } from 'react-native'; +import {requireNativeComponent, StyleSheet} from 'react-native'; class VibrancyView extends Component { setNativeProps = nativeProps => { @@ -13,17 +13,16 @@ class VibrancyView extends Component { return ( ); } } +const styles = StyleSheet.create({ + transparent: { backgroundColor: 'transparent' }, +}); + VibrancyView.propTypes = { blurType: PropTypes.string, blurAmount: PropTypes.number.isRequired, diff --git a/yarn.lock b/yarn.lock index a2e4cfe..7929125 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2108,6 +2108,13 @@ eslint-plugin-prettier@2.6.2: fast-diff "^1.1.1" jest-docblock "^21.0.0" +eslint-plugin-prettier@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.1.tgz#507b8562410d02a03f0ddc949c616f877852f2ba" + integrity sha512-A+TZuHZ0KU0cnn56/9mfR7/KjUJ9QNVXUhwvRFSR7PGPe0zQR6PTkmyqg1AtUUEOzTqeRsUwyKFh0oVZKVCrtA== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-plugin-react-hooks@^1.5.1: version "1.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.0.tgz#348efcda8fb426399ac7b8609607c7b4025a6f5f" @@ -2408,7 +2415,7 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-diff@^1.1.1: +fast-diff@^1.1.1, fast-diff@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== @@ -4699,6 +4706,13 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + prettier@1.16.4: version "1.16.4" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"