Commit Graph

37 Commits

Author SHA1 Message Date
Eli White 88e736c6cd Add no-dupe-class-members to RN ESLint fonfig
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
2018-10-26 12:28:49 -07:00
Rotem M 7f0a4f72b4 Initial Detox E2E iOS configuration to be run on RNTester (#20235)
Summary:
This PR adds initial setup for Detox E2E iOS and some tests for ButtonExample.
Pull Request resolved: https://github.com/facebook/react-native/pull/20235

Reviewed By: hramos

Differential Revision: D8924525

Pulled By: TheSavior

fbshipit-source-id: 8117fc1559c2e9cb831f7b081aa8f4ddc8ba7401
2018-07-30 14:31:24 -07:00
Tim Yung 6ed6bffe4e RN: Ignore Unused Rest Property Siblings
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
2018-07-12 16:31:32 -07:00
Eli White 1e2de71290 Allow trailing commas
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
2018-05-10 19:10:38 -07:00
Alex McKelvey 89757edb34 Add eslint-plugin-react-native Yarn package and enable no-inline-styles rule for Marketplace
Reviewed By: TheSavior

Differential Revision: D7158098

fbshipit-source-id: 52c92c5427d27278c8f82ffa5d61b7e9ebbf7824
2018-03-07 22:38:46 -08:00
Andres Suarez 59401f89c1 Fold .eslintrc's into the root eslintrc
Reviewed By: TheSavior

Differential Revision: D6997050

fbshipit-source-id: 81e45d24343cca8336adb0de43bd766899ff03b6
2018-02-15 07:53:52 -08:00
Andres Suarez bba19e846e Upgrade to ESLint v4.17.0 (plus update related deps)
Reviewed By: adamjernst

Differential Revision: D6956725

fbshipit-source-id: d223aa238dbb67190a1c244c7d482fc95005ccb0
2018-02-09 22:01:16 -08:00
Eli White a1a0a69546 Enable eslint-plugin-eslint-comments in RN
Reviewed By: sahrens

Differential Revision: D6677677

fbshipit-source-id: d1bf9191a405f05dfb3a5c1e50b0d013cf1fe26d
2018-01-08 17:04:29 -08:00
Eli White 67a3c42d1a Require valid expect
Reviewed By: cpojer

Differential Revision: D6671552

fbshipit-source-id: e254d3a308fac0802084b8d328bd3ee38c7bc8ce
2018-01-08 14:17:55 -08:00
Eli White 9a36872f0c Use jest eslint plugin to disallow disabled tests
Reviewed By: cpojer

Differential Revision: D6671502

fbshipit-source-id: 8f1757e5cc2d1a1d8a339aea63dbff7690ae1aff
2018-01-08 14:17:55 -08:00
Eli White 79902f99b8 Finish migration from jasmine to jest
Reviewed By: cpojer

Differential Revision: D6671373

fbshipit-source-id: e9570b9a9da6063576905719f7ffc5465cda737a
2018-01-08 14:17:55 -08:00
Eli White 9c67e749d8 Move Lint Rules to React Native
Reviewed By: sahrens

Differential Revision: D6671226

fbshipit-source-id: 80d92569c72c766103d096b251ef5729dafb4592
2018-01-08 14:17:55 -08:00
Eli White 183c316f4c Strengthen React Native eslint rules
Reviewed By: sahrens

Differential Revision: D6670469

fbshipit-source-id: f4f86fd0921eab3697c10caaba00934ba8adc2f6
2018-01-08 14:17:55 -08:00
Eli White 2815ada238 De-dupe eslint rules from xplat/js
Reviewed By: sahrens

Differential Revision: D6670226

fbshipit-source-id: ab5a67c18248af033634cbc7966292187e14b120
2018-01-05 16:45:58 -08:00
Oleksandr Sokolov 2cb87dfacd Bump react/jsx-no-undef (undefined require) from warning to error
Reviewed By: weicool

Differential Revision: D5843154

fbshipit-source-id: 0729cb19e3b3664a235320e908af51b2f56cc4ae
2017-09-15 12:01:04 -07:00
Eli White 36f2d18b10 Disallow trailing commas in react-native-github
Reviewed By: cpojer

Differential Revision: D5645043

fbshipit-source-id: 7378cc96ce39d3d18da7fba51d48db84cfdfa08f
2017-08-17 16:20:04 -07:00
Nat Mote 2fda10112f Enable jsx-no-comment-textnodes
Reviewed By: zertosh, TheSavior

Differential Revision: D5492891

fbshipit-source-id: 25bfc41b5a962fa643e2a402b9c9b031da972150
2017-07-26 11:21:59 -07:00
Eli White 10230707cb Enforce Prettier for @format
Reviewed By: zertosh

Differential Revision: D5392376

fbshipit-source-id: 6f09a4d8f4542c3a74aadb8d62fd216529a4f2bc
2017-07-10 15:37:36 -07:00
Eli White 40fdd6d91c Enable eslint on circle ci
Reviewed By: zertosh

Differential Revision: D5374369

fbshipit-source-id: 5ffd246bc6fa735d781ed71cd293b7883184b786
2017-07-10 12:08:32 -07:00
Philipp von Weitershausen 16bb6e87ba XHR: support typed arrays for request payloads
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
2017-01-20 18:43:27 -08:00
David Aurelio e1c0e04833 add `no-const-assign` rule
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
2017-01-12 10:28:33 -08:00
Pieter De Baets a1402511f5 Update .eslintrc
Reviewed By: davidaurelio

Differential Revision: D3960563

fbshipit-source-id: 1c7b238e6fa1040b0d29bafd6f878c1319b040da
2016-10-03 03:14:46 -07:00
Janic Duplessis 18394fb179 Initial implementation of requestIdleCallback on Android
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
2016-07-13 18:58:20 -07:00
Pieter De Baets ca1caf2713 Enable no-duplicate-props lint rule
Reviewed By: davidaurelio

Differential Revision: D3281234

fbshipit-source-id: 1b382694ad7a647464add4d1c856e7dde472205d
2016-05-10 05:00:24 -07:00
Konstantin Raev 26b2aa91b6 Removed eslint rule that checks modules
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
2016-03-10 15:59:22 -08:00
Satyajit Sahoo 36f1961003 Use flow-bin to typecheck locally, update ESLint to 2.0
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
2016-03-03 04:15:59 -08:00
Tim Yung 087eeda616 RN: Allow `X == null` in ESLint
Reviewed By: voideanvalue

Differential Revision: D2908714

fb-gh-sync-id: a5f382fb3a71517fdab4c809311e78323e284fd9
2016-02-06 00:40:35 -08:00
Janic Duplessis af2f40754a Add global flow types to eslint globals
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
2016-01-27 15:55:34 -08:00
Christopher Chedeau 69a4024c85 Fix lint warnings when adding a new js file
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
2015-09-22 13:05:43 -07:00
Alex Kotliarskyi d82af3cb92 Fix "global-strict" lint
Reviewed By: @vjeux

Differential Revision: D2420561
2015-09-09 11:25:18 -07:00
Jared Forsyth 52725437d4 Upgrating linting to use babel-eslint 2015-05-22 11:16:35 -08:00
Spencer Ahrens 1c70f33511 [ReactNative] clean lint for Libraries/Components 2015-05-18 15:54:07 -08:00
Eric Sauter 711dd6602e Fix lint errors and warnings
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.
2015-05-14 09:39:52 -08:00
Christopher Chedeau 85e1ad6b61 Updates from Mon 6 Apr
- [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
2015-04-06 08:38:56 -07:00
Spencer Ahrens ed656633bc Fix some lint. 2015-03-26 10:32:15 -07:00
Christopher Chedeau 9bebc7e519 Updates from Wed Feb 25
- [react-packager] Fix lint errors | Amjad Masad
- [react-packager] fix a typo s/pacakge/package | Chengyin Liu
- [react-packager] Fix jest tests | Amjad Masad
- [Image] Really improve the quality of mis-sized images w/trilinear filtering | James Ide
2015-03-02 10:42:31 -08:00
Ben Alpert a15603d8f1 Initial commit 2015-01-29 17:10:49 -08:00