From 1c70f33511448c6d8b3d81aa0898a840ae0dd334 Mon Sep 17 00:00:00 2001 From: Spencer Ahrens Date: Mon, 18 May 2015 15:30:17 -0700 Subject: [PATCH] [ReactNative] clean lint for Libraries/Components --- .eslintrc | 2 +- .../ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js | 1 - Libraries/Components/ScrollResponder.js | 4 ++-- Libraries/Components/Subscribable.js | 2 +- Libraries/Components/WebView/WebView.android.js | 4 ++-- Libraries/Components/WebView/WebView.ios.js | 3 +-- package.json | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.eslintrc b/.eslintrc index da893862db6b11..84045365c85b89 100644 --- a/.eslintrc +++ b/.eslintrc @@ -168,7 +168,7 @@ "no-underscore-dangle": 0, // disallow dangling underscores in identifiers "no-wrap-func": 1, // disallow wrapping of non-IIFE statements in parens "no-mixed-spaces-and-tabs": 1, // disallow mixed spaces and tabs for indentation - "quotes": [1, "single"], // specify whether double or single quotes should be used + "quotes": [1, "single", "avoid-escape"], // specify whether double or single quotes should be used "quote-props": 0, // require quotes around object literal property names (off by default) "semi": 1, // require or disallow use of semicolons instead of ASI "sort-vars": 0, // sort variables within the same declaration block (off by default) diff --git a/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js b/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js index d6afa3e064458f..c229b60c321540 100644 --- a/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js +++ b/Libraries/Components/ActivityIndicatorIOS/ActivityIndicatorIOS.ios.js @@ -12,7 +12,6 @@ 'use strict'; var NativeMethodsMixin = require('NativeMethodsMixin'); -var NativeModules = require('NativeModules'); var PropTypes = require('ReactPropTypes'); var React = require('React'); var StyleSheet = require('StyleSheet'); diff --git a/Libraries/Components/ScrollResponder.js b/Libraries/Components/ScrollResponder.js index 0818a0bf91cfde..94e0850f2988be 100644 --- a/Libraries/Components/ScrollResponder.js +++ b/Libraries/Components/ScrollResponder.js @@ -183,7 +183,7 @@ var ScrollResponderMixin = { var currentlyFocusedTextInput = TextInputState.currentlyFocusedField(); if (!this.props.keyboardShouldPersistTaps && currentlyFocusedTextInput != null && - e.target != currentlyFocusedTextInput) { + e.target !== currentlyFocusedTextInput) { return true; } return this.scrollResponderIsAnimating(); @@ -244,7 +244,7 @@ var ScrollResponderMixin = { var currentlyFocusedTextInput = TextInputState.currentlyFocusedField(); if (!this.props.keyboardShouldPersistTaps && currentlyFocusedTextInput != null && - e.target != currentlyFocusedTextInput && + e.target !== currentlyFocusedTextInput && !this.state.observedScrollSinceBecomingResponder && !this.state.becameResponderWhileAnimating) { this.props.onScrollResponderKeyboardDismissed && diff --git a/Libraries/Components/Subscribable.js b/Libraries/Components/Subscribable.js index cf9bc773a67503..8474b214994f4b 100644 --- a/Libraries/Components/Subscribable.js +++ b/Libraries/Components/Subscribable.js @@ -11,7 +11,7 @@ */ 'use strict'; -var EventEmitter = require('EventEmitter'); +import type EventEmitter from 'EventEmitter'; /** * Subscribable provides a mixin for safely subscribing a component to an diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index a9ee724fa1b0c5..18491d52c2f60b 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -75,7 +75,7 @@ var WebView = React.createClass({ errorEvent.code, errorEvent.description); } else if (this.state.viewState !== WebViewState.IDLE) { - console.error("RCTWebView invalid state encountered: " + this.state.loading); + console.error('RCTWebView invalid state encountered: ' + this.state.loading); } var webViewStyles = [styles.container, this.props.style]; @@ -152,7 +152,7 @@ var WebView = React.createClass({ onLoadingError: function(event) { event.persist(); // persist this event because we need to store it - console.error("encountered an error loading page", event.nativeEvent); + console.error('Encountered an error loading page', event.nativeEvent); this.setState({ lastErrorEvent: event.nativeEvent, diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index de9ff2ef14cbb3..83af4a8adc3910 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -14,7 +14,6 @@ var ActivityIndicatorIOS = require('ActivityIndicatorIOS'); var EdgeInsetsPropType = require('EdgeInsetsPropType'); var React = require('React'); -var ReactNativeViewAttributes = require('ReactNativeViewAttributes'); var StyleSheet = require('StyleSheet'); var Text = require('Text'); var View = require('View'); @@ -198,7 +197,7 @@ var WebView = React.createClass({ onLoadingError: function(event: Event) { event.persist(); // persist this event because we need to store it - console.error("encountered an error loading page", event.nativeEvent); + console.error('Encountered an error loading page', event.nativeEvent); this.setState({ lastErrorEvent: event.nativeEvent, diff --git a/package.json b/package.json index 3fffc54910936c..d524c1785067b2 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ ], "scripts": { "test": "jest", - "lint": "node linter.js Examples/", + "lint": "node linter.js Examples/ Libraries/Components", "start": "./packager/packager.sh" }, "bin": {