Summary: This should catch errors with people redefining component lifecycle methods or other class members. We have this for object properties already but must not have updated the config for classes.
Reviewed By: helouree
Differential Revision: D11540725
fbshipit-source-id: d56091170aecf31bbd50ef3c76fc3970ca45466d
Summary:
Configures ESLint to allow unused variables that are the sibling of a rest property.
For example:
```
// It is okay for `type` to be unused.
const {type, ...coords} = data;
```
Reviewed By: TheSavior
Differential Revision: D8779952
fbshipit-source-id: 1f7b756a75d9363b85e05209ce2a9bb536c5d4da
Summary: This was previously set to disallow trailing commas on function arguments which prettier would add. Since we are dropping support for node < 8, we can now change this setting to require trailing commas everywhere and be consistent with the prettier config at Facebook.
Reviewed By: hramos
Differential Revision: D7961098
fbshipit-source-id: fbe49513183a8c8e027bb05467a767235dbfb15b
Summary:
Support `xhr.send(data)` for typed arrays.
**Test plan:** run UIExplorer example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/11904
Differential Revision: D4425551
fbshipit-source-id: 065ab5873407a406ca4a831068ab138606c3361b
Summary: Adds the `no-const-assign` rule to our `.eslintrc`, because sometime people assign to `const`.
Reviewed By: bestander, jeanlauliac
Differential Revision: D4409485
fbshipit-source-id: c74ad9649ec665e3f2ba2da7843f4e261303c9e7
Summary:
This is a follow up of the work by brentvatne in #5052. This addresses the feedback by astreet.
- Uses ReactChoreographer with a new callback type
- Callback dispatch logic moved to JS
- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.
** Test plan **
Tested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.
Tested that native only calls into JS when there are pending idle callbacks.
Also tested that timers are executed before idle callback.
```
requestIdleCallback(() => console.log(1));
setTimeout(() => console.log(2), 100);
burnCPU(1000);
// 2
// 1
```
I did *not* test with webworkers but it should work as I'm using executor tokens.
Closes https://github.com/facebook/react-native/pull/8569
Differential Revision: D3558869
Pulled By: astreet
fbshipit-source-id: 61fa82eb26001d2b8c2ea69c35bf3eb5ce5454ba
Summary:Removed eslint rule that checks modules
After we updated to ESLint 2.x, ESLint started complaining `'use strict' is unnecessary inside of modules strict`.
This is correct behaviour because according to spec modules are strict.
The problem is that our transforms don't transpile strict mode so we still need to have this pragma in all our code.
I did not find a way to make eslint require "use strict" for ES6 modules: https://github.com/eslint/eslint/issues/2785
So I am removing this.
What stops us from automatically adding strict mode with babel?
Need your feedback, frantic martinbigio
David said that you Martin looked into this.
Closes https://github.com/facebook/react-native/pull/6403
Differential Revision: D3038039
Pulled By: martinbigio
fb-gh-sync-id: b8a00c093768a318487dcb89e433859825a08b2c
shipit-source-id: b8a00c093768a318487dcb89e433859825a08b2c
Summary:Using local version of the Flow make it easy to have project specific version instead of relying on the user to have the correct version installed globally. For example, React Native uses an older version of Flow, while I have the latest version installed. Now I cannot typecheck the code because my version doesn't match the `.flowconfig`.
**Test plan (required)**
Run `npm run lint` and `npm run flow` to run `eslint` and `flow`.
cc bestander mkonicek
Closes https://github.com/facebook/react-native/pull/6145
Reviewed By: dmmiller
Differential Revision: D2976616
Pulled By: bestander
fb-gh-sync-id: bb08f6f8ceb09f644ec1d45c40b4cb7a9d3cfef5
shipit-source-id: bb08f6f8ceb09f644ec1d45c40b4cb7a9d3cfef5
Summary:
Added a subset of the global flow types from the fbjs eslint config to remove the no-undef errors for flow types as well as a few missing browser globals that were used in the codebase.
I also added a .eslintrc file to Examples to allow using alert there without warnings.
Closes https://github.com/facebook/react-native/pull/5585
Reviewed By: svcscm
Differential Revision: D2872016
Pulled By: vjeux
fb-gh-sync-id: f9b1b511289425393074b7237049dec38ea407b6
Summary: @public
When we updated eslint, some of the rules have been renamed and are spamming everytime someone adds a new js file. It turns out that the rules that those have been deprecated to were already present in the current eslint config and enabled, so I just needed to remove them.
Reviewed By: @jingc
Differential Revision: D2467315
Summary:
Fix the following problems resulting from running `npm run lint`:
```
Examples/Movies/SearchScreen.js
118:4 error 'fetch' is not defined no-undef
177:4 error 'fetch' is not defined no-undef
Examples/UIExplorer/MapViewExample.js
32:1 warning Missing semicolon semi
Examples/UIExplorer/NavigatorIOSColorsExample.js
48:26 warning ['lightContent'] is better written in dot notation dot-notation
Examples/UIExplorer/TabBarIOSExample.js
81:16 warning Trailing spaces not allowed no-trailing-spaces
Examples/UIExplorer/TextInputExample.js
390:7 warning Missing semicolon semi
✖ 6 problems
```
Closes https://github.com/facebook/react-native/pull/1254
Github Author: Eric Sauter <esauter@lgscout.com>
Test Plan: Imported from GitHub, without a `Test Plan:` line.
- [ReactNative] Revert D1965911 | Christopher Chedeau
- [ReactNative] Remove experimental Portal only needed for android right now. | Spencer Ahrens
- [ReactNative] rename Animation to AnimationExperimental with warning docs | Spencer Ahrens
- navigator.getCurrentRoutes() | Eric Vicenti
- Fixing jsdoc parsing of functions that are defined over multiple lines (Fixes#410) | Christopher Chedeau
- Added constraint of child type to touchablewithoutfeedback | Christopher Chedeau
- [react-packager] Deprecate global image namespace in favor of CommonJS resolution | Amjad Masad
- [react-packager] Don't cache rejected promise | Amjad Masad
- [ReactNative] Start Navigator gesture config, disable gesture in AdsManager | Eric Vicenti
- [Flow] Clean react-native-github for Flow v0.8.0 | Gabe Levi
- add maximumValue and minimumValue as valid attributes for native Slider | Christopher Chedeau
- react-packager: Add ES6 import statement support to DependencyGraph. | Amjad Masad
- Remove false annotation | Christopher Chedeau
- [madman] prevent pulling the content down inconsistently when the keyboard shows up | Kevin Gozali
- add @flow back to View.js | Basil Hosmer
- [ReactNative] Turn of lint warning for constant conditions | Eric Vicenti
- [UIExplorer] Fixed 'Push View Example' in NavigatorIOS example | Christopher Chedeau
- SliderIOS.js comments - grammar correction | Christopher Chedeau